|
Post by ascotti on Mar 17, 2019 17:47:03 GMT
This is a silly idea that just came to mind, but I tried it and it worked! The code that computes the ray-triangle intersection also produces the barycentric coordinates (u, v) of the intersection point. If either u or v or 1-u-v (the third coordinate) is small enough, then the intersection point should be close to the triangle edge. In that case, I set the triangle normal to the null vector (0,0,0,0). Nothing very special about this value, just a trick to get something different without messing with materials. Result not bad for literally two lines of code! Attachments:
|
|
|
Post by Jamis on Mar 17, 2019 20:34:15 GMT
Wow, that's genius! I love that. Such a clever trick.
|
|