Archived

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

ViaNNu

Reflection on water

Recommended Posts

Hy, I''m using directX to render water with a grid of vertex that can be deformed. To make it quite realistic I first apply a global blue texture and add a caustic to simulate light, for now that''s not to hard. There''s my problem : objects should reflect on my water when looking at them but without using raytracing because that''s not good for 3d real time. Here is a nice picture that shows exactly what I wanna do : http://www.gamekult.com/tout/jeux/fiche_screenshots.html?cmedia=ME0000086260 Well, does anyone know how it can be done ? ( only reflection, I don''t care about its later deformation )

Share this post


Link to post
Share on other sites
It basically works like normal geometric reflections, with the slight difference that you render to a texture (and don''t need a stencil buffer).

* render your reflected scene (upside down, flipped around the plane of the water) into a texture. Make sure the geometry is clipped, and invert the culling direction.

* When rendering your water surface: activate the texture created earlier (with the upside down scene) and use projective texturing to map it onto the water. Choose a nice blending mode for the texture, mix it with the water colour. That would give you basic (undistorted) reflections.

* There are several methods to get the distortions, and advanced effects such as EMBM, Fresnel or refractions. This thread has some more info about that.

/ Yann

Share this post


Link to post
Share on other sites