Re: [osg-users] How to check if pagedLod already exists in databasepager with same filename
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 > > , 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 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to check if pagedLod already exists in databasepager with same filename
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 (< simone.rappose...@gmail.com>) 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 , 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 > > > > -- > > Post generated by Mail2Forum > > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=69530#69530 > > > > > > ___ > 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
Re: [osg-users] How to check if pagedLod already exists in databasepager with same filename
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 , 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 > > -- > Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69530#69530 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to check if pagedLod already exists in databasepager with same filename
Hi Laurence, thank you, if you mean somthing like options->setObjectCacheHint(osgDB::Options::CACHE_NODES), I have just tried with no luck... Voerman, L. wrote: > would that not just replicate the osg filecache? readNode should just return > the pointer to the data with readResult FILE_LOADED_FROM_CACHEregards, > Laurens. > > > On Tue, Nov 29, 2016 at 1:56 PM, Trajce Nikolov NICK < ()> wrote: > > > Hi Simone, > > > > just a fast thought ... Maybe you make a simple std::map to keep track of > > what has been loaded and what is new > > > > > > On Tue, Nov 29, 2016 at 1:37 PM, Simone Rapposelli < ()> wrote: > > > > > Hi Robert, > > > > > > thank you for your fast reply. > > > My problem is that osgDB::ReaderWriter::ReadResult readNode(const > > > std::string , 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. > > > > > > Thank you! > > > > > > Cheers, > > > Simone > > > > > > -- > > > Read this topic online here: > > > http://forum.openscenegraph.org/viewtopic.php?p=69524#69524 > > > (http://forum.openscenegraph.org/viewtopic.php?p=69524#69524) > > > > > > > > > > > > > > > > > > ___ > > > osg-users mailing list > > > () > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > > > > > > > > > > > > > > > > > -- > > trajce nikolov nick > > > > > > > > ___ > > 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=69529#69529 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to check if pagedLod already exists in databasepager with same filename
Hi Trajce, thank you, but the problem is that even if I can keep track of new PagedLods, it is not sufficient because DatabasePager unloads no more used PagedLods and there is no way (or at least I don't know how) to know which they are. Trajce Nikolov NICK wrote: > Hi Simone, > > just a fast thought ... Maybe you make a simple std::map to keep track of > what has been loaded and what is new > > > On Tue, Nov 29, 2016 at 1:37 PM, Simone Rapposelli < ()> wrote: > > > Hi Robert, > > > > thank you for your fast reply. > > My problem is that osgDB::ReaderWriter::ReadResult readNode(const > > std::string , 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. > > > > Thank you! > > > > Cheers, > > Simone > > > > -- > > Read this topic online here: > > http://forum.openscenegraph.org/viewtopic.php?p=69524#69524 > > (http://forum.openscenegraph.org/viewtopic.php?p=69524#69524) > > > > > > > > > > > > ___ > > osg-users mailing list > > () > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > > > > > -- > trajce nikolov nick > > -- > Post generated by Mail2Forum -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69528#69528 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to check if pagedLod already exists in databasepager with same filename
Hi Simone, On 29 November 2016 at 12:37, Simone Rapposelliwrote: > thank you for your fast reply. > My problem is that osgDB::ReaderWriter::ReadResult readNode(const std::string > , 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 osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to check if pagedLod already exists in databasepager with same filename
would that not just replicate the osg filecache? readNode should just return the pointer to the data with readResult FILE_LOADED_FROM_CACHE regards, Laurens. On Tue, Nov 29, 2016 at 1:56 PM, Trajce Nikolov NICK < trajce.nikolov.n...@gmail.com> wrote: > Hi Simone, > > just a fast thought ... Maybe you make a simple std::map to keep track of > what has been loaded and what is new > > On Tue, Nov 29, 2016 at 1:37 PM, Simone Rapposelli < > simone.rappose...@gmail.com> wrote: > >> Hi Robert, >> >> thank you for your fast reply. >> My problem is that osgDB::ReaderWriter::ReadResult readNode(const >> std::string , 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. >> >> Thank you! >> >> Cheers, >> Simone >> >> -- >> Read this topic online here: >> http://forum.openscenegraph.org/viewtopic.php?p=69524#69524 >> >> >> >> >> >> ___ >> osg-users mailing list >> osg-users@lists.openscenegraph.org >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> > > > > -- > trajce nikolov nick > > ___ > 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
Re: [osg-users] How to check if pagedLod already exists in databasepager with same filename
Hi Simone, just a fast thought ... Maybe you make a simple std::map to keep track of what has been loaded and what is new On Tue, Nov 29, 2016 at 1:37 PM, Simone Rapposelli < simone.rappose...@gmail.com> wrote: > Hi Robert, > > thank you for your fast reply. > My problem is that osgDB::ReaderWriter::ReadResult readNode(const > std::string , 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. > > Thank you! > > Cheers, > Simone > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=69524#69524 > > > > > > ___ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to check if pagedLod already exists in databasepager with same filename
Hi Robert, thank you for your fast reply. My problem is that osgDB::ReaderWriter::ReadResult readNode(const std::string , 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. Thank you! Cheers, Simone -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69524#69524 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to check if pagedLod already exists in databasepager with same filename
Hi Simone, I'm a bit confused by your question, it suspect you are trying to solve an already solved problem and in an awkward way. The ReadResult only holds the loaded subgraph for a very short period of time, it just used for passing a reference to a loaded object/scene graph back to the the code that invoked the read operation. I can't see much sense in looking at it. The osgDB::Registry has a ReadFileCallback that can be used to override the read implementation, allowing a user to implement custom behaviours. This has is used for a wide range of tasks. Have a look through the mailing list/forum archives on this topic to see how others have used it and what for. As I'm not clear on what problem you are actually trying to sovle I really can't say if this is required though. PagedLOD's themselves are meant to be loaded and unloaded to balance the load on the system, so that graphics memory and main memory don't get overloaded, and that the cull. draw dispatch and draw GPU traversals don't get overloaded. PagedLOD itself knows when it's subgraph has been loaded or not, so there is no need to intervene, you just build your paged database and the OSG will automatically do the rest for you. Given all this I just can't work out why you'd need to check to see if a PagedLOD subgraph has been loaded or not. Could it be that you are just assuming you'd need to do this manually when in fact there is absolutely no need to do so as PagedLOD/DatabasePager are built from the ground up to manage paged databases correctly with no redundant loads. Robert. On 29 November 2016 at 10:16, Simone Rapposelliwrote: > Hi, > > I need to check if a pagedLod with a given fileName has been already loaded > in the databasepager, in order to avoid to read it again from file. > My ideal sollution would be to access to the current pagedLod list from > inside the osgDB::ReaderWriter::ReadResult readNode(const std::string > , const osgDB::ReaderWriter::Options *options) const, but I can't > understand if is possible and in case how. > > Thank you! > > Cheers, > Simone > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=69522#69522 > > > > > > ___ > 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
[osg-users] How to check if pagedLod already exists in databasepager with same filename
Hi, I need to check if a pagedLod with a given fileName has been already loaded in the databasepager, in order to avoid to read it again from file. My ideal sollution would be to access to the current pagedLod list from inside the osgDB::ReaderWriter::ReadResult readNode(const std::string , const osgDB::ReaderWriter::Options *options) const, but I can't understand if is possible and in case how. Thank you! Cheers, Simone -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69522#69522 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org