PDA

View Full Version : height map



jide
09-22-2006, 11:57 AM
Simple again I guess, but...

How can one create a depth-map of a texture ? Are there any tools for that ? Does a greyscale image of the original would suffice ?

zeoverlord
09-22-2006, 12:08 PM
only if your lucky enough that the grayscale image aproximates the depth map, most of the time it doesn't.
But other than that you have to do it manually.

jide
09-22-2006, 12:46 PM
Yeah that's what I thought about the lucky-stuff.

I've read somewhere I can use the normal map to deduce the height (threw the z-value). Threw my point of view this seems right, but then why do some mapping (like parallax) do need a normal map and a height map ? I must admit I still haven't understood all about.

zeoverlord
09-22-2006, 01:23 PM
The normal map can indeed be used to aproximate the heightmap, but the result is not that good and it can't be used within a shader, that is why you need a heightmap for parralax mapping, however, if you want to, the heightmap can be baked into the alpha channel of the normal map as 8 bit will do in most situations.

Paralax mapping needs the heightmaps as a reference in how much to displace the texture coordinates, for this you can't use normal maps or some kind of aproximated crap, you need a heightmap.

jide
09-23-2006, 06:25 AM
I actually don't see why it can't be used inside a shader. I haven't go into the code yet and I never used normal maps neither. But for me a normal map can be accessed from the fragment shader (and even the vertex shader for cards supporting it), so why not the height value if it is the blue value (z coord) from the same map ?

I've seen that 0 means the nearest value and 1 the farest one. Okay, but what exactly does it mean ? I mean that what amount of displacement does it mean ? I also see there are other things like offsets, do the latter help in determining the amount of displacement ?

I know I always have crappy questions... But I really lack docs about that (didn't really found helpfull ones).

Komat
09-23-2006, 06:38 AM
Originally posted by jide:
But for me a normal map can be accessed from the fragment shader (and even the vertex shader for cards supporting it), so why not the height value if it is the blue value (z coord) from the same map ?
Because none from normal map rgb channels represents the height, they represent direction of normal vector. From normal map you may directly get information that some texel contains slope with some angle however without processing the entire normal map you will not get information in what height that texel is. Calculating the slope (and thus the normal map) from the height map is easier because only several neighbour texels (theirs height) are required to calculate slope for single texel.