Sign in to follow this  
DXMan

Cubic Environment Mapping

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this