[osg-users] Draw Instanced intersections

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Tue Jan 3 03:37:15 PST 2017


Hi Bruno,

There is simply no geometry in the scenegraph to intersect (or strictly 
speaking there is only one drawable)

Instancing takes away the load from the CPU to the GPU,which on the 
OSG-side means to put the instanced geometries into one drawable 
containing the instancing information.

You could use two scenes representing the rendered scene using the 
instances and another using  multiple drawables for intersection 
determination. If it is rather static, KD-Trees will help with 
performance on the intersection-set.


Apart from this, you could overwrite the intersections of DrawArrays 
with some method that takes instances into account, but that might get 
tricky as there are many different ways to realize instancing. I'd go 
with two scenes, using different node-masks for the intersection and the 
"draw"-scene, as it is the easiest approach.

Cheers
Sebastian



> Hi, Oliveira,
>
> there maybe many reasons that why no intersection. I cannot give you
> advise without more information. u can check about examples within OSG
> source code, e.g. "osgintersection".
>
> --
> Cheers,
> ---
> TianZJ
>
>
>
>
> At 2017-01-03 17:55:02, "Bruno Oliveira"
> <bruno.manata.oliveira at gmail.com
> <mailto:bruno.manata.oliveira at gmail.com>> wrote:
>
>     Hi TianZJ, Thanks for the quick answer.
>
>     I checked the intersector, but intersector->getIntersections()
>     returns no intersections at all.
>
>
>
>     2017-01-03 9:32 GMT+00:00 tianzjyh <tianzjyh at 126.com
>     <mailto:tianzjyh at 126.com>>:
>
>         Hi, Oliveira,
>             You can check the intersections of your intersector(e.g.
>         LineSegmentIntersector::Intersection), and you will find they
>         contain an "osg::NodePath", which means the whole path of the
>         node(e.g. matrix transform nodes upon the drawable instance).
>
>
>         --
>
>
>         Cheers,
>         ---
>         TianZJ
>
>         At 2017-01-03 16:58:16, "Bruno Oliveira"
>         <bruno.manata.oliveira at gmail.com
>         <mailto:bruno.manata.oliveira at gmail.com>> wrote:
>
>             Hello,
>
>             I'm implementing a draw instanced optimized scene. This is
>             for drawing a set of polygons.
>
>             Previously I was creating a drawable for each polygon, but
>             now I am using draw instancing. With one drawable per
>             polygon I can easily use osg intersectors for computing
>             scene intersections. But how can I perform scene
>             intersections with draw instanced objects and get, for
>             instance, intersected instance IDs?
>
>
>
>
>
>
>         _______________________________________________
>         osg-users mailing list
>         osg-users at lists.openscenegraph.org
>         <mailto:osg-users at lists.openscenegraph.org>
>         http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>         <http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org>
>
>
>
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list