[osg-users] Dynamic terrains, DatabasePager + PagedLODs

Robert Osfield robert.osfield at gmail.com
Fri Nov 27 09:44:02 PST 2015


Hi Daniel,

The core OSG doesn't directly provide dynamic terrain modification, you can
potentially co-opt some of the features to do it but my inclination would
be to come up with a custom scheme for your specific needs.

The approach I'd be inclined to take would be to use a displacement map
approach where you share osg::geometry that represent fixed size tiles and
have these dispaced to the final positions by have a vertex shader read a
texture that represent the height field of the tile.  You can dynamic
modify the texture and have this subloading on the fly with very low cost -
you are only updating the height field, the rest of the geometry remains
static.  This approach would allow you to render very large terrains, have
dynamic modification and run them a solid 60Hz.

The OSG-3.4 release includes an osgTerrain::DisplacementMappingTechnique
that implements static geometry sharing and provision of the height field
via textures, with shaders doing the displacement mapping and normal
computation all for you.  Potentially you might be able to reuse this by
modifying the osgTerrain::HeightFieldLayer at runtime,  There is a dirty()
method on it by I don't recall if I've wired up the backend to update the
textures, it was written for static meshes, but it might well do what you
need already so certainly worth looking at.

Robert.



Robert.

On 27 November 2015 at 14:29, Daniel Lazaroff <lazaroff_daniel at yahoo.ca>
wrote:

> Greetings,
>
> I am looking for suggestions from anyone that might have worked on dynamic
> terrains (with OSG).
>
> We currently are in need of having a very large renderable terrain that
> can be modified (locally,with respect to the viewpoint) in real time (for
> digging holes).
> I have started to look into using the osgDB::DatabasePager and the
> osg::PagedLODs. The initial results I have so far a quite interesting. I
> created a large triangle mesh (on a square surface) with multiple levels of
> details LOD of this mesh (OpenFlight format).
> I repeated this pattern across over the simulated large flat terrain and
> was able to appreciate the huge difference the multi-threading used from
> DatabasePager + PagedLOD (which I was able to generate with the
> osgpagedlod.cpp example) made compared to only using the main thread with
> LODs.
>
> I am now at the stage of experimenting on how to modify the vertex arrays
> (starting at the highest resolution level mesh) in the PLOD and being
> able to save these modifications back to disk when the PLOD has expired. I
> am not sure if the DatabasePager can handle this somehow ? (or is it
> completely impossible)
>
> Perhaps this has already been addressed in the forum. Thanks for any links
> or advice about this matter.
>
> Daniel
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=65775#65775
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151127/57ea591c/attachment-0003.htm>


More information about the osg-users mailing list