Closed AbdallaGomaa closed 6 years ago
Generally in graphics triangles have a front and a back which is determined by the order of the vertices. You should not encounter any problems as long as you are consistent with your vertices when computing the normal. If you are 100% sure you're being consistent the problem may lie elsewhere.
I'm kinda confused to what being consistent with the vertices means. Each triangle has different vertices, are they supposed to be ordered in a certain way? If I should just use vertices at the same index then I already do that.
On Mon, Sep 24, 2018, 4:51 PM johnkanji notifications@github.com wrote:
Generally in graphics triangles have a front and a back which is determined by the order of the vertices. You should not encounter any problems as long as you are consistent with your vertices when computing the normal. If you are 100% sure you're being consistent the problem may lie elsewhere.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/alecjacobson/computer-graphics-ray-casting/issues/7#issuecomment-424120486, or mute the thread https://github.com/notifications/unsubscribe-auth/AYY2o30YBe_VF65mxDxbpizTtY6tvSK1ks5ueUXRgaJpZM4W3Tkf .
If you are always using the same indices for each triangle to compute the normal then they would all be correct or all be flipped, which doesn't seem to be the case here. Therefore, the error may be earlier in your intersection computation, or perhaps in first_hit
.
I get this is my id.ppm, doesn't this mean I should be computing the intersection and first_hit
correctly?
Nevermind, found my mistake
How long did your implementation take to render this triangle soup out? Mine is going to take a like century...
Takes about 3-5 mins
Thanks for replying. May I know how long it takes to render one triangle?
If you mean just running the program for one triangle then it happens straight away. Takes almost as much time as it does for the sphere
Thanks. I think there must have something to improve in my code since mine takes more than 20sec to get the "triangle.json" rendered. Anyways, thanks for the information.
Every triangle will have two surface normals, one in the "+ve" direction and one in the "-ve" direction. For the normal we return, are we supposed to pick a specific one? The reason I am asking is I get this image as my normal.ppm. While for the most of it it looks correct, the colors aren't the same as the one in the assignment description. I'm guessing that's because some normals are pointing in a certain direction and some are pointing in another. Is there a specific direction we're supposed to be picking? If so, what is it?