Jump to content
  • Advertisement
Sign in to follow this  

3D Projected texture problem

This topic is 5137 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

Hello, I implemented reflections in water by rendering terrain to offscreen and projecting it on water plane with this: // tu = (0.8x + 0.5z) / z // tv = (0.8y - 0.5z) / z mat._11 = 0.8; mat._12 = 0.0f; mat._13 = 0.0; mat._21 = 0.0f; mat._22 = 0.8; mat._23 = 0.0; mat._31 = 0.5; mat._32 = -0.5; mat._33 = 1.0; mat._41 = 0.0f; mat._42 = 0.0; mat._43 = 0.0; SetTransform( D3DTS_TEXTURE1, &mat ); SetTextureStageState( 1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT3 |D3DTTFF_PROJECTED ); SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION ); Problem appears when moving up, because reflections move also up but too fast. Here are screenshots: http://srbine.tripod.com/screenshot1.jpg http://srbine.tripod.com/screenshot2.jpg or http://srbine.tripod.com/screenshot3.jpg http://srbine.tripod.com/screenshot4.jpg If I set mat._22 to zero than this would mean same Y for all points, but it is wrong, because camera-related matrix makes different Y values for individual vertices, depending on current view angle. Same view matrix is being used for rendering offscreen and onscreen. I already tried to translate Y of terrain, that is being taken to texture and it works fine if I move it just a little, otherwise this causes weird image (cannot compensate with adjusting Y) Is there anyway to solve this without shaders and also without cubemaps (they are too expensive)? I would be very grateful for informations.

Share this post

Link to post
Share on other sites
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!