Discussion:
[osg-users] Culling and instanced drawing
Werner Modenbach
2018-07-13 16:44:31 UTC
Permalink
Hi all,

maybe someone has some inspiration for me.
I have a scene graph where the same object (plenty of vertices) is drawn
in many instances.
Each instance gets an offset matrix to move the object to some place.
If I do the rendering without instances the culling removes those
objects from the draw list that are not visible.
Is there any way to implement such culling also with instances?
I think I need to remove the invisible matrices from the list and reduce
the number of instances somehow.

Any idea where to do it?

Thanks

- Werner -
Robert Osfield
2018-07-13 16:51:59 UTC
Permalink
Hi Werner,

The best way to handle the vertex shader moving geometry to new
locations is to use a custom osg::DrawableComputeBoundingBoxCallback
that you assign the the drawable that you are using for instancing.
You'll want to return a BoundingBox that encompasses all the positions
that the transformed geometries can occupy.

Robert.
On Fri, 13 Jul 2018 at 17:44, Werner Modenbach
Post by Werner Modenbach
Hi all,
maybe someone has some inspiration for me.
I have a scene graph where the same object (plenty of vertices) is drawn
in many instances.
Each instance gets an offset matrix to move the object to some place.
If I do the rendering without instances the culling removes those
objects from the draw list that are not visible.
Is there any way to implement such culling also with instances?
I think I need to remove the invisible matrices from the list and reduce
the number of instances somehow.
Any idea where to do it?
Thanks
- Werner -
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Werner Modenbach
2018-07-13 17:32:16 UTC
Permalink
Hi Robert,

that is exactly what we have done. It is necessary i.e. for the
automatic compution of zNear/zFar.
My problem is the culling - the collection of visible objects.
If I zoom in very close I get a high level of details. But the shaders
have to do this expensive computaion for all instances,
even if only one is visible.
The only solution I see is "removing those instances not visible".
Instancing reduces time for draw traversal significantly!

Thanks

- Werner -
Post by Robert Osfield
Hi Werner,
The best way to handle the vertex shader moving geometry to new
locations is to use a custom osg::DrawableComputeBoundingBoxCallback
that you assign the the drawable that you are using for instancing.
You'll want to return a BoundingBox that encompasses all the positions
that the transformed geometries can occupy.
Robert.
On Fri, 13 Jul 2018 at 17:44, Werner Modenbach
Post by Werner Modenbach
Hi all,
maybe someone has some inspiration for me.
I have a scene graph where the same object (plenty of vertices) is drawn
in many instances.
Each instance gets an offset matrix to move the object to some place.
If I do the rendering without instances the culling removes those
objects from the draw list that are not visible.
Is there any way to implement such culling also with instances?
I think I need to remove the invisible matrices from the list and reduce
the number of instances somehow.
Any idea where to do it?
Thanks
- Werner -
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Werner Modenbach
2018-07-13 17:46:10 UTC
Permalink
B.T.W. Is there any way of doing the culling in Tesselation- or
Geometry-Shader?
In this case I need to know if the vertices are visible or not.
Post by Robert Osfield
Hi Werner,
The best way to handle the vertex shader moving geometry to new
locations is to use a custom osg::DrawableComputeBoundingBoxCallback
that you assign the the drawable that you are using for instancing.
You'll want to return a BoundingBox that encompasses all the positions
that the transformed geometries can occupy.
Robert.
On Fri, 13 Jul 2018 at 17:44, Werner Modenbach
Post by Werner Modenbach
Hi all,
maybe someone has some inspiration for me.
I have a scene graph where the same object (plenty of vertices) is drawn
in many instances.
Each instance gets an offset matrix to move the object to some place.
If I do the rendering without instances the culling removes those
objects from the draw list that are not visible.
Is there any way to implement such culling also with instances?
I think I need to remove the invisible matrices from the list and reduce
the number of instances somehow.
Any idea where to do it?
Thanks
- Werner -
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Julien Valentin
2018-07-13 19:27:30 UTC
Permalink
Indeed...
Post by Werner Modenbach
B.T.W. Is there any way of doing the culling in Tesselation- or
Geometry-Shader?
In this case I need to know if the vertices are visible or not.
Post by Robert Osfield
Hi Werner,
The best way to handle the vertex shader moving geometry to new
locations is to use a custom osg::DrawableComputeBoundingBoxCallback
that you assign the the drawable that you are using for instancing.
You'll want to return a BoundingBox that encompasses all the positions
that the transformed geometries can occupy.
Robert.
On Fri, 13 Jul 2018 at 17:44, Werner Modenbach
Post by Werner Modenbach
Hi all,
maybe someone has some inspiration for me.
I have a scene graph where the same object (plenty of vertices) is drawn
in many instances.
Each instance gets an offset matrix to move the object to some place.
If I do the rendering without instances the culling removes those
objects from the draw list that are not visible.
Is there any way to implement such culling also with instances?
I think I need to remove the invisible matrices from the list and reduce
the number of instances somehow.
Any idea where to do it?
Thanks
- Werner -
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
------------------
Post generated by Mail2Forum
------------------------
Twirling twirling twirling toward freedom

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74342#74342
W***@texion.eu
2018-07-13 19:30:21 UTC
Permalink
Thanks. Any suggestion how to know this?
Post by Julien Valentin
Indeed...
Post by Werner Modenbach
B.T.W. Is there any way of doing the culling in Tesselation- or
Geometry-Shader?
In this case I need to know if the vertices are visible or not.
Post by Robert Osfield
Hi Werner,
The best way to handle the vertex shader moving geometry to new
locations is to use a custom
osg::DrawableComputeBoundingBoxCallback
Post by Werner Modenbach
Post by Robert Osfield
that you assign the the drawable that you are using for instancing.
You'll want to return a BoundingBox that encompasses all the
positions
Post by Werner Modenbach
Post by Robert Osfield
that the transformed geometries can occupy.
Robert.
On Fri, 13 Jul 2018 at 17:44, Werner Modenbach
Post by Werner Modenbach
Hi all,
maybe someone has some inspiration for me.
I have a scene graph where the same object (plenty of vertices)
is drawn
Post by Werner Modenbach
Post by Robert Osfield
Post by Werner Modenbach
in many instances.
Each instance gets an offset matrix to move the object to some
place.
Post by Werner Modenbach
Post by Robert Osfield
Post by Werner Modenbach
If I do the rendering without instances the culling removes those
objects from the draw list that are not visible.
Is there any way to implement such culling also with instances?
I think I need to remove the invisible matrices from the list and
reduce
Post by Werner Modenbach
Post by Robert Osfield
Post by Werner Modenbach
the number of instances somehow.
Any idea where to do it?
Thanks
- Werner -
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Post by Werner Modenbach
Post by Robert Osfield
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Post by Werner Modenbach
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Post by Werner Modenbach
------------------
Post generated by Mail2Forum
------------------------
Twirling twirling twirling toward freedom
------------------
http://forum.openscenegraph.org/viewtopic.php?p=74342#74342
_______________________________________________
osg-users mailing list
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Robert Osfield
2018-07-14 05:04:06 UTC
Permalink
Post by W***@texion.eu
Thanks. Any suggestion how to know this?
Have a look at the osggoucull example.

Paweł KsięŌopolski
2018-07-13 21:14:35 UTC
Permalink
Hi wernerM

There's osggpucull example that performs GPU culling and results of
that culling are later rendered using instancing.
Culling in that example not only removes invisible objects, but also
calculates LODs ( if you have any ).

Example has two methods of rendering implemented : first one for typical
OSG tree, where objects are static, and the second one where objects
are moving but information about them is stored in a single input array.

Here is forum discussion about that example, where you can find more details :

http://forum.openscenegraph.org/viewtopic.php?t=13401

I am the author of this example, so if you need any help with it then just let me know.

Paweł Księżopolski

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74344#74344
Continue reading on narkive:
Loading...