Post by inventordave on May 12, 2020 19:52:47 GMT
I may be missing something, but I am having a problem I don't understand.
Basically, I searched the interweb for scene files, to feed into my raytracer for inspiration. I came across the following scene
, which I reproduced from the scene file linked from the same part of the webpage ("scene02.yaml", which is also in my code distribution). (For reference, the website is: www.cs.rug.nl/svcg/ComputerGraphics/Raytracer )
The scene is reproduced in function
To try and debug, I recreated the 2 tests from the end of ch5 and ch6, which can be executed by running function
So far, so good. So, maybe it's because scene2() uses a different codepath and method to produce the image? To test, I created function
It's not set up perfectly, but you can clearly see it's illuminated in 3d.
It uses the same method as the scene I am trying to reproduce.
What is going on?? Why don't the spheres look 3d?? And, why is the image flipped?? It's clearly mirrored around the y-axis....
The codebase is at: github.com/leeodea/rt-dt
(p.s. When you load my raytracer in your browser, please ignore the lame flourishes to the interface, I needed a distraction the other day, so I knocked together this interface...)
As a quick guide, all the interface code is in "raytracer.html" itself. The menu option "Render->Render!" calls function
You will see from the renderImage() function that I have a Global object, called ofData, which holds things such as a camera and a point light, and a
Basically, I searched the interweb for scene files, to feed into my raytracer for inspiration. I came across the following scene
, which I reproduced from the scene file linked from the same part of the webpage ("scene02.yaml", which is also in my code distribution). (For reference, the website is: www.cs.rug.nl/svcg/ComputerGraphics/Raytracer )
The scene is reproduced in function
scene2()
, from "rt.examples.js". After you run it from the browser console, the app console will tell you to select "Render->Render!" It doesn't produce the result it should (see above). It instead produces:To try and debug, I recreated the 2 tests from the end of ch5 and ch6, which can be executed by running function
eCh5()
and function hereWeGo()
, respectively. Both of these functions are in "rt.tests.js", near the bottom of the file. They should be run from the browser console. For these 2 functions specifically, you don't need to select menu option "Render->Render!"... They work as expected. (The minor caveat is that the shadow in the image from hereWeGo() is not particularly gradiated, but that doesn't really matter for now.)So far, so good. So, maybe it's because scene2() uses a different codepath and method to produce the image? To test, I created function
scene3()
(in "rt.examples.js", run from the browser console. After you run it from the browser console, the app console will tell you to select "Render->Render!"), and this is the output:It's not set up perfectly, but you can clearly see it's illuminated in 3d.
It uses the same method as the scene I am trying to reproduce.
What is going on?? Why don't the spheres look 3d?? And, why is the image flipped?? It's clearly mirrored around the y-axis....
The codebase is at: github.com/leeodea/rt-dt
(p.s. When you load my raytracer in your browser, please ignore the lame flourishes to the interface, I needed a distraction the other day, so I knocked together this interface...)
As a quick guide, all the interface code is in "raytracer.html" itself. The menu option "Render->Render!" calls function
renderImage()
, which calls render(c, w, remaining)
, which is in "rt.raytracer.js"...You will see from the renderImage() function that I have a Global object, called ofData, which holds things such as a camera and a point light, and a
group()
object, which are passed to the actual render function, render(c, w, remaining)