Tag Info

Hot answers tagged


Usually the distance of the midpoint of a polygon to the camera is being used for z-sorting. The painter's algorithm cannot be 100% accurate by it's nature. There will always be cases where sorting will fail, no matter what reference point you use. If you want correct z-sorting with the painter's algorithm, you'll have to slice overlapping polygons into ...


OpenGL wiki's pseudocode (as referenced by Peter Taylor, as well) is correct. What you want is the normal of the plane the triangle, quad or other polygon represents. All you need are two edges of any planar polygon that share a common vertex. The number of edges does not matter. All you need is to get enough information to define the plane, and then get ...


I'll post my solution too, it takes the average of the normals of all triangles that a vertex belongs to. It takes a mesh with vertices and indices and calculates the normals for all vertices. for(int i = 0; i < indices.Length; i += 3) { Vector3 v0 = vertices[indicies[i]].Position; Vector3 v1 = vertices[indicies[i+1]].Position; Vector3 v2 = ...


I'm successfully using this for quads / triangles. Loop through each face, and pass in 3 verticies. If you have a quad ABCD pass in ABD. For example for the front facing face on this cube, I would pass in, v2, v3, v0 // cube /////////////////////////////////////////////////////////////////////// // v6----- v5 // /| /| // v1------v0| // | | ...


A cross product ought to be perfectly reliable for any planar polygon. If you've got problems with that, it's almost certainly just a bug in your code. As others have said, it would be useful to know why you think your normals are wrong.


I can't answer your question directly but I can offer some suggestions and questions to ask yourself to narrow it down... Depending on your research goals, ask yourself if you really need a realistic facial animation in the first place. Computer faces will never be as good as the real thing. Can you literally take photos/videos of real people and use ...


It may be mathematically equivalent - check it if you want - but the code given there is not the same as the pseudocode for Newell's method given on the OpenGL wiki. See http://www.opengl.org/wiki/Calculating_a_Surface_Normal

Only top voted, non community-wiki answers of a minimum length are eligible