"The best thing about a boolean is even if you are wrong, you are only off by a bit."
- Anonymous
More pages: 1 2
Self shadowing bumpmapping updated
Thursday, January 15, 2004 | Permalink

The self shadowing bumpmapping demo has been updated to support offset mapping too, which further improves the sense of depth in the picture, and isn't very expensive either.



Enter the code below

Thursday, January 15, 2004

Now that we've got some better bump mapping, I wonder if we can get a less memory intensive self shadowing method, other than horizion maps

Thursday, January 15, 2004

Actually, horizon maps doesn't need to be that memory intensive. In fact, the horizon maps I'm using now are only 64KB, so it's even smaller than the base and bump maps. For offset mapping to work well you need fairly smooth bumpmaps, and in that case you don't need very high res horizon maps either.

Thursday, January 15, 2004

Hello,looks nice,but if you got idea from


,_please_ inform about that guy who done that nice offset mapping first.


Dmytry Lavrov.

Thursday, January 15, 2004

Oki, I have added a link to the topic on opengl.org.

Friday, January 16, 2004

Humm... 64k? Are you using some sort of compression? The horizion map demo over at delphi3d.net is around 4mb. If you use an uncompressed angle map at a 4 direction sampling rate, you're already looking at 1MB of data. Am i missing something?

Friday, January 16, 2004

You don't need to use full resolution horizon map. The base and normal maps in the demo are 512x512, but the horizon maps are just 64x64x16.

Andrey S.
Friday, January 16, 2004


Nice demo, Humus.
I've experimented a little with this offset mapping, and got
some interesting results. Replace these 2 lines in the fragment

float height = tex2D(Elev, texCoord);
float2 newTexCoord = texCoord + viewVec.xy * (height * 2.0 - 1.0) * 0.04;

with this:

float3 n = tex2D(Bump, texCoord) * 2.0 - 1.0;
n = normalize(n);
float height = tex2D(Elev, texCoord) * 2.0 - 1.0;
float nh = max(min(viewVec.z * n.z * height / max( dot(viewVec, n), 0), 1), -1);
float2 newTexCoord = texCoord + viewVec.xy * nh * 0.04;

It seems to me that surfaces begin to look even more "bumpy" especially when the viewer is
close to the surface.

What do you think about this?

Friday, January 16, 2004

The horizon maps don't need to be particularly big, and they also compress quite well - DXTn/S3TC should be very effective. Unfortunately most cards don't yet support compressed volume-texture formats, but there's some in the pipeline that have very similar characteristics to DXTn.

Lengthier discussion in the paper at http://www.eelpi.gotdns.org/papers.html - it's the "self shadowing bumpmap one near the bottom (er... obviously :-)

Dmytry is right, it's always nice to give attribution. Though I do remember doing this offset effect using the old EMBM thing on Matrix G400 cards - obviously this means it will also work on the GF3 and Radeon 7000 cards, which is nice. There's also another even simpler version that Corrinne Yu told me called "parallax texturing" which works better for some bumpmaps and worse for others.


More pages: 1 2