Horizon mapping on current hardware

Started by
3 comments, last by EvilDecl81 19 years, 7 months ago
Hello, I want to give horizon mapping a try. I read the "interactive horizon mapping" paper. The author used DirectX 7 class hardware. What's a good way to do it on current hardware (GF4 and above, VS 1.1, PS 1.3)? I think 3D textures could be used instead of these 2 textures with 8 directions encoded into the 4 channels. This could reduce the needed texture units to just one. Am I right about this? Any suggestions? Thanks. Markus
Advertisement
Hmmm, let's see. It's quite some time ago when I read this paper, but I think I know what you mean.

So you would generate a monocrome 3d texture, where the 1st and 2nd coordinates are as usual and the 3rd coordinate depends on the light angle. You could create an arbitrary but power-of-2 number of light directions and store them in a single monocrome 3d texture. You wouldn't need those basis functions since the blending between different directions is done by bilinear filtering of the 3d texture.

At render time, you would determine the phi-angle between the normal and the light source (phi is not the elevation, but the other angle). Based on this phi-angle, you would set the 3rd texture coordinate. That's all. No further stuff to do.

Is that what you mean? That's a very, very good idea in my eyes. However, I haven't implemented horizon mapping yet, so I'm not sure if I've understood it correctly.
That's what I had in mind. Just wanted to check if there is somebody knowing an even better way to do it or if I overlooked something that would make 3D textures unsuitable for this.

Now I found a paper that used 3D textures for horizon mapping too. The question is what should be stored in the horizon map? The elevation angle? The sin of the elevation angle? The tangent of the elevation angle? The paper states tangent produced the best results. Is there anyone who has got some experience with this?

Tom Forsyth's paper "Self-shadowing Bumpmap using 3D Texture Hardware" describes something like this.

Also there's an article in GPU Gems called "Generating soft shadows using occlusion interval maps" but only works along a single path on the visible hemisphere (not the whole hemisphere) so only good for fixed path sun for example.

Quote:Original post by muhkuh
Hello,

I want to give horizon mapping a try. I read the "interactive horizon mapping" paper. The author used DirectX 7 class hardware. What's a good way to do it on current hardware (GF4 and above, VS 1.1, PS 1.3)? I think 3D textures could be used instead of these 2 textures with 8 directions encoded into the 4 channels. This could reduce the needed texture units to just one. Am I right about this? Any suggestions?

Thanks.

Markus


You talking about Peter-Pike Sloan's paper on horizon bump map shadows? There used to be a sample in DX framework that did this useing 2 texture (there was a bug in it for a while so that it looked wrong on retail builds, do to floating point roundoff issues, but I think the current one works.)


I assume you are talking about packing into a volume texture so you don't have to average horizon angles which have 0 contribution to the final horizon calculation? (using the angle to index one of the dimensions) This will definitly work, but it comes at the cost of increasing memory for an already memory heavy algorithm.

Another potential thing to try is use the vertex shader to compute the interpolation coefficents, yuou have to do an acos to do this but given most things are Vertex bound it could buy you performance by elimination a texture lookup to get the blending coefficents. You could also do this with a deep 3D texture (I think), but again this would start eating up a ton of memory.

EvilDecl81

This topic is closed to new replies.

Advertisement