[osg-users] How to check if pagedLod already exists in databasepager with same filename

Simone Rapposelli simone.rapposelli at gmail.com
Wed Nov 30 03:32:50 PST 2016


Hi Rafa,

thank you for your advice, but trying to replace PagedLod with ProxyNode seems that readNode get called also for nodes apparently very far.
I don't know why this happens, maybe there is some mechanism I am misunderstanding or missing, but I haven't found any example with ProxyNodes and I can't go beyond for time reasons.
At any rate, at the moment the current solution with PagedLods is more than acceptable for me.
Thank you all for your precious support!


Rafa Gaitan wrote:
> Hi Simone,
> 
> If you just want to use the PagedLOD as a kind of delayed system for loading nodes (but not unload them from memory), I suggest you use instead de osg::ProxyNode, it defers the loading to the DatabasePager but once loaded is not unloaded anymore. If your database is well balanced the CullVisitor will ensure good framerate when the node is not in the frustrum.
> 
> 
> Just my two cents,
> 
> 
> Rafa.
> 
> 
> 
> 
> El mar., 29 nov. 2016 a las 15:43, Simone Rapposelli (< ()>) escribió:
> 
> 
> > Hi Robert,  by increasing TargetMaximumNumberOfPageLOD the problem of having to reload the same PageLod disappears, so it works!! Thank you!   robertosfield wrote: > Hi Simone, > > On 29 November 2016 at 12:37, Simone Rapposelli > <> wrote: > > > thank you for your fast reply. > > My problem is that osgDB::ReaderWriter::ReadResult readNode(const std::string &fileName, const osgDB::ReaderWriter::Options *options) gets called even if a PagedLod with the same fileName has been previously loaded: for example, this happens if I move to any position on the viewer and then come back. > > Thus, inside this function I need to check if any of the PagedLod currently loaded in DatabasePager has the same fileName of the passed argument: in this case I could avoid to reload data already in memory. > > > > The PagedLOD/DatabasePager paging scheme is designed to expire and > reload subgraphs, it *crucial* to load balancing.  If you cached all > loaded subgraphs your memory would rapidly
  be overwhelmed and your > system would grind to a halt.  The very scheme you are trying to > defeat is one of the best assets of the OSG, you *absolutely* do not > want to be breaking this mechanism. > > Now, if you the defaults the paging scheme uses for load balancing is > too conservative w.r.t the number of PagedLOD it will aim for in > memory at one time you can adjust it to be higher simply by setting > the TargetMaximumNumberOfPageLOD parameter, from the DatabasePager > header you'll see: > > /** Set the target maximum number of PagedLOD to maintain in memory. > * Note, if more than the target number are required for > rendering of a frame then these active PagedLOD are excempt from being > expiried. > * But once the number of active drops back below the target > the inactive PagedLOD will be trimmed back to the target number.*/ > void setTargetMaximumNumberOfPageLOD(unsigned int target) { > _targetMaximumNumberOfPageLOD = target; } > > You can also set the default 
 value using the env var OSG_MAX_PAGEDLOD > i,e under bash: > > export OSG_MAX_PAGEDLOD=2000 > osgviewer mypageddatabase.osgb > > You can get a listing of the env vars supported by doing: > > osgviewer --help-env > > Robert. > _______________________________________________ > osg-users mailing list > >  () http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) 
> 
> 
>  ------------------
> Post generated by Mail2Forum


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








More information about the osg-users mailing list