Hi Peter,

I'd post process the intersections of the quads using the vertex
ratios from the intersections to compute the tex coords and then on to
a look up in the tree image.

Again I'd reinforce the importance of avoiding the round trip to the
graphics card, putting tests into the graphics FIFO and then waiting
for it to empty, for the graphics operations to be done on the GPU and
then to get the results back to the CPU will cause a stall of the CPU
and the GPU and lead to lower framerates.  I'd only advocate using the
GPU for tests if you are working in an interactive application - such
as CAD where low framerates are acceptable, for any real-time graphics
app using the GPU for compute of intersections will be a very poor
solution performance wise.

Robert.

On Tue, Jun 22, 2010 at 10:40 AM, Peter Wraae Marino
<[email protected]> wrote:
> 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 <[email protected]>
> 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
>> <[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
>
>
>
> --
> Bellinge Gymnasterne: http://www.bellingegymnasterne.dk
> Power Tumbling: http://www.powertumbling.dk
> OSG-Help: http://osghelp.com
>
> _______________________________________________
> 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

Reply via email to