Quote:Original post by Kuroyume0161Yup, pretty much. ("all three vectors" throws me a bit - did you mean 'components?')
Pythagoras? Normalized? Huh?
;0)
I know what a normalized vector is (and Pythagoras). I see where you're going here. So the idea is assume a normalized resultant vector for all three vectors, one of which is missing (Z). Solve to find it.
Quote:But, will that give me relative height relationships corresponding to the overall normal map? In other words, will that tell me that the point in the middle which, for illustration, is 128/128 becomes 255 because it is the highest Z-point on the map, from the 128/128 corner point becoming 0 because that is the lowest Z-point on the map?No, it won't give you any absolute heights. This is the thing about the constant of integration - given a heightmap that has samples across a 10 meter range, you don't know if the actual height is 0-10 metres above sea level, or 100-110 meters. That information simply isn't present in the normal map, nor can it be retrieved from it.
I assume you're trying to produce a heightmap across some particular range of greyscale values (0-255, right?). One way you *could* go about doing this is to:
a) Assume that the pixel at 0,0 is at height 0
b) Work out the relative heights of all other pixels. The values at each could be positive or negative (you'd want to use something large than 0-255 at this stage - -32000 to +32000 ought to do it, the range of a signed integer).
c) Loop through all your calculated heights to find the minimum and maximum values.
d) Scale+offset all your calculated heights so that the minimum height is mapped to 0 and the maximum height is mapped to 255.
One side-effect of that is that a heightmap ranging from 0 to 1 cm will come out with the same sort of values as one ranging from 0 to 1 meter. If you want to use these heightmaps together, you'll need to pick and scaling + offset value for each map. Because you're using the full range of values for each map, though, you'll get the greatest level of detail (instead of trying to pack your 0..1cm map into the values '0' and '1' [smile]).