|
![](/i/fill.gif) |
In article <39acb150$1@news.povray.org>, "Mathias"
<Mat### [at] dlr de> wrote:
> Then please tell me how povray raytraces a scene ? I dont know it.......
Hmm, I will try my best...at the most basic level, a raytracer works
this way:
For each pixel, it determines the direction and starting point of a line
going from that pixel to the portion of the scene visible from that
pixel. This is a "ray", an infinite line with a starting point and
direction. It then tests the ray against all the objects in the scene,
finding all(or a large number of) of the intersections it makes with
object surfaces. It usually does this by solving an equation. The
closest intersection found is taken as the first one, and the color of
the texture at that point is calculated.
To calculate reflections, it then determines a new direction for the
ray, based on the surface normal at the intersection point, and sets the
origin to the intersection point. It then "traces the ray" again, much
like the first ray, to get the contribution reflection makes to the
color of the surface. Refraction is done similarly, except the ior value
is also taken into account and a different calculation is used for
getting the new ray direction. Lighting is done by tracing a ray toward
a light source, and calculating the effect of transparent objects
between the object and light source on the light, or producing a shadow
if an opaque object is encountered.
Most raytracers use recursion, and go several levels deep into the
scene, so a ray can reflect or refract several times before stopping. In
POV, the maximum level is controlled by the max_trace_level keyword in
global_settings.
The exact way POV does things is much more complex, and follows a pretty
convoluted path through several source files, depending on the exact
features used and the portion of the scene currently being calculated,
and unfortunately, there is very little documentation on the source code.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |