cmo
New Member
Posts: 6
|
Post by cmo on Feb 6, 2021 1:48:27 GMT
I pulled the teapot OBJ files from the link in the book: graphics.cs.utah.edu/courses/cs6620/fall2013/?prj=5The image renders correctly geometrically, but the shading is off. After some debugging, I discovered the direction of the normal vectors is the issue. In the attached picture I've changed shadows to WHITE, to highlight the problem. In the white part of the teapot, the normal vectors are pointing inwards, towards the center of the pot. Has anyone else ran into this? If we use the vertex normals from the OBJ file (as for smoothing) this problem should go away. But if we ignore the vertex normals from the file, and just populate triangles from the polygon points... Well, then the direction of the normal will depend on what order those points are entered, right? Is there a good general solution? Attachments:
|
|
|
Post by Jamis on Mar 3, 2021 2:15:44 GMT
You're exactly right. I strongly recommend using the normals from the OBJ file for just this reason. If the file does not include normals, then you can assume the polygons are constructed such that the vertices are ordered correctly. Otherwise, trust the normals in the file.
If you don't want smoothing, you can find a single normal for the triangle by averaging the normals of the vertices.
|
|