|
Post by tobnac on Jan 21, 2022 20:01:12 GMT
Hey, I have built a simple Raytracing Demo in Javascript to show how Raytracing is implemented. It work's fine and fulfills its purpose. However, I noticed, that the Reflections on the Ground don't work properly. On spheres they do. Please have a look at this demo: tobnac.de/jsrt/rt.html (Click on Start) Here you can see the code. I marked the position where Reflections are made: github.com/TobnacTobi/jsrt/blob/master/rt.html#L472As you can tell the reflection of the spheres on the ground are way too big while the reflection on the spheres work fine. I would be very glad to receive any help, since I'm stuck with this. I know this forum is not meant for this purpose, but I could not find a more general forum. Thank you, Tobi
|
|
|
Post by Jamis on Jan 24, 2022 21:34:54 GMT
Hey tobnac, I believe the issue is how you're computing the normal for the plane. As mentioned in Chapter 9, under "Implementing a Plane", "Every single point on the plane has the same normal: vector(0, 1, 0)." I think you correct that, the reflections (and shading) will render better.
|
|
|
Post by tobnac on Jan 25, 2022 19:19:53 GMT
Hey tobnac , I believe the issue is how you're computing the normal for the plane. As mentioned in Chapter 9, under "Implementing a Plane", "Every single point on the plane has the same normal: vector(0, 1, 0)." I think you correct that, the reflections (and shading) will render better. Thank you so much! Actually I don't have the book and were only looking for a quick and dirty js implementation. It bothered me, that everything seemed to work except the reflection of the plane. The problem was, that i did not normalize the Normal of the plane. Your guess of Vector(0,1,0) really did it for me and I checked for that. Now it works like a charm: prnt.sc/26j93j1Thank you so much!
|
|