Hi Chuck,

osgSim:HeightAboveTerrain or osgSim:ElevationSlice might be of
interest, the later is the one I'd use as it give you the whole data.
But... both of these query for the heights res tiles, which won't be
aligned to the terrain at all LOD levels soo... it won't actually work
that well for a general runtime database.

As for the specifics of what its not working with a TXP database I
can't say - the osgSim classes as explicitly designed to handle paged
database so in theory should work just fine.  Perhaps the fact that
the TXP plugin does some funky management of PagedLOD levels to try
and restrict how far apart adjacent tiles can be in LOD level is the
cause.  One would need to go through with a debugger to be sure.

Either way if you want a visual grid on your paged terrain I don't
think computing intersections and generating polygons will cut it due
to the nature of elevation changes as LOD levels pop in.  The best
approach you could try would be to compute the intersections on the
fly as tiles a loaded in via a custom Registry::ReadCallback - this
would use the PlaneIntersector to get the intersections with each new
loaded subgraph.

However, the approach I'd use would be a custom shader that computes
the position in space of each fragment on the terrain and decides to
render different colours depending in the fragment was closest enough
to a grid interval or not.  Such a shader would work with any type of
terrain and would be pretty light weight.

Robert.



On Thu, Mar 6, 2008 at 5:50 PM, Cole, Charles E. (LARC-B702)[GENEX
SYSTEMS] <[EMAIL PROTECTED]> wrote:
> I'm trying to use the osgSim::HeightAboveTerrain class to compute
>  terrain heights at various points within a TXP database.  The intent is
>  to get an array of Vec3d's such that I can create a grid pattern using
>  osg::Geometry that (coarsely) represents the database (I tried the
>  OverlayNode and other examples, but the textures just didn't work for
>  me).
>
>  In my code, I basically create a osgSim::HeightAboveTerrain object, then
>  loop through various points laterally offset from the terrain's center
>  point (as determined by the bounding sphere).  With each point, I call
>  the 'computeHeightAboveTerrain' method using the terrain node (read in
>  using osgDB::readNodeFile) and the computed point to get the height
>  above the terrain.  Unfortunately, all of the calls return the same
>  height.  The terrain is of a mountainous region, so the actual terrain
>  height varies considerably from point to point.
>
>  As a check, I ran the osgintersection example using the TXP database.
>  For this example, it also returns a constant height (and the same height
>  that I receive in my code).
>
>  Any suggestions on why a constant height is returned?  Are there steps
>  that I'm missing?  I searched the mailing list archives and couldn't
>  find any discussions related to my problem.  BTW, The TXP database is a
>  paged LOD database with a Z-up orientation.
>
>  TIA.
>
>  chuck
>
>  _______________________________________________
>  osg-users mailing list
>  osg-users@lists.openscenegraph.org
>  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to