Archived

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

tomwindcloud

help: water-reflections

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