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 <[email protected]> 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 > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

