Re: [osg-users] [vpb] Terrain Height as Texture

2011-11-29 Thread Robert Osfield
Hi Jonathan,

On 15 November 2011 13:21, Jonathan Klein jonathan_kl...@web.de wrote:
 Well, the problem is, that I need the surrounding heights. It is a terrain 
 visualisation project and i need to calculate things like openness (some 
 Ambient Occlusion related thing) or terrain roughness, for which I need for 
 example a 5x5 kernel around my pixel, so a heightmap lookup would be the 
 easiest..

 It seams that there is no way to extract that information just form the 
 vertex data (because the vertex shader only processes one vertex at a time).

osgTerrain and VPB are set up to do what you are asking of them - they
are set up to use HeightField for elevation data that is the source of
the geometry tiles, and use image layers for the textures that are
assigned to the geometry tiles.

However, perhaps you could assign a HeightField as a image layer and
have it be textured on to your tile?  I'm not sure how this would all
work out, but go have a look at the code and see how you might be able
to co-opt it to do what you require.  If there are small tweaks you
can make to osgTerrain and VPB to make it all hang together cleanly
then just post these into osg-submissions and I can review them what I
get back to do doing a submissions purge.

Robert.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [vpb] Terrain Height as Texture

2011-11-25 Thread Jonathan Klein
Hi,

what about the GeometryType Parameter in osgdem?
http://www.openscenegraph.org/projects/VirtualPlanetBuilder/wiki/CommandLineOptions

I can't find any documentation what the difference between HEIGHT_FIELD, 
POLYGONAL and TERRAIN is, but I think, HEIGHT_FIELD might be able to solve my 
problem. But when I use gDEBugger, I only see my colormap and nothing like a 
height map. Here is how I build the terrain:

Code:
osgdem -d A:\TerrainExplorer\puget\ps_height.png -t 
A:\TerrainExplorer\puget\ps_texture.png -o A:\TerrainExplorer\puget\puget.ive 
-l 5 --HEIGHT_FIELD



Thank you!

Cheers,
Jonathan

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=44031#44031





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [vpb] Terrain Height as Texture

2011-11-15 Thread Jonathan Klein
Well, the problem is, that I need the surrounding heights. It is a terrain 
visualisation project and i need to calculate things like openness (some 
Ambient Occlusion related thing) or terrain roughness, for which I need for 
example a 5x5 kernel around my pixel, so a heightmap lookup would be the 
easiest..

It seams that there is no way to extract that information just form the vertex 
data (because the vertex shader only processes one vertex at a time).

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43894#43894





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [vpb] Terrain Height as Texture

2011-11-15 Thread Jean-Sébastien Guay

Hi Jonathan,


It seams that there is no way to extract that information just form the vertex 
data (because the vertex shader only processes one vertex at a time).


Yes, sounds like what you need is more than what I thought you needed :-)

I don't think VPB supports that out of the box, but others may correct 
me, I have not used VPB that much. But you can surely load the height 
map from a texture. Then it comes down to knowing what texture 
coordinates in the height map correspond to each vertex / pixel, I guess 
you'd have to modify VPB to pass this as vertex attribute data or 
something like that.


Hope this helps,

J-S
--
__
Jean-Sebastien Guayjean-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


[osg-users] [vpb] Terrain Height as Texture

2011-11-14 Thread Jonathan Klein
Hi,
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.
I could replace the colormap by the heightmapt before generation (at least i 
think so) but i also want to use some finished databases.


Thank you!

Cheers,
Jonathan

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43878#43878





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] [vpb] Terrain Height as Texture

2011-11-14 Thread Jean-Sébastien Guay

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 Guayjean-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