POV-Ray : Newsgroups : povray.advanced-users : Question regarding scattering media parameters : Re: Question regarding scattering media parameters Server Time
1 Jul 2024 06:10:44 EDT (-0400)
  Re: Question regarding scattering media parameters  
From: clipka
Date: 31 Jul 2009 14:05:01
Message: <web.4a7331434e91761e34ae7f580@news.povray.org>
use### [at] domaininvalid wrote:
> Now if I understand correctly, the original source for these equations
> is: Principles of digital image synthesis By Andrew S. Glassner.

Interesting to know. Maybe it's worth putting that as a comment into the code,
just in case someone asks again in, say, two years' time.


> I still don't understand how you came up with the normalization factors
> for the Mie scattering though. Sorry for being such a bother.

This is how:

If the thing is to be normalized, it means the integral over the full sphere
must equal some constant like, in this case apparently, the respective integral
for f(theta)=1.

The integral of a function over the full sphere is the integral of [ the
integral of the function over the circle on the sphere having a certain angle
Theta from some axis on the full sphere ] over all such angles Theta.

As the function value is constant for a particular Theta, the inner integral can
trivially be shown to be proportional to the function multiplied by the
circumference of the circle; I don't bother about the proportionality factor,
as it will cancel out later anyway

So I'm left with the task of integrating C * f(Theta) * 2*pi*sin(Theta) over all
Theta from 0 to pi (the result of which I'll henceforth denote as I[f]).

The result should then be equal to that same integral computed for f(Theta)=1,
i.e. the intregral of C * 2*pi*sin(Theta) over all Theta from 0 to pi (the
result of which I'll henceforth denote as I[norm]).

If the results don't match, I'll need to add a normalization factor of
I[norm]/I[f]. Obviously, if I define I' := I/C, this normalization factor is
equal to I'[norm]/I'[f], so I can go on with the integrals

I'[f]    = Integral of f(Theta) * 2*pi*sin(Theta) over Theta=0..pi
I'[norm] = Integral of            2*pi*sin(Theta) over Theta=0..pi


For the symbolic approach, I used Wolfram Mathematica Online
(http://integrals.wolfram.com/index.jsp) to figure out the symbolic integrals
for both I'[norm] as well as I'[f] . I then used these to compute precise
values for the integrals over Theta=0..pi.

For the numerical approach, I threw together a POV-Ray script to braindeadly sum
up the following over a set of equally-spaced angles Theta between 0..pi:

I"[f]    := Sum of f(Theta) * 2*pi*sin(Theta) for chosen Theta from 0..pi
I"[norm] := Sum of            2*pi*sin(Theta) for chosen Theta from 0..pi


As I mentioned, for the "Mie functions", the values I came up with from the
symbolic approach were off by a factor of quite exactly 2 from the numerical
results; but the symbolic integrals for the "Mie" functions were quite ugly,
and I do have an idea exactly where I lost that factor 2 along the way (some
terms cancelled out for both border values, while the others effectively
duplicated; I probably just kicked out the cancelling terms and computed the
others, forgetting about the duplication).


Post a reply to this message

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