Matthew Doucette
Newcomer
Indeed!Yes, this is because bump mapping is basically only a fake... ;-)
Anyway, your example and your explaination still confuses me:
You worte in the example:
P = perturbation vector (composed of rise/run slopes, gradients, in x, y, and z)
If it is like it is in your explaination there shouldn't be a gradient in z direction because a bump map is only a 2d heightfield. There are just x- and y-slopes.
I have a strong feeling everything I am about to say is only going to add more confusion... as I am confused as to where I am losing you!
Let me try to figure some of this out...
My 3D bump map is just a 3D "array" of height values, so in that sense, any specific individual point in my 3D bump map is a height value the same as any point in a 2D bump map is.
Why I need to use the z-gradient:
If I were to ignore z when calculating the perturbation vector, then I would be ignoring all rate-of-changes (slopes) in the z directions of my bump map. This is obviously incorrect. (Well, this should be some sort of hint that it is incorrect I mean!) Imagine bump mapping a plane that exists in (x,z), which is the plane defined by y=0. If I were to bump map that plane, I would need to consider changes as we move through z in the bump map. If I were to only consider changes in x and changes in y, then I would be ignoring how the bump map defines bumps as we move through z.
I think you are confusing the three dimensions of the bump map (we can sample the bump map in 3D) and the single dimenison of the bump map's values (the values we get from sampling are 1D height values).
A bump map defined by a 2D texture is just a 2D height field. My 3D bump map would be a 3D height field, but that conceptually makes little sense, as you never use the full 3D of the 3D bump map... you only use 2D planes "carved" out of it. The only purpose of a 3D texture is so that it can be mapped to a 3D surface without distortion. Other than that, my 3D bump map is much the same as a 2D bump map.
...
At this point, I think the best thing to do is forget everything I said! Clear your mind, and check out the code snippet in this same thread. It is a very easy algorithm. That algorithm is the same bump map algorithm I have implemented. I think everything will make sense once you grasp what Ken Perlin is doing in that code.
Let me know if any part of his code makes no sense... because we are talking about his code really.
Last edited by a moderator: