fteqw/engine/shaders/glsl/crepuscular_rays.glsl
Spoike 2ea981fe90 qc: qc temp-strings are now garbage collected. this makes strzone redundant.
net: revert the player angles inversion thing from last build. hack some angles. gonna need to tweak the protocol.
net: cl_lerp_players is smoother, and defaulted. lets see how many people complain.
cl: fix juddering with chase_active+prediction.
cl: download progress where the total size is not known now displays something more sane.
cl: fixed some issues with rawinput keyboards.
cl: added autoupdate option to the menu.
cl: autoupdate defaults to a new 'tested' set of builds, instead of the completely untested svn builds. 
cl: added 'borderless windowed' option to the  menus. works on windows.
cl: saved games save a preview screenshot.
cl: fix some memory leaks on shutdown.
cl: added 'setrenderer random' option, might be useful for modders in that it helps highlight bugs/differences between renderers...
qc: r_showbboxes now displays the fields of the various entities.
tweaked entity lighting to overbright more gracefully.
gl: fixed crepuscular lighting.
qcc: added % operator.
qcc: added inline keyword.
qcc: some fixes for accessors.
qccgui: now prompts for exe+basedir.
sv: added sv_specprint, ala mvdsv.
sv: stats now sent over the unreliable channel instead of the reliable one. this allows them to change more frequently.
sv: rewrote speedcheat detection. clients will be throttled instead of kicked. unresponsive clients will be simulated instead of freezing in mid-air.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4829 fc73d0e0-1445-4013-8a0c-d673dee63da5
2015-01-21 18:18:37 +00:00

44 lines
1.3 KiB
GLSL

!!cvarf crep_decay
!!cvarf crep_density
!!cvarf crep_weight
//this is a post-processing shader, drawn in 2d
//there will be a render target containing sky surfaces drawn with crepuscular_sky, and everything else drawn with crepuscular_opaque (to mask out the sky)
//this shader then just smudges the sky out a bit as though its coming from the sun or whatever through the clouds.
//yoinked from http://fabiensanglard.net/lightScattering/index.php
varying vec2 tc;
#ifdef VERTEX_SHADER
attribute vec2 v_texcoord;
void main ()
{
tc = v_texcoord;
gl_Position = vec4(v_position, 1.0);
}
#endif
#ifdef FRAGMENT_SHADER
const float crep_decay = 0.94;
const float crep_density = 0.5;
const float crep_weight = 0.2;
uniform vec3 l_lightcolour;
uniform vec3 l_lightscreen;
uniform sampler2D s_t0;
const int NUM_SAMPLES = 100;
void main()
{
vec2 deltaTextCoord = vec2(tc.st - l_lightscreen.xy);
vec2 textCoo = tc.st;
deltaTextCoord *= 1.0 / float(NUM_SAMPLES) * crep_density;
float illuminationDecay = 1.0;
gl_FragColor = vec4(0.0,0.0,0.0,0.0);
for(int i=0; i < NUM_SAMPLES ; i++)
{
textCoo -= deltaTextCoord;
vec4 sample = texture2D(s_t0, textCoo);
sample *= illuminationDecay * crep_weight;
gl_FragColor += sample;
illuminationDecay *= crep_decay;
}
gl_FragColor *= vec4(l_lightcolour, 1.0);
}
#endif