Shadow volume

Blitz3D Forums/Blitz3D Programming/Shadow volume

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

Another tip:

When you are building the mesh edges, do NOT look for triangles that share vertices. You may have two different vertices in the same position, because of normals or texture mapping. Instead, look for triangles that share vertices that have an identical position. Compare the absolute value of the difference between each component of the vertex positions, and consider them the same if they less than a very small precision value, like 0.001:

Function VerticesMatch(surf,a,b)
If Abs(VertexX(surf,a)-VertexX(surf,b))<0.001
If Abs(VertexY(surf,a)-VertexY(surf,b))<0.001
If Abs(VertexZ(surf,a)-VertexZ(surf,b))<0.001
Return True
Endif
Endif
Endif
End Function