1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-03 20:15:33 +00:00
openmw/files/water/water1.cg
2012-01-18 22:42:07 -05:00

39 lines
No EOL
1.1 KiB
Text

void main( in float4 fresnel : COLOR0,
in float4 inTex0 : TEXCOORD0,
in float4 inTex1 : TEXCOORD1,
in float4 inTex2 : TEXCOORD2,
in float4 inTex3 : TEXCOORD3,
in float4 inTex4 : COLOR1,
in float4 inTex5 : BCOL1,
out float4 outCol : COLOR,
uniform float4 matrix,
uniform sampler2D offsetTexture : texunit0,
uniform sampler2D reflexTexture : texunit1,
uniform sampler2D refractTexture : texunit2,
uniform sampler2D depthTexture : texunit3)
{
float4 norm = tex2D(offsetTexture, inTex0.xy);
float4 refr = tex2D(depthTexture, inTex3.xy);
float4 norm2 = tex2D(offsetTexture, inTex0.xy/10.0f);
float4 projCoord = inTex1 / inTex1.w;
projCoord = (projCoord + 1.0) * 0.5;
projCoord += norm * 0.02;
projCoord = clamp(projCoord, 0.001, 0.999);
float4 reflexe = tex2D(reflexTexture, projCoord.xy);
float4 refrakce = tex2D(refractTexture, projCoord.xy);
float4 odrazy = reflexe*(0.7+0.3*refr);
reflexe = (float4(0,0.4,0.4,1.0) + reflexe*0.5);
outCol = lerp(refrakce, reflexe, fresnel.r)-refr*0.08;
//outCol = lerp(refrakce, reflexe, fresnel.r);
// outCol = norm;
outCol.a = 1;
}