Jump to content
  • Advertisement
Sign in to follow this  
Christoph

water - projective texture problem

This topic is 4486 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!