TriangleVertex() , 3rd var is in clockwise order?

Blitz3D Forums/Blitz3D Programming/TriangleVertex() , 3rd var is in clockwise order?

Braincell(Posted 2006) [#1]
TriangleVertex ( surface,triangle_index,corner )


corner - corner of triangle. Should be 0, 1 or 2.

Right, so 0,1,2 are in clockwise order? I mean, if you go o to 1 to 2, they are clokwise, right? Are they ALWAYS? Can someone verify this? Something weird is happening here and its slowing me down with developing the shadow system. Killing my brain. I have to ask, dont wanna do more tests.


Jams(Posted 2006) [#2]
anti-clockwise :)

or if you're american, counter-clockwise


Floyd(Posted 2006) [#3]
If you label the vertices 0,1,2 then these will appear in clockwise order from one side of the triangle. From the other side they appear counterclockwise.

The clockwise side is the front of the triangle, i.e. the side a camera can see.


Stevie G(Posted 2006) [#4]
In terms of backface culling, if the poly is descibed in an anti-clockwise fashion then a dot product < 0 should result in it being culled.

[EDIT] As per Floyd ...

Stevie


DJWoodgate(Posted 2006) [#5]
I have emailed you some info from a book I have. Hopefully it will help.


Braincell(Posted 2006) [#6]
Heh i understand that a camera sees triangles from the clockwise side, and i know ALLLL about culling :P

But i dont know what Mark Sibly wrote in that function. However, it does seem that they're all read in an anti-clockwise fashion (WEIRRRD). Problem solved by other means, anyhow, thanks a lot for your advice.

@Floyd, yeah thats right. I was just unsure how the function read it, i know how the camera sees it, but the function seems to read it the other way around going from 0 to 1 to 2...

DJ, i'll have a look, cheers.

Marching on...


t3K|Mac(Posted 2006) [#7]
still waiting for your shadow system ;) this will improve my game a lot!