wait, nevermind, i am guessing these were done is a version older than 1.2.1? i see now that 'Numbers' has a block with dropdown for all kinds of Math functions, abs, cos, sin, etc...
so does that mean that a red colored block is one that isnt supported anymore, or is from an older version?
Because it doesn't use the x position to set the color. The square root is used as part of the calculation to get the length of the ray from the camera to the surface it is colliding with. It is also used to make sure that the ray used to calculate the lighting has a length of 1.
Hey Canthiar, why does this need a square root variable?
Couldn't you just tell the ray tracer something like "if x position is greater than such and such and less than such and such, set pen color to, say, blue"?
Ray casting and ray tracing are fairly similar. If you're talking about the way Doom rendered, if I remember correctly, it only did a single cast in the vertical plane, but did a cast for each pixel on the horizontal plane. It might be possible, but I think it would still be too slow for Scratch to render in real time.
Would it be possible to do a ray caster in Scratch? I don't know all the technical details, but I think ray casting is much much faster than ray tracing.
Removed repeat until in square root calculation to speed things up.
A more finalized raytracer that renders the spheres in middle of the play field.
Click the flag to move the objects around and then click it again to start the rendering process over again.
This version is slower, but does a light occlusion check to cast shadows.
Comments
You need to be logged in to post comments
Add a Comment
wait, nevermind, i am guessing these were done is a version older than 1.2.1? i see now that 'Numbers' has a block with dropdown for all kinds of Math functions, abs, cos, sin, etc... so does that mean that a red colored block is one that isnt supported anymore, or is from an older version?
(view all replies)Comment Reply
That's correct, it's a block that is no longer supported.
(view all replies)Comment Reply
i want to know where the red 'abs' block came from?
(view all replies)Comment Reply
Canthiar, can you explain to an newbie (me) how you do this?
(view all replies)Comment Reply
If you can follow along with all of the math then you can read up on how I did it in this forum post: (link to forums)
(view all replies)Comment Reply
i dont get it ur a super genius (if i spelled right)
(view all replies)Comment Reply
...can you explain what to do? I don't get it.
(view all replies)Comment Reply
Because it doesn't use the x position to set the color. The square root is used as part of the calculation to get the length of the ray from the camera to the surface it is colliding with. It is also used to make sure that the ray used to calculate the lighting has a length of 1.
(view all replies)Comment Reply
Hey Canthiar, why does this need a square root variable? Couldn't you just tell the ray tracer something like "if x position is greater than such and such and less than such and such, set pen color to, say, blue"?
(view all replies)Comment Reply
Ray casting and ray tracing are fairly similar. If you're talking about the way Doom rendered, if I remember correctly, it only did a single cast in the vertical plane, but did a cast for each pixel on the horizontal plane. It might be possible, but I think it would still be too slow for Scratch to render in real time.
(view all replies)Comment Reply
but it has much less detail.
(view all replies)Comment Reply
Would it be possible to do a ray caster in Scratch? I don't know all the technical details, but I think ray casting is much much faster than ray tracing.
(view all replies)Comment Reply
WOWIE
(view all replies)Comment Reply
i dont get it
(view all replies)Comment Reply
I actually have a full time job writing software. You shouldn't worry about it too much and enjoy being young and having no responsibilities.
(view all replies)Comment Reply
oh wow.im not even close to having one.
(view all replies)Comment Reply
Yes, I do.
(view all replies)Comment Reply
Canthiar,you have a job?
(view all replies)Comment Reply
I guess it's just all stuff that I've had experience with at some point in the past.
(view all replies)Comment Reply
*gaping* Great programming. How'd you come up with all of this? I love it.
(view all replies)Comment Reply
It's not an interactive game. Ray tracing is a computationally intensive way of rendering graphics using 3D math.
(view all replies)Comment Reply
i dont get it...
(view all replies)Comment Reply
Yes, it does. I used to be bad at math, but I got better. Now I use it every day for my job.
(view all replies)Comment Reply
Math rocks!
(view all replies)Comment Reply
I agree.
(view all replies)Comment Reply