View Single Post
Old 28th January 2004, 15:17   #2
Whacked Moderator
UnConeD's Avatar
Join Date: Jun 2001
Posts: 2,104
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.

UnConeD is offline   Reply With Quote