Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

tomwindcloud

help: water-reflections

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

I''m working on water-reflections , the step is: 1 render the reflected objects to a texture. 2 render the water_plane geometry(using the texture from 1) 3 mask the scene with stencilBuffer(only render the water) 4 use bumpenv to make ripple. I have no problem with 3 and 4. But i''m little stumped with 1 and 2. 1. With D3DXCreateRenderToSurface, i get a surface. How can i convert it to a texture. 2. To render the water_plane geometry with the texture reflected, i must know the texture''s coordinates , how can i get it??? any hints? tomwindcloud

Share this post


Link to post
Share on other sites
Advertisement
LPDIRECT3DSURFACE9 OldSurface,TextureSurface;
Save old surface...
m_pd3dDevice->GetRenderTarget(0, &OldSurface);
Get texture surface...
pTexture->GetSurfaceLevel(0, &TextureSurface);
Set RenderTarget
m_pd3dDevice->SetRenderTarget(0,TextureSurface);
... Render ...
Set old surface...
m_pd3dDevice->SetRenderTarget(0,OldSurface);
pTexture - edge of Cubemap

Share this post


Link to post
Share on other sites

  • 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!