POV-Ray : Newsgroups : povray.advanced-users : Question regarding scattering media parameters Server Time
31 Oct 2024 06:00:38 EDT (-0400)
  Question regarding scattering media parameters (Message 1 to 8 of 8)  
From: Samour
Subject: Question regarding scattering media parameters
Date: 22 Jul 2009 10:55:01
Message: <web.4a67279e94feb88464c007780@news.povray.org>
I was wondering what is the source (from a physical/scientific perspective) of
the formulas for k that are related to the various scattering types and how
closely they resemble the actual scattering that would occur in a real world
context (with a focus on the Mie and Rayleigh types).

I am simulating a dust cloud and I was going through the source code to see if I
can make a clear correspondence between the parameters used in POV-Ray, namely k
and alpha, and those used when discussing scattering phenomenon such as
extinction and backscatter ratios. For example, is alpha the extinction
coefficient and k the backscatter? What is the relation between the real
parameters and the ones in POV-Ray? Thanks.

Samer


Post a reply to this message

From: Tim Attwood
Subject: Re: Question regarding scattering media parameters
Date: 27 Jul 2009 00:07:13
Message: <4a6d27f1@news.povray.org>
>I was wondering what is the source (from a physical/scientific perspective) 
>of
> the formulas for k that are related to the various scattering types and 
> how
> closely they resemble the actual scattering that would occur in a real 
> world
> context (with a focus on the Mie and Rayleigh types).
>
> I am simulating a dust cloud and I was going through the source code to 
> see if I
> can make a clear correspondence between the parameters used in POV-Ray, 
> namely k
> and alpha, and those used when discussing scattering phenomenon such as
> extinction and backscatter ratios. For example, is alpha the extinction
> coefficient and k the backscatter? What is the relation between the real
> parameters and the ones in POV-Ray? Thanks.

Sorry it took a while to respond, I needed a while to think
about it.

From a scientific point of view POV doesn't even attempt
to simulate actual RL scattering. Instead rays pass from
the camera through a media without bending or scattering.
Instead it diminishes the intensity of the ray, while adding
in the color provided. In general this follows the scattering
type model only, the other parameters like extinction are
artistic only.

So the only real controls of the scattering media are the
type of model, the color, and the density (provided in
the density statement).

Type 5 provides some control of the Henyey-Greenstein
model by the eccentricity parameter, which I think is g
in the equations, but I'm not sure 100%.
http://www.nmr.mgh.harvard.edu/~adunn/papers/dissertation/node54.html

So you have 5 models to pick from, and the 5th one is
adjustable by a single parameter. Artistically that's perty
good, but if you are looking for exact results based on
some real world formula there's no good analog for which
setting is which because there are no settings beyond selecting
which type to use.

Note: there are a variety of settings having to do with the
sampling of the media, but those control the accuracy of
the media based on the model. Internally there are random
numbers involved in sampling the media repeatedly for
each ray, those settings have to do with how close POV is
getting to the model, but because the model isn't perfect
it usually doesn't matter much.


Post a reply to this message

From: clipka
Subject: Re: Question regarding scattering media parameters
Date: 27 Jul 2009 13:20:01
Message: <web.4a6de1a34e91761e842b7b550@news.povray.org>
"Tim Attwood" <tim### [at] anti-spamcomcastnet> wrote:
> From a scientific point of view POV doesn't even attempt
> to simulate actual RL scattering. Instead rays pass from
> the camera through a media without bending or scattering.

That's not quite true.

What you describe is how POV-Ray goes about emissive and absorbing media. Also
note that there's nothing complicated about simulating such media, as the only
thing to take into account is the distance travelled, as well as the absorption
or emission coefficient, respectively (though the coefficients can vary over
space; numerical integration is used to account for this).

With scattering media, POV-Ray *does* make some attempt to simulate RL
scattering. It should be noted, however, that only first-order scattering is
computed, making it a good approximation only for media with low scattering
coefficients.

The phase function of a medium is approximated by the different scattering
types; I am not an expert on optics, but I guess the functions provide a fair
amount of good approximations for RL phase functions, unless you want to
simulate some sophisticated optical experiment.

Theoretically, it should be no big deal to extend POV-Ray's scattering types
with a user-specified phase function, but there's currently no interface in the
SDL for that.


Post a reply to this message

From: Samour
Subject: Re: Question regarding scattering media parameters
Date: 30 Jul 2009 17:05:01
Message: <web.4a720a8c4e91761e64c007780@news.povray.org>
"clipka" <nomail@nomail> wrote:
> "Tim Attwood" <tim### [at] anti-spamcomcastnet> wrote:
> > From a scientific point of view POV doesn't even attempt
> > to simulate actual RL scattering. Instead rays pass from
> > the camera through a media without bending or scattering.
>
> That's not quite true.
>
> What you describe is how POV-Ray goes about emissive and absorbing media. Also
> note that there's nothing complicated about simulating such media, as the only
> thing to take into account is the distance travelled, as well as the absorption
> or emission coefficient, respectively (though the coefficients can vary over
> space; numerical integration is used to account for this).
>
> With scattering media, POV-Ray *does* make some attempt to simulate RL
> scattering. It should be noted, however, that only first-order scattering is
> computed, making it a good approximation only for media with low scattering
> coefficients.
>
> The phase function of a medium is approximated by the different scattering
> types; I am not an expert on optics, but I guess the functions provide a fair
> amount of good approximations for RL phase functions, unless you want to
> simulate some sophisticated optical experiment.
>
> Theoretically, it should be no big deal to extend POV-Ray's scattering types
> with a user-specified phase function, but there's currently no interface in the
> SDL for that.

Thanks for the replies, they were really helpful.

Now for Rayleigh the phase function is close to what is found in the literature
multiplied by some normalizing constant (the equation in the literature is
0.75*(1.0 + Sqr(alpha)), POV-Ray uses 0.799372013 instead of 0.75), and for
Henyey-Greenstein it is identical.

However, for Mie scattering, there are angular functions that along with other
functions form the scattering phase matrix which is basically the equivalent of
the phase function. I was unable to find a simple phase equation (as exists in
POV-Ray) to define this process.

As such, it would be helpful to know the source of the phase equations for the
Mie scattering, and if possible (though this is much less important) the reason
for the normalizing constant in Rayleigh. Thanks a lot. Appreciate all your
help.


Post a reply to this message

From: clipka
Subject: Re: Question regarding scattering media parameters
Date: 30 Jul 2009 22:15:00
Message: <web.4a7253974e91761ea13874630@news.povray.org>
"Samour" <nomail@nomail> wrote:
> Now for Rayleigh the phase function is close to what is found in the literature
> multiplied by some normalizing constant (the equation in the literature is
> 0.75*(1.0 + Sqr(alpha)), POV-Ray uses 0.799372013 instead of 0.75), and for
> Henyey-Greenstein it is identical.

I just checked the math, and the factors seem to be wrong indeed; I came up with
the following factors:

- Rayleigh scattering:     3/4
- "Mie Hazy" scattering:   1/2
- "Mie Murky" scattering: 33/83

(For the "Mie" formulae, my attempt at symbolic integration had me come up with
1 and 66/83, respectively, but numeric integration gave me values matching the
above quotients, so I guess I just goofed by a factor of 2.)

Henyey and isotropic scattering seem to be properly normalized.


(Normalization appears to be for a spherical integral of 4 pi, not 1, or else
I'm mistaken.)


Post a reply to this message

From: user
Subject: Re: Question regarding scattering media parameters
Date: 31 Jul 2009 12:37:03
Message: <4a731daf$1@news.povray.org>
clipka wrote:
> "Samour" <nomail@nomail> wrote:
>> Now for Rayleigh the phase function is close to what is found in the literature
>> multiplied by some normalizing constant (the equation in the literature is
>> 0.75*(1.0 + Sqr(alpha)), POV-Ray uses 0.799372013 instead of 0.75), and for
>> Henyey-Greenstein it is identical.
> 
> I just checked the math, and the factors seem to be wrong indeed; I came up with
> the following factors:
> 
> - Rayleigh scattering:     3/4
> - "Mie Hazy" scattering:   1/2
> - "Mie Murky" scattering: 33/83
> 
> (For the "Mie" formulae, my attempt at symbolic integration had me come up with
> 1 and 66/83, respectively, but numeric integration gave me values matching the
> above quotients, so I guess I just goofed by a factor of 2.)
> 
> Henyey and isotropic scattering seem to be properly normalized.
> 
> 
> (Normalization appears to be for a spherical integral of 4 pi, not 1, or else
> I'm mistaken.)
> 
> 
> 

OK thanks. That helps a lot.

Now if I understand correctly, the original source for these equations 
is: Principles of digital image synthesis By Andrew S. Glassner.

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


Post a reply to this message

From: Samour
Subject: Re: Question regarding scattering media parameters
Date: 31 Jul 2009 12:40:00
Message: <web.4a731dff4e91761e64c007780@news.povray.org>
"clipka" <nomail@nomail> wrote:
> "Samour" <nomail@nomail> wrote:
> > Now for Rayleigh the phase function is close to what is found in the literature
> > multiplied by some normalizing constant (the equation in the literature is
> > 0.75*(1.0 + Sqr(alpha)), POV-Ray uses 0.799372013 instead of 0.75), and for
> > Henyey-Greenstein it is identical.
>
> I just checked the math, and the factors seem to be wrong indeed; I came up with
> the following factors:
>
> - Rayleigh scattering:     3/4
> - "Mie Hazy" scattering:   1/2
> - "Mie Murky" scattering: 33/83
>
> (For the "Mie" formulae, my attempt at symbolic integration had me come up with
> 1 and 66/83, respectively, but numeric integration gave me values matching the
> above quotients, so I guess I just goofed by a factor of 2.)
>
> Henyey and isotropic scattering seem to be properly normalized.
>
>
> (Normalization appears to be for a spherical integral of 4 pi, not 1, or else
> I'm mistaken.)


OK thanks. That helps a lot.

Now if I understand correctly, the original source for these equations is:
Principles of digital image synthesis By Andrew S. Glassner.

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


Post a reply to this message

From: clipka
Subject: Re: Question regarding scattering media parameters
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.