POV-Ray : Newsgroups : povray.programming : how does POV work?? : Re: how does POV work?? Server Time
28 Jul 2024 16:22:47 EDT (-0400)
  Re: how does POV work??  
From: Warp
Date: 22 Apr 2000 16:31:07
Message: <39020c0b@news.povray.org>
"Shooting a ray" is actually calculating (mathematically) the intersection
of a line and the object in question (eg. a sphere).
  This means that if we have the sphere equation defined like:

S: sqrt((x-center.x)^2 + (y-center.y)^2 + (z-center-z)^2) - radius = 0

and the "ray", ie. the line from the "camera" to some direction, like:

L: a*x + b*y + c*z + offset = 0

then we can calculate the intersection points of that line and the sphere
by making them equal:

L = S

and solving the x, y and z values where the equality holds (we get two
solutions, ie. the two intersection points). These points are, of course,
located on the surface of the sphere.

  Now that we know the points, we can calculate the color of that point for
the given x, y, z (from the texture attached to the sphere), the normal
vector of the sphere at that point (from which we can calculate the
lighting, reflection, refraction and so on), etc.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.