1
0
Fork 0

Rembrandt: Put the ambient pass effect in fgdata

This commit is contained in:
Frederic Bouvier 2012-04-04 22:26:03 +02:00
parent fba49c56a3
commit 3f3a9ece00
3 changed files with 85 additions and 0 deletions

66
Effects/ambient.eff Normal file
View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>Effects/ambient</name>
<technique n="11">
<pass>
<lighting>false</lighting>
<depth>
<enabled>false</enabled>
</depth>
<render-bin>
<bin-number>0</bin-number>
<bin-name>RenderBin</bin-name>
</render-bin>
<texture-unit>
<unit>0</unit>
<type>depth-buffer</type>
</texture-unit>
<texture-unit>
<unit>1</unit>
<type>normal-buffer</type>
</texture-unit>
<texture-unit>
<unit>2</unit>
<type>diffuse-buffer</type>
</texture-unit>
<texture-unit>
<unit>3</unit>
<type>spec-emis-buffer</type>
</texture-unit>
<program>
<vertex-shader>Shaders/ambient.vert</vertex-shader>
<fragment-shader>Shaders/ambient.frag</fragment-shader>
</program>
<uniform>
<name>depth_tex</name>
<type>sampler-2d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>normal_tex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>color_tex</name>
<type>sampler-2d</type>
<value type="int">2</value>
</uniform>
<uniform>
<name>spec_emis_tex</name>
<type>sampler-2d</type>
<value type="int">3</value>
</uniform>
<!-- The following uniforms are automatically defined and initialized :
- fg_SunAmbientColor
- fg_SunDiffuseColor
- fg_SunSpecularColor
- fg_SunDirection
- fg_ProjectionMatrixInverse
- fg_ViewMatrixInverse
- fg_ViewMatrix
- fg_Planes
-->
</pass>
</technique>
</PropertyList>

15
Shaders/ambient.frag Normal file
View file

@ -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);
}

4
Shaders/ambient.vert Normal file
View file

@ -0,0 +1,4 @@
void main() {
gl_Position = gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}