it doesn't work on my geforce4! the water surfaces are just black. does anybody have a gf3/gf4/gffx and this effect shows up? i am sure that nvidia cards support this too somehow!

but thanks for sharing!

here is my explanation why environment mapping doesn't work on flat surfaces:

the vertex normals of flat surfaces all point into the same direction. with fixed function environment mapping the same view vector gets used for the whole object. so the resulting reflection vectors will all point into the same direction too and this causes that always the same pixel of the environment map gets sampled. the surface will be single colored because it shows one pixel only.

the way to do better environment mapping which works on planes is with a vertex shader. you can calculate an individual view vector per vertex:

Code:

texture mtlSkin1;
matrix matWorldViewProj;
matrix matWorld;
vector vecViewPos;

technique environment_mapping
{
pass p0
{
Texture[0]=<mtlSkin1>; // cube map

VertexShaderConstant[0]=<matWorldViewProj>;
VertexShaderConstant[4]=<matWorld>;
VertexShaderConstant[8]=<vecViewPos>;

VertexShader=
decl
{
stream 0;
float v0[3]; //position
float v3[3]; //normal
float v7[3]; //uv
}
asm
{
vs.1.1
m4x4 oPos,v0,c0 // output vertex position to clip space

m4x4 r0,v0,c4 // transform vertex position to world space

sub r0,c8,r0 // calculate view vector
dp3 r0.w,r0,r0 // renormalize it
rsq r0.w,r0.w
mul r0,r0,r0.w

m3x3 r1,v3,c4 // transform vertex normal to world space

// calculate reflection vector
dp3 r2,r1,r0 // n.v
add r3,r1,r1 // 2n
mad oT0,r2,r3,-r0 // 2n(n.v)-v
};
PixelShader=
asm
{
ps.1.1
tex t0
mov r0,t0
};
}
}