Sign in to follow this  
Christoph

water - projective texture problem

Recommended Posts

Hi, I succesfully render reflections to a texture and now want to project it to my water plane. This is what I'm doing:
Matrix4 matProject(0.5f,0.0f,0.0f,0.5f,0.0f,0.5f,0.0f,0.5f,0.0f,0.0f,0.5f,0.5f,0.0f,0.0f,0.0f,1.0f);
Matrix4 mTransposed = matWorld * view * projection;
Matrix4 mTransposed2 = matProject * projection * view;
mTransposed = mTransposed.Transpose();
mTransposed2 = mTransposed2.Transpose();

device->SetVertexShaderConstantF(0,mTransposed,4);
device->SetVertexShaderConstantF(6,mTransposed2,4);

Vertex-Shader:
vs.1.1
dcl_position v0

m4x4 r0, v0, c6
rcp r1, r0.w
mul r0, r0, r1

m4x4 oPos, v0, c0
mov oT0, r0

Well, there is something like a texture on my water plane now, but it is extremely stretched and moves weirdly with the viewer. I guess my matrix operation at mTransform is the problem (I have already tried several calculation orders, which did not help). I can't use shader 2.0 (-> tex2dproj), the highest version I am allowed to use is 1.4. Do I have to write a pixel shader at all? If yes, how does it look? Although I've read probably all threads and articles concerning this subject, I can't find my mistake. tHx for help!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this