Archive: raytracing: inside and outside sphere


28th January 2004 12:36 UTC

raytracing: inside and outside sphere
it took me only two days to understand the basics of raytracing and to make my first planes and tunnels DMs, just with the help of the easy to understand explantions by UnConeD. Due to my bad math skill I can make more complex objects. So I simply copied the "k" for a sphere from one of UnConeD's tuts.
What I don't understand is how to move the camera out of the shere.
when the cam coords are something like oz=1 it's inside and distorts the sphere. in discoball the z-coord is oz=sin(t)+1.9 or something.
who can explain me how to the camera outside of and object in general? (also for cylinders)


28th January 2004 15:17 UTC

The problem is that you need to pick the closest intersection point to the camera: for a sphere, there are usually two. If your camera only stays outside or inside, you can always use the same formula, otherwise you need to calculate both and compare them.

Copying k codes is pretty dumb though: the equation for a sphere around the origin is: x^2 + y^2 + z^2 = radius^2
If you've read my little raytracing intro, this should be enough to get you started and derive the k formula yourself.


30th January 2004 08:48 UTC

thx.
got it now, my own in and out sphere.
it was just one sign in the "k" formula.
I still need lots of "training".


3rd February 2012 18:03 UTC

Hey! What preset (or AVS Pack) of UnConed that explain about ray tracing and not very hard to understand?