Hi Jonathan,
I used osgdem to create a Terraindatabase from 2 image files (Heightmap and Colormap). Is there any way to access the height information in a texture? I need to do some calculations in the shader for which i need informations abount the surrounding terrain height, at guessed that it would be the easiest to look them up from a texture - but i only have the colormap in the *.ive files.
If you can relate scene units to real height in some way (say scene units are meters and Z=0 corresponds to "H" meters above sea level) then it's pretty trivial to do this without even having the height in a texture. Just transform vertex coordinates to world space in the vertex shader, output those in a varying, and in the fragment shader you'll have the world-space location of your pixel. The Z of this will be the height, relative to "H" above. You can pass "H" to the shaders in a uniform that you set at your scene root.
If you're in a weird projection then I wouldn't know, but this should work fine for flat-earth models I think.
Hope this helps, J-S -- ______________________________________________________ Jean-Sebastien Guay jean-sebastien.g...@cm-labs.com http://www.cm-labs.com/ http://whitestar02.dyndns-web.com/ _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org