Post by inventordave on May 8, 2021 15:47:09 GMT
My animation functionality is coming along. I have a strange bug, which I don't understand.
Basically, I have an Earth at the World origin, with a Moon that starts at position (-4,0,0).
Then, the animation function will rotate the Moon around the Earth along the xz plane (rotation_y).
Now, when the Moon starts on the left (-4,0,0), as it ultimately appears around the right-hand-side of the Earth, the "image" appears to be clipped, as if the end of the frame was breached (it isn't).
So, when you flip the start position for the Moon to the right-hand-side (4,0,0), this time when the Moon travels around the left-side of the Earth (x < 0), that side likewise suddenly seems clipped.
Here are 2 GIFs to show the outputs based on the 2 starting positions:
When the Moon starts on the left (x < 0):
GIF 'start-lhs.gif'
And, when the Moon starts on the right (x > 0):
GIF 'start-rhs.gif'
I suspect, and it is an odd one, that the lighting code is buggy, but I can't think how such a bug would come about.
My codebase is available at: Dave's Browser RayTracer. It needs to run on localhost via a local webserver.
EDIT: I have the raytracer online at www.inventordave.com/rt-dt/raytracer
EDIT2: The URL changed, making the link broken. I've updated it.
Instructions to reproduce animation:
1. On loading the app on localhost (raytracer.html), wait for all the resources to finish loading, as indicated in the app console on the left.
2. Go to dev console.
3. type: setScene() // this will generate the first frame
4. type: genFrames(16, 1) // the 16 means 16 frames per 360deg revolution, the 1 means 1 revolution.
// on my box, each frame takes about 10-15 secs. Once all the frames have been generated:
5. type: animate(Infinity)
6. To stop animation, type: _f = -1
The animation code is in "rt.exp.js" (the 'exp' stands for 'experiments')
The main files for the rendering code are "rt.shade.js" and "rt.light.js"
The render functions are mostly in "raytracer.js"
Any help, or thoughts, would be appreciated!
Thanks, Dave.
Basically, I have an Earth at the World origin, with a Moon that starts at position (-4,0,0).
Then, the animation function will rotate the Moon around the Earth along the xz plane (rotation_y).
Now, when the Moon starts on the left (-4,0,0), as it ultimately appears around the right-hand-side of the Earth, the "image" appears to be clipped, as if the end of the frame was breached (it isn't).
So, when you flip the start position for the Moon to the right-hand-side (4,0,0), this time when the Moon travels around the left-side of the Earth (x < 0), that side likewise suddenly seems clipped.
Here are 2 GIFs to show the outputs based on the 2 starting positions:
When the Moon starts on the left (x < 0):
GIF 'start-lhs.gif'
And, when the Moon starts on the right (x > 0):
GIF 'start-rhs.gif'
I suspect, and it is an odd one, that the lighting code is buggy, but I can't think how such a bug would come about.
My codebase is available at: Dave's Browser RayTracer. It needs to run on localhost via a local webserver.
EDIT: I have the raytracer online at www.inventordave.com/rt-dt/raytracer
EDIT2: The URL changed, making the link broken. I've updated it.
Instructions to reproduce animation:
1. On loading the app on localhost (raytracer.html), wait for all the resources to finish loading, as indicated in the app console on the left.
2. Go to dev console.
3. type: setScene() // this will generate the first frame
4. type: genFrames(16, 1) // the 16 means 16 frames per 360deg revolution, the 1 means 1 revolution.
// on my box, each frame takes about 10-15 secs. Once all the frames have been generated:
5. type: animate(Infinity)
6. To stop animation, type: _f = -1
The animation code is in "rt.exp.js" (the 'exp' stands for 'experiments')
The main files for the rendering code are "rt.shade.js" and "rt.light.js"
The render functions are mostly in "raytracer.js"
Any help, or thoughts, would be appreciated!
Thanks, Dave.