Hi all,
I’m trying to create a dynamically generated Heightmap.
My values range from 0 to ~8000 (generated from shaders), which forces me to scale them to the range 0-1 in order to store them in a texture (just by dividing it by my max value).
My issue is that I can’t find how to have the correct precision for this :
When using a DepthComponent texture to store the results, the heightmap seems fine :
http://postimage.org/image/vcd0ezwbx/full/
but when using a regular one (Luminance or even RgbXX), I get this result :
http://postimage.org/image/r7dmx4us7/full/
I think the “lines” that are visible come from a precision issue.
my result texture is initialized with the following code :
tex = Texture()
tex.setup2dTexture(512, 512, Texture.TUnsignedShort, Texture.FDepthComponent) //(first image)
and
tex.setup2dTexture(512, 512, Texture.TUnsignedShort, Texture.FLuminance) //(second image)
I tried replacing TUnsignedShort with TFloat, and FLuminance with FRgbXXX with no effect. The only difference between those two pictures is the component type during init.
I can’t just use the depth buffer to store my heightmap because I actually need it to do some tests for flattening some areas (buildings, roads…).
Am I missing something during the texture initialization, or even after that, maybe during my scaling ?