Original Post
Ok, I ve created a 3D model using a ply file and now I need to calculate its normals..
Quote:For each triangle, take the cross product of 2 edges. For a triangle with vertices a, b and c this would be: CrossProduct(c - a, c - b), although you may have to correct the order depending on your triangle winding. This is the normal vector for the triangle.
Original post by Tipotas688
Ok, I ve created a 3D model using a ply file and now I need to calculate its normals.
def triangle_normal(v1, v2, v3): return CrossProduct(v1 - v2, v1 - v3)def vertex_normal(triangle_normals): v = vec3() for n in triangle_normals: v += n return normalise(v)This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more