<div dir="ltr"><div><div><div>Hi Daniel,<br><br></div>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.<br><br></div>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.<br><br></div><div>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.<br><br></div><div>Robert.<br></div><div><br><br><br></div>Robert.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On 27 November 2015 at 14:29, Daniel Lazaroff <span dir="ltr"><<a href="mailto:lazaroff_daniel@yahoo.ca" target="_blank">lazaroff_daniel@yahoo.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Greetings,<br>
<br>
I am looking for suggestions from anyone that might have worked on dynamic terrains (with OSG).<br>
<br>
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).<br>
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).<br>
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.<br>
<br>
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<br>
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)<br>
<br>
Perhaps this has already been addressed in the forum. Thanks for any links or advice about this matter.<br>
<br>
Daniel<br>
<br>
------------------<br>
Read this topic online here:<br>
<a href="http://forum.openscenegraph.org/viewtopic.php?p=65775#65775" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=65775#65775</a><br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</blockquote></div><br></div>