Cubic Environment Mapping

Started by
5 comments, last by DXMan 19 years, 8 months ago
I've been working on the water portion of my game engine recently and have run into a problem... I'm using real-time cube mapping on my water object. The water object is pretty big in size and I have various terrin (islands mostly) scattered around on the surface. For some reason I can't get everything to reflect with proper size (some stuff doesn't reflect at all). It seems that the camera's FOV is too small for the surfaces. I tried offsetting the camera for each render of the cubemap faces but then the images overlap. Does anyone know how I can acheive accurate reflections on water surfaces?? It doesn't have to use cubemapping, but it does have to be distorted by the vertices, not with bumpmapping or something like that.
Advertisement
Cubic environment mapping assumes the environment is infinitely far from the object the environment mapping is being applied to. In practice you can get good results with an object that is just fairly distant from the surroundings but you'll run into problems if your object is large compared to the environment that's being reflected, espescially if it touches it in places (like if you try to reflect the coastline in the water where it touches).

Usually water effects are rendered by re-drawing the whole of the above-water environment reflected about the water plane rather than by using a cubic environment map.

Game Programming Blog: www.mattnewport.com/blog

and you can do that in two ways off the top of my head,
1, useing a clipping plane, this would be good if your water is a flat polygon
2, useing the stencel buffer, this would be good if you are useing some sort of hight map thingy for the water.
Bobboau, bringing you products that work... in theory
I messed around with re-drawing the scene reflected into a render surface and projecting it onto the surface but it doesn't give me the look I'm trying to achieve (because the water isn't a flat surface, it has ripple effects like the water in the "Water" sample in the DirectX9 SDK.

Could you go into more depth on how to use the stencil buffer to fix the problem??

Thanks for your help so far!
Could anyone help explain the above task ??
There's a presentation on nVIDIA's site that might be useful, though it's a bit light on details (I assume the article in GPU Gems explains more). Unfortunately they don't seem to have the demo up for download yet either so you can't refer to the source. Look around the ATI and nVIDIA sites though - they might have some more examples that do something similar.

Game Programming Blog: www.mattnewport.com/blog

Thanks for your help!

This topic is closed to new replies.

Advertisement