Skip to main content
gamedev.net
🔒 Locked

Rendering reflections

Started by tashco Mar 20, 2000 at 9:38 AM 2 replies 700+ views
Original Post
tashco
tashco
In our game, we are trying to render terrain with lakes/sea. So we need to render the seabed, then the contents of the sea (subs), then the water as a surface, followed by the terrain and the vegetation on the terrain. We want to add reflections to the water. How should I structure the rendering pipeline to minimise the number of render passes I make? Should I also use the stencil buffer or another technique to cull reflected geometry? Many thanks. Mark Allen Lead Programmer Tashco Studios
Spellbound
Spellbound
The only way to render transparent reflections, i.e. where you can see both the reflection and whats below the surface, is to have either the reflection or the part under the surface as a texture. I suggest you do the surface reflection as a texture, that way you can utilize environmental bumpmapping or cube mapping to create ripples on the surface. If you render the part below the surface as a texture as well you can easily create the effect of refraction.

Just keep in mind that stencil buffering, environmental bumpmapping, cube environment map etc doesn''t exist on older cards so you''ll need some alternate way to fall back on.
dog135
dog135
If you made the reflection as a texture, wouldn''t it be off as you rotate around the terrain? I''d personaly calculate a low quality version of the terrain inverted and then draw horizontal lines in the color of the terrain on the water to give the appearance of waves while at the same time, lowering the number of calculations the engine needs to do.

E:cb woof!
E:cb woof!
Spellbound
Spellbound
Good point dog135. I forgot to mention that you need to update the texture(s) at runtime. This is done by rendering them to an offscreen surface or to the backbuffer that you then copy to an offscreen surface.

These updates must be made when the viewer has moved to far from where the textures where made the last time.

And yes you''ll definitely want to make the texture(s) with a lower detail version of the world. The lower detail will be somewhat hidden by the ripples in the water.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.