Picking polygons

Blitz3D Forums/Blitz3D Programming/Picking polygons

_PJ_(Posted 2003) [#1]
Is it possible to Pick individual collections of triangles etc. instead of whole entities.

The effect I am trying to achieve is to have a mesh drawn in wireframe. When the mouse pointer moves over parts of the mesh, the faces (I am trying to avoid words like triangles, polygons, surfaces etc in case of confusion) of the mesh under the mouse pointer will be selected and rendered again separately in non-wireframe. In effect, it is like a 'Highlight' tool.


DJWoodgate(Posted 2003) [#2]
Pickedtriangle() will let you pick triangles so thats easy, just maintain a list of picked triangles for each surface (pickedsurface).

However to achieve your effect is going to be a bit more difficult. Maybe you could do somthing like this : Copy the original mesh to a new mesh (copymesh). Store all the triangle information for each surface. Pick from the old mesh. When the list of selected triangles changes: If unselecting triangles Clear the corresponding surface triangle information in the new mesh. Rebuild the surface triangle information with just the selected triangles. If adding to the selection just addtriangle. (This of course assumes that copymesh does not change the vertex order or surface order/composition, I have no idea, so you will have to reassure yourself on that point. If it does you have a bit of a problem. You can build a new mesh yourself, but the problem then becomes one of getting at surface properties :).

Now if you are drawing your own wireframe from the old mesh you can easily exclude the selected triangles. If you are using the cards built in wireframe then you might be able to achieve something similar by rendering again but not clearing the color or zbuffer using cameraclsmode camera false,false and scaling the new mesh up slightly to avoid zbuffer fighting. Thats if you don't want wireframe around the selected triangles, if you do then its easy in the first case, and in the second case try the reverse. Scale the old mesh up slightly and render this second with wireframe enabled as mentioned above. If you want to avoid scaling the mesh entities try scaling the camera slightly between renders.


abacadabad(Posted 2003) [#3]
Hi, how exactly does PickedTraingle work? There isnt a description in the help section.
Thanks :-)


_PJ_(Posted 2003) [#4]
Hmm I can see there is more to this than meets the eye. I thought it was quite ambitious at first.

I am thinking of alternatives, and considering perhaps moving the UV coords of a special texture to coincide with CameraProject coordinates etc.