[osg-users] Best practices for dealing with complex scene graph

OpenSceneGraph Users osg-users at lists.openscenegraph.org
Sun Mar 1 21:25:46 PST 2020


Hi Armin,
Essentially the scene graph is a one-for-one representation of my DOM. Each 
individual object can be edited, or its attributes changed. 
The DOM can be a small number of geometrically "complex" objects  - this 
causes no performance problems as the geometry "leafs" are large 
geometrically, or the DOM might have a large number of simple objects.

A KD tree would be useful for removing "not visible" nodes, but in general 
they are all visible.

In "theory" the  whole scene graph geometry was flattened to one set of 
vertex, colors and normals for maximum efficiency - of course, updates to 
the scene graph would require this structure to be partially or fully 
rebuilt.

That's a bit of overkill for me, as I "know" the parent Group node in the 
scene graph that I want to make more efficient. Typically the objects under 
this node have the same attributes. 

I could flatten my nodes "manually", but flattening the scene graph seems a 
typical "use-case" that OSG users would want to do.

I have done some tests with osg::Optimizer with the MERGE_GEOMETRY option 
after collecting all the osg::Geometry nodes into a temporary group -  this 
does not do exactly what I want, as it only collects the 
osg::PrimitiveSets. Not merging the sets themselves.
Weirdly calling "optimize" also causes my scene graph to stop drawing for 
some unknown and very frustrating reason.

There is a lot of code in the OSG GLES plugin code that looks promising, 
but it's quite undocumented and I am having to guess about it's 
functionality.


Andrew

On Sunday, March 1, 2020 at 6:14:07 PM UTC-8, Armin Samii wrote:
>
> Iterating over the 5000 children would be pretty slow - what if you could 
> discard some of these children without even looking at them? A hierarchy of 
> sorts, where you can ignore large swaths of those children, would help...
> Consider, for example, using a k-d tree: 
> http://www.openscenegraph.org/index.php/documentation/user-guides/107-kdtrees
>
> Or you can do this on your own, if you like, by grouping nearby nodes into 
> their own osg::Group. Depends what your underlying data looks like.
>
>
>
> I would not recommend combining the geometry into a single drawable unless 
> you expect all of them to be visible at once, and that each piece of 
> geometry is fairly small.
>
> On Sun, Mar 1, 2020 at 9:07 AM AndrewC <ad... at a-cunningham.com 
> <javascript:>> wrote:
>
>> Hi,
>> I was wondering what the best practices are for dealing with a complex 
>> scene graph where a single osg::Group might have , say, 5000 children where 
>> each child is fairly simple osg::Geom geometry. Clearly, this is 
>> inefficient and draws slowly.
>> So obviously, compiling/collecting the geometry into one drawable would 
>> be much more efficient. osgUtil::Optimizer does not seem to do this for me, 
>> or am I missing something?
>>
>> Andrew
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "OpenSceneGraph Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to osg-... at googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/osg-users/19df5325-01d5-4fa7-94d2-9c9560c92956%40googlegroups.com 
>> <https://groups.google.com/d/msgid/osg-users/19df5325-01d5-4fa7-94d2-9c9560c92956%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
>
> Armin Samii
>
> Visualization Software Engineer, Argo AI <http://argo.ai/>
> CONFIDENTIALITY NOTICE: This e-mail and any files transmitted with it are 
> confidential and designated solely for use of the individual(s) or entity 
> to whom they are addressed. If you are not the named addressee, you are 
> notified that disseminating, copying, disclosing or taking any action in 
> reliance on its contents is strictly prohibited and could subject you to 
> legal action by the sender. Please notify the sender immediately if you 
> have received this e-mail in error and delete it from your system. Thanks 
> for your cooperation.
>

-- 
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/a98e70fb-9a0b-4925-a526-1371d294b5af%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20200301/c2ffa651/attachment.html>


More information about the osg-users mailing list