Sign in to follow this  

Meshing strategies

This topic is 3745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm creating a circular mesh centred at the origin by generating the mesh for only one quadrant, as the other three quadrants are derived from the first (-x; -x,-z; -z.) I'm now having trouble with the triangles because two of the quadrants are getting culled from being back-facing. Turning off back-face culling is not an option, which leaves me with no alternative but to generate the triangles in a different way. In your opinion what would be the best way to overcome the following problem, ie: 1) In the first quadrant I generate the triangle {(0,0,0),(10,0,5),(10,0,0)} 2) Inverting the triangle horizontally gives {(0,0,0),(-10,0,5),(-10,0,0)} which is back-facing. Is there a mathematical, simple way to overcome this issue so that all triangles are front-facing or have I no choice but to write a specialized createTriangle function that does conditional checks on the 3pt coordinates passed in and correctly creates a front-facing triangle?

Share this post


Link to post
Share on other sites
Would it be possible to create the three extra quadrants by rotating the original, or do you have constraints on symmetry? Rotation within a plane is guaranteed to be direct, and so the resulting triangles will have the correct winding.

If this isn't an option, then the extra work for flipping the bad triangles isn't much. First, understand that there is no need to perform any calculations to determine the triangles' orientations - they can be easily deduced from the transformation used to create them:

A reflection is an indirect transformation. A consequence of this is that it will always flip the winding order. So, assuming that the first quadrant has all its triangles winding correctly, you need to flip exactly those triangles who have undergone an odd number of reflections. If you are doing things the easy way, this will mean that the two adjacent quadrants will need inversion, while the opposing quadrant will have taken care of itself (the two reflections will have 'cancelled out').

If you don't already know, you can switch the winding order of a triangle by simply swapping any pair of its vertices.

Admiral

Share this post


Link to post
Share on other sites
First off, many thanks for your reply!
Quote:
Original post by TheAdmiral
Would it be possible to create the three extra quadrants by rotating the original, or do you have constraints on symmetry? Rotation within a plane is guaranteed to be direct, and so the resulting triangles will have the correct winding.

There aren't constraints on symmetry but the texture coords have to be recalc'ed.
Quote:
So, assuming that the first quadrant has all its triangles winding correctly, you need to flip exactly those triangles who have undergone an odd number of reflections. If you are doing things the easy way, this will mean that the two adjacent quadrants will need inversion, while the opposing quadrant will have taken care of itself (the two reflections will have 'cancelled out').

Exactly the results I'm getting!
Quote:
If you don't already know, you can switch the winding order of a triangle by simply swapping any pair of its vertices.

Alright, that's what I'll do. I started this thread believing there was some other 'better' way of doing this but now I see how pointless that was... :-)

Again, thanks very much for your reply. It has been very helpful!

Share this post


Link to post
Share on other sites

This topic is 3745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this