From 3f3a9ece007653a7b36eb25d0e18ee8ecd8a5782 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Wed, 4 Apr 2012 22:26:03 +0200 Subject: [PATCH] Rembrandt: Put the ambient pass effect in fgdata --- Effects/ambient.eff | 66 ++++++++++++++++++++++++++++++++++++++++++++ Shaders/ambient.frag | 15 ++++++++++ Shaders/ambient.vert | 4 +++ 3 files changed, 85 insertions(+) create mode 100644 Effects/ambient.eff create mode 100644 Shaders/ambient.frag create mode 100644 Shaders/ambient.vert diff --git a/Effects/ambient.eff b/Effects/ambient.eff new file mode 100644 index 000000000..2c45a8d2a --- /dev/null +++ b/Effects/ambient.eff @@ -0,0 +1,66 @@ + + + Effects/ambient + + + false + + false + + + 0 + RenderBin + + + 0 + depth-buffer + + + 1 + normal-buffer + + + 2 + diffuse-buffer + + + 3 + spec-emis-buffer + + + Shaders/ambient.vert + Shaders/ambient.frag + + + depth_tex + sampler-2d + 0 + + + normal_tex + sampler-2d + 1 + + + color_tex + sampler-2d + 2 + + + spec_emis_tex + sampler-2d + 3 + + + + + diff --git a/Shaders/ambient.frag b/Shaders/ambient.frag new file mode 100644 index 000000000..d6596a1d9 --- /dev/null +++ b/Shaders/ambient.frag @@ -0,0 +1,15 @@ +uniform sampler2D color_tex; +//uniform sampler2D ao_tex; +uniform sampler2D normal_tex; +uniform sampler2D spec_emis_tex; +uniform vec4 fg_SunAmbientColor; +void main() { + vec2 coords = gl_TexCoord[0].xy; + float initialized = texture2D( spec_emis_tex, coords ).a; + if ( initialized < 0.1 ) + discard; + vec3 tcolor = texture2D( color_tex, coords ).rgb; +// float ao = texture2D( ao_tex, coords ).r; +// gl_FragColor = vec4(tcolor*fg_SunAmbientColor.rgb*ao, 1.0); + gl_FragColor = vec4(tcolor*fg_SunAmbientColor.rgb, 1.0); +} diff --git a/Shaders/ambient.vert b/Shaders/ambient.vert new file mode 100644 index 000000000..f01ebba78 --- /dev/null +++ b/Shaders/ambient.vert @@ -0,0 +1,4 @@ +void main() { + gl_Position = gl_Vertex; + gl_TexCoord[0] = gl_MultiTexCoord0; +}