| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
- <!--
- FurMark's post processing effect.
- See at Geeks3D.com for a complete tutorial on how to code an effect for FurMark.
- Tags (for searching on Geeks3D.com): furmark post-processing effect
- -->
- <furmark>
- <post_processing>
- <texture filename="" uniform_sampler_name="fxTexture1" />
- <vertex_shader>
- <raw_data><![CDATA[
- void main()
- {
- gl_TexCoord[0] = gl_MultiTexCoord0;
- gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
- gl_Position = ftransform();
- }
- ]]></raw_data>
- </vertex_shader>
- <!--
- <pixel_shader>
- <raw_data><![CDATA[
- uniform sampler2D sceneBuffer;
- uniform float elapsedTime;
- uniform int sceneWidth;
- uniform int sceneHeight;
- uniform sampler2D fxTexture1;
- void main ()
- {
- //vec4 textureColor = texture2D(fxTexture1, gl_TexCoord[0].st);
- vec4 sceneColor = texture2D(sceneBuffer, gl_TexCoord[0].st);
- vec4 tex1Color = texture2D(fxTexture1, gl_TexCoord[0].st);
- sceneColor.r += texture2D(sceneBuffer, gl_TexCoord[0].st - 0.009*cos(elapsedTime*2.0)).r;
- sceneColor.g += texture2D(sceneBuffer, gl_TexCoord[0].st + 0.009*cos(elapsedTime*1.2)).g;
- sceneColor.b += texture2D(sceneBuffer, gl_TexCoord[0].st + 0.009*sin(elapsedTime*4.0)).b;
- sceneColor.rgb *= 0.5;
- gl_FragColor = sceneColor + tex1Color;
- }
- ]]></raw_data>
- </pixel_shader>
- -->
- <!--
- <pixel_shader>
- <raw_data><![CDATA[
- uniform sampler2D sceneBuffer;
- uniform float elapsedTime;
- uniform int sceneWidth;
- uniform int sceneHeight;
- //uniform sampler2D fxTexture1;
-
- const float saturation = 0.6;
- const float pi = 3.1415926535897932;
- const float offmul = 0.008;
- const float tcmul = 4.0;
- float noise(float x)
- {
- return (cos(x*pi)*cos(x*pi))*cos(x*3.0*pi)*cos(x*5.0*pi)*0.5+sin(x*25.0*pi)*0.02*saturation;
- }
-
- void main ()
- {
- float t = elapsedTime;
- float rt=0.014, gt=0.008, bt=0.010;
- float ro=0.018, go=0.006, bo=-0.026;
-
- vec2 tc = gl_TexCoord[0].xy;
- vec2 tcr = vec2(tc.x+ro+offmul*noise(rt+tc.y*tcmul+noise(t*pi+tc.y)), tc.y);
- vec2 tcg = vec2(tc.x+go+offmul*noise(gt+tc.y*tcmul+noise(t*pi+tc.y)), tc.y);
- vec2 tcb = vec2(tc.x+bo+offmul*noise(bt+tc.y*tcmul+noise(t*pi+tc.y)), tc.y);
- float r = texture2D(sceneBuffer, tcr).r;
- float g = texture2D(sceneBuffer, tcg).g;
- float b = texture2D(sceneBuffer, tcb).b;
-
- // N
- float gr = (r+g+b)*0.5;
- float fd = saturation;
- gr = gr*0.25+0.75*gr*gr;
-
- r = r*fd + gr*(1-fd);
- g = g*fd + gr*(1-fd);
- b = b*fd + gr*(1-fd);
- // N
-
- gl_FragColor = vec4(r, g, b, 1.0);
- }
- ]]></raw_data>
- </pixel_shader>
- -->
- <pixel_shader>
- <raw_data><![CDATA[
- uniform sampler2D sceneBuffer;
- uniform float elapsedTime;
- uniform int sceneWidth;
- uniform int sceneHeight;
- //uniform sampler2D fxTexture1;
- void main(void)
- {
- vec2 pixels[13];
- pixels[0] = vec2( -6, -6 );
- pixels[1] = vec2( -5, -5 );
- pixels[2] = vec2( -4, -4 );
- pixels[3] = vec2( -3, -3 );
- pixels[4] = vec2( -2, -2 );
- pixels[5] = vec2( -1, -1 );
- pixels[6] = vec2( 0, 0 );
- pixels[7] = vec2( 1, 1 );
- pixels[8] = vec2( 2, 2 );
- pixels[9] = vec2( 3, 3 );
- pixels[10] = vec2( 4, 4 );
- pixels[11] = vec2( 5, 5 );
- pixels[12] = vec2( 6, 6 );
-
- float weights[13];
- weights[0] = 0.002216;
- weights[1] = 0.008764,
- weights[2] = 0.026995;
- weights[3] = 0.064759;
- weights[4] = 0.120985;
- weights[5] = 0.176033;
- weights[6] = 0.199471;
- weights[7] = 0.176033;
- weights[8] = 0.120985;
- weights[9] = 0.064759;
- weights[10] = 0.026995;
- weights[11] = 0.008764;
- weights[12] = 0.002216;
-
- vec2 radius = vec2(0.002, 0.002);
- float bias = 0.05;
- float scale = 0.9;
-
- vec2 texcoord = gl_TexCoord[0].xy;
- vec4 col = vec4(0.0);
-
- for (int i=0; i<13; i++)
- {
- col += texture2D(sceneBuffer, texcoord+pixels[i]*radius)*weights[i];
- }
- col = clamp((col + bias) * scale, 0.0, 1.0);
- gl_FragColor = col;
- }
- ]]></raw_data>
- </pixel_shader>
- </post_processing>
- </furmark>
|