Cube map reflection demo!

Blitz3D Forums/Blitz3D Programming/Cube map reflection demo!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

It's cool, but how accurate is it?

Will this work in anyhting other than a square reflecting pool?

The reason I ask is he's basically rendering a single view from below the water's surface looking up. So If the edges of the reflection map don't watch up with the edges of the pond, I dunno what sorts of results you'll see at the edges of the pool. Maybe it will work though. I suppose those areas outside the circle of the pool would be images of the edges of the inside.

I also wonder if this would look right on a large body of water, like an ocean. I guess you'd have to get the perspective of the camera right or else you might end up being able to see the reflection of an island miles from it. Assuming you could have an ocean that big.



You could get an even more realistic look for the water if you combined cubic mapping with spherical refelction maps, and did multiple passes.

I'm guessing that right now, he's got the cubic map multiplying with the color of the water so that the lighting on the water affects the brightness of the cubic map.

But if I'm not mistaken, the cubic map should be additive blended, being that it is a reflection of light in the room.

Of course neither of these is totally correct. Because the water's brightness would have an effect.

I think what you could do to get a realistic water effect is this:

1. Make one surface with the cube map fullbright.

2. Create a spherical environment map with a gradient from white to black from top to bottom. Apply spherical map to next surface, with surface set to multiply. Reflections nearer the viewer will fade out. This surface should be fullbright.

3. Apply water texture to last surface, allow it to be affected by light. Set alpha to 50%.


I don't have a pic of water I'm looking at right now so I can't be sure if that's totally accurate.


One thing I would do is try to find a way to stretch objects in the water vertically. Scaling the camera on the Z axis may work. If you've ever paid attention to reflections on a wet road, what you get is very elongated images of the objects being reflected. And water often blurs the images in the same way I beleive. Painters use the technique to get a watery look.


Another thing I might try is inverting the normals of the layer with the environment map, and allow it to be affected by light. That would darken the environment map where the water is brightest, and let the environment show through completely where the water is darkest. Though because of the way DX lighting can overbrighten things, you might need to darken the color of the surface a bit to cancel out the overbrightening.


The methods I describe here of course require three passes which is more expensive. But the results would look more interesting and realistic. There may be some way to get a similar effect with the multitexturing units so as not to get a speed hit, I'll have to think about it.