[osg-users] osg::Billboard positions

16 views
Skip to first unread message

OpenSceneGraph Users

unread,
Feb 12, 2020, 9:35:34 AM2/12/20
to OpenSceneGraph Users
Hi,

I have an issue, might not be related to osg::Billboard it self.

At every frame, I delete all the drawables for a osg::Billboard: tags->removeDrawables(0, size);

and I add them again, possible with different values for position: tags->addDrawable(osg::Geometry, osg::Vec3(pos.x, pos.y, pos.z));

but in the view I still see the old positions of the tags!

Does OSG has some kind of cache? Do I have to invalidate something?

Greetings,
Catalin

OpenSceneGraph Users

unread,
Feb 13, 2020, 3:04:16 AM2/13/20
to OpenSceneGraph Users
HI Catalin,

I would recommend against deleting and recreating scene graphs on every frame, this will lead to poor performance.

If you have a really dynamic dataset then it may be appropriate to write a custom node for this, or use a shader.

In the case of shaders you can often replace billboards with a single geometry that get instanced and have the
 vertex shader use the index id as a look up into a uniform array that contains the offsets, or any scales you want.
To change the positions you just update the uniform, to change number you just change the number of instances.

Robert.

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Catalin

unread,
Feb 13, 2020, 6:52:13 AM2/13/20
to osg-...@googlegroups.com
Hi Robert,

I fixed my issue by recreating the osg::Billboard, instead of re-adding all the drawables to the billboard.

1) tags = new osg::Billboard;

// add all the billboards
2) tags->addDrawable(osg::Geometry, osg::Vec3(pos.x, pos.y, pos.z));

3) draw scene

I understand very well what you are saying, but I don't have time to understand and create a custom node right now.
We are not using Shaders, the number of tags is very dynamic, however is less than 100.

Thank you very much,
Catalin


--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/mailman.70438.1581581043.7167.osg-users-openscenegraph.org%40lists.openscenegraph.org.

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/mailman.70438.1581581043.7167.osg-users-openscenegraph.org%40lists.openscenegraph.org.
Reply all
Reply to author
Forward
0 new messages