Is using selection buffer for selection or picking slow?


I was wondering is using selection buffer slow and if so, what are the alternatives?

AFAIK nvidia cards switch to software mode when using these rendering modes. The fastes probably is that you do your own ray intersection test.

Hi Michael,

The people always said that the best mode is the ray intersection, but I always asked how to do this, and they never answered, could you explain me how to do this ?



Well i think I agree with kurt, can you explain a bit?

Let a line and a plane intersect.
There are different attempts doing that.

Here’s one way (dunno):

int LinePlaneIntersect( CVector& a, CVector& b, CPlane& plane, CVector& result )
double quot, t;

t = (;
quot = b

if( DOUBLE_EQ( quot, 0.0 ) ) {
quotient is zero!");
if( DOUBLE_EQ( t, 0.0 ) ) return LPI_INSIDE;
else return LPI_PARALLEL;

printf( "
t is %f", t );

t = t/quot;

result = a+b*t;

return LPI_CUT;

On the other hand you’d have to test wether the intersection lies on the poly. Either test wether the line lies inside the convex hull of the pyramid built from a point on the line and the polygon edges, or use a different approach.

The plane:
vx = va + rvb + tvc

where va is a vector to a point on the plane (it’s place vector), vb and vc are the span-vectors which actually build the plane.

The line:

vx = vd + u*ve

Now say

vd + uve = va + rvb + t*vc

and solve the resulting equation system.

if r+t <= 1 and both are positive you’ve got an intersection inside the triangle with the egdes vb, vc and vc-vb displaced about va. Well you probably know what I mean.

[This message has been edited by Michael Steinberg (edited 04-11-2001).]

Thnx man