Hi Robert,

I could use the osgUtil::Intersector and create a relationship to the
texture (that contains the positions of the trees) and do some kind of
lookup. This would give me a rough estimation if there is a intersection. If
I want to test between two branches on the same tree then there should be no
intersection with that tree but with whatever is behind it. The camera
method solves this problem.

I have attached an image to clarify how the trees are rendered.. They are
quads with images of the trees and we need to intersect with the tree and
not the quad.

regards,
Peter

On Tue, Jun 22, 2010 at 10:34 AM, Robert Osfield
<robert.osfi...@gmail.com>wrote:

> Hi Peter,
>
> I would use a custom osgUtil::Intersector/IntersectionVisitor  that
> knows about your custom use of osg::Geometry and do all the work on
> the CPU.  Using the GPU for intersections requires a round trip to the
> GPU which is very expensive which will totally dominate the actual
> cost of the intersection.
>
> Robert.
>
> On Tue, Jun 22, 2010 at 8:30 AM, Peter Wraae Marino
> <marino.pe...@gmail.com> wrote:
> > Hi osgUsers,
> > We have created huge forests using shapefiles to preprocess textures with
> > positions where trees should be located.
> > Then we instance all the trees using a shader, this works very well and
> we
> > can have over 100000 trees without any
> > framerate drop.
> > Because all the trees are instanced on the GPU we have no way of using
> > intersection, because the geometry doesn't
> > really exist. To solve this problem we decided to use a camera as a form
> of
> > intersection. By setting the camera at a
> > certain location and pointing it in the direction you want to intersect
> we
> > render the scene, but instead of rendering an
> > image of the scene we use a shader to save the positions for everything
> > rendered, then we do a simple inverse view matrix
> > on the position in the texture (center position) and we have a collision
> > hitpoint in world coordinates. This works very well
> > too, but but but.... because the camera is in it's own thread
> > (multithreading) we are always a frame or two out of sync. So
> > this is not a good solution for realtime :(  we could of course change to
> > single threaded,,.. by why?
> > Is there another method of intersecting with instanced geometry in the
> GPU?
> > any suggestions,
> > anyone,
> > regards,
> > Peter Wraae Marino
> >
> > --
> > Bellinge Gymnasterne: http://www.bellingegymnasterne.dk
> > Power Tumbling: http://www.powertumbling.dk
> > OSG-Help: http://osghelp.com
> > http://code.google.com/p/sigmaosg/
> > _______________________________________________
> > 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
>



-- 
Bellinge Gymnasterne: http://www.bellingegymnasterne.dk
Power Tumbling: http://www.powertumbling.dk
OSG-Help: http://osghelp.com

<<attachment: example_tree.jpg>>

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

Reply via email to