[osg-users] Height fields implementation

Chris 'Xenon' Hanson xenon at alphapixel.com
Mon Nov 23 13:03:53 PST 2009

Janna Terde wrote:
> When I use  osg::Terrain::TerrainTile/HeightFieldLayer regardless of X/Y intervals I set while creation of the HeightField I always get the same result (as if I set X/Y to 1). When I used only HeightFields+ShapeDrawable it worked fine. I am wondering if something like this happened to anyone or maybe I have some bug. 

  This may have something to do with the way TerrainTile normally uses a Locator object to
position it and scale it into the real 3D world. This is something done for you by
VirtualPlanetBuilder/osgDEM. I've never done it by hand.

> I also noticed that when I use osg::Terrain::TerrainTile/HeightFieldLayer  the loading time increases significantly (for 2000 by 2000  I get 70 seconds). 

  This could also be a result of some misconfiguration. Try building the tile database
with VPB/osgDEM. I know this route works.

> What I am trying to make now is functionality for selecting a vertex (or several vertices around it) and modifying its height. Before I was using HeightField::setHeight and then calling dirtyDisplayList for the ShapeDrawable.
> Can anyone suggest what is the right way to do the same using osg::Terrain::TerrainTile/HeightFieldLayer? I am trying to access a HeightField and then setHeight() but I am not sure if this is the correct way and if I need to update my scene somehow. 

  I think you can modify the HeightField and then just dirty() it.

> Cheers,
> Janna

Chris 'Xenon' Hanson, omo sanza lettere                  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
"There is no Truth. There is only Perception. To Perceive is to Exist." - Xen

More information about the osg-users mailing list