|
![](/i/fill.gif) |
marky.addison schrieb:
> I am trying to figure out what mathematics does POV-Ray use.
> Does it use more Raytracing or Radiosity or it combines both?
Normally it uses raytracing, unless you explicitly tell it to also
include radiosity (note that the term may be ambiguous; a more fitting
term would have been "ambient illumination", but that term was already
occupied in POV-Ray for a quite cheap approximation thereof).
> How does it make shadows (isn't it with radiosity)?
No, ambient illumination kicks in regardless of whether a surface is
exposed to direct light or not (although its effect is most obvious in
shadows).
> So I need some formulas, integrals and derivatives so I can
> better understand how it works.
If you want to know how it /works/, you should ask for algorithms. I
guess what you want to know is what these algorithms /represent/ in
mathematical terms.
Unfortunately I'm more the practical guy, who broods over a mathematical
formula with integrals and stuff, thinking "man, can't somebody just
give me an algorithm so I can better understand what these integrals
really mean?!"... well, anyway, I'll try to give it a shot (but you'll
have to transpose my prose it into formal mathematical notation yourself).
Expressing all the mathematical stuff that POV-Ray tries to compute
numerically wold probably fill a book, and it would probably take
decades to write (at least if I ware to write it), so I'll concentrate
on the one concrete thing you mentioned: Shadows. Or, more precisely,
computing incident illumination for the sake of the diffuse reflection term.
Mathematically speaking, POV-Ray numerically (and approximately)
computes the total incident illumination at a point P as the sum of
three hemispherical integrals, each of: Incident light, matching certain
category, from any direction, multiplied by the cosine of the angle of
incidence.
(Note that while mathematically this could be simplified to a single
hemispherical integral, the implementation computes/approximates the
integrals separately for optimization.)
The three categories are:
(A) Direct incident illumination via light paths that don't involve any
reflection or refraction. ("Direct light")
(B) Indirect incident illumination via light paths that involve only
specular reflection/refraction, and no scattering. ("Caustics")
(C) Indirect indicent illumination via light paths that involve diffuse
reflection/refraction, and/or media scattering. ("Ambient illumination")
(Transmittance through an interface between media with identical
refractive indices are not considered refraction in this sense.)
For the sake of category (A), light sources are considered to be either
point light sources, or arrays of point light sources. Incident light is
computed only for vectors from any such point light source to P, for
probably obvious reasons. The algorithm basically uses simple
intersection testing, and some formula for light attenuation based on
distance, media and surface properties; mathematically, this is probably
best represented as the product of the light source brightness and a
term representing attenuation.
For the sake of category (B), photon mapping is used. Basically, this
uses forward-raytracing and monte-carlo integration to approximate the
corresponding term for any point on any surface (and also for any point
in any scattering media).
For the sake of category (C), the approach as described by Greg Ward
(aka "radiosity" in POV-Ray) is used, and as the original paper is much
more mathematical than I could ever rephrase it, you'd best look the
details up there.
Alternatively, to speed up rendering, photon and/or radiosity mapping
may be turned off. In this case, (B) is approximated by presuming that
(for the sake of illumination computation) refractive indices of all
media are identical and ignoring any light paths that include specular
reflection, while (C) is approximated by a constant term (which may vary
from surface to surface) specified by the scene designer.
The full incident illumination term is in turn used to compute the
diffuse reflective term, but there's not much special in POV-Ray about
this (nor the specular reflective or refractive terms) - we're talking
about a quite straightforward BRDF illumination model here.
Post a reply to this message
|
![](/i/fill.gif) |