devdept

01-11-2010, 01:06 PM

Hi All,

We have just improved our selection algorithm.

Before we did:

1) project all the triangles on screen

2) check for pickbox intersection with 2D triangles and for mutual vertex inside (pickbox vertex inside the triangle and triangle vertex inside the pickbox)

The limitation:

In perspective mode, triangles with a vertex behind the viewer got weird 2D coordinates invalidanting the complete selection operation.

New algorithm:

1) Get a 3D frustum composed by 6 planes

2) Check first if the object bounding sphere intersects the frustum

3) In case of intersection, loop over object's triangles to check if the triangles sides cross the frustum

4) If no intersection is found, check for ray-triangle intersection for all 4 frustum sides (near to far)

The problem:

Speed. The new algorithm is accurate but slow. Intersection checks for triangles sides and furstum planes and ray-triangle intersections are slow processing a mesh of 50.000 triangles.

Is there any way to speed up the new algorithm?

Thanks,

Alberto

We have just improved our selection algorithm.

Before we did:

1) project all the triangles on screen

2) check for pickbox intersection with 2D triangles and for mutual vertex inside (pickbox vertex inside the triangle and triangle vertex inside the pickbox)

The limitation:

In perspective mode, triangles with a vertex behind the viewer got weird 2D coordinates invalidanting the complete selection operation.

New algorithm:

1) Get a 3D frustum composed by 6 planes

2) Check first if the object bounding sphere intersects the frustum

3) In case of intersection, loop over object's triangles to check if the triangles sides cross the frustum

4) If no intersection is found, check for ray-triangle intersection for all 4 frustum sides (near to far)

The problem:

Speed. The new algorithm is accurate but slow. Intersection checks for triangles sides and furstum planes and ray-triangle intersections are slow processing a mesh of 50.000 triangles.

Is there any way to speed up the new algorithm?

Thanks,

Alberto