POV-Ray : Newsgroups : povray.advanced-users : Stochastics expertise needed Server Time
17 May 2024 00:01:51 EDT (-0400)
  Stochastics expertise needed (Message 21 to 26 of 26)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: clipka
Subject: Re: Stochastics expertise needed
Date: 27 Aug 2016 08:41:49
Message: <57c18a8d$1@news.povray.org>
Am 27.08.2016 um 13:35 schrieb Bald Eagle:
> I have to be out for most of the day today, but I figured if we were searching
> for a "bicycle" that already exists, then a search ought to pick up a nice
> parametrizable equation.
> 
> I started off with blackbody and Maxwell-Boltzmann distributions, but then
> enough coffee kicked in...   ;)
> 
> https://www.google.com/#q=brdf+code
> 
> http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html
> https://support.solidangle.com/pages/viewpage.action?pageId=5800819
> 
> https://www.google.com/#q=highlight+reflection+distribution
> 
> 
> What's the "input" for this algorithm?  A vector?   I'm assuming that the output
> is just the vector on the unit sphere.  I'm trying to visualize where this
> "plugs in" to the pixel-evaluation chain of events.

Congratulations, it seems like you've just found out what a BRDF is...
now to my problem of generating random numbers with a distribution that
is reasonably close to a given BRDF (in order to get an efficient
sampling), while keeping track of the probability of the numbers we're
generating (in order to compensate for the virtually inevitable mismatch) ;)


Post a reply to this message

From: Bald Eagle
Subject: Re: Stochastics expertise needed
Date: 1 Sep 2016 18:20:00
Message: <web.57c8a8e08629941b5e7df57c0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:

> Congratulations, it seems like you've just found out what a BRDF is...
> now to my problem of generating random numbers with a distribution that
> is reasonably close to a given BRDF (in order to get an efficient
> sampling), while keeping track of the probability of the numbers we're
> generating (in order to compensate for the virtually inevitable mismatch) ;)

Thanks!   Do I win a prize?   :D

So, after skimming some of the literature, I have a much better idea of what
you're specifically looking for - some form of Importance Sampling.

If you can post a graph of the BRDF that you're trying to simulate for the
purposes of your sampling algorithm, or a means of plotting it themselves, then
that might give anyone following along a nudge forward.

It seems that for any given function plotted between A and B, the probability of
having X land in that interval is the integral (S) of that function.

So, for my square root spline sampling function, f(x) = pow(x, 0.5)
so S(pow(x, 0.5) = 1/1.5 * pow(x, 1.5).

Also,

My apologies, but I'm trying to figure out what you actually mean when you say
"keep track of the probability..."

Do you tallying up the actual results of the random sampling so that you can do
a summation and then divide by the number of random samples?


Post a reply to this message

From: clipka
Subject: Re: Stochastics expertise needed
Date: 2 Sep 2016 01:30:30
Message: <57c90e76$1@news.povray.org>
Am 02.09.2016 um 00:17 schrieb Bald Eagle:

> So, after skimming some of the literature, I have a much better idea of what
> you're specifically looking for - some form of Importance Sampling.

Yes, that's what the experts call it.

> If you can post a graph of the BRDF that you're trying to simulate for the
> purposes of your sampling algorithm, or a means of plotting it themselves, then
> that might give anyone following along a nudge forward.

I can't. That's the crux of the matter: The algorithm needs to cope with
varying BRDFs. It might be Lambertian with a Phong highlight, or
Oren-Nayar with a Blinn-Phong highlight, or (in the future) maybe
Cook-Torrance, He-Torrance, Ward, Schlick, Lafortune, or whatever smart
brains may still come up with and someone decides to implement in POV-Ray.

I therefore intend to use a very simple approximation to generate my
sampling distribution, and compensate for the difference to the BRDF
(which, by the way, may actually not even be a true BRDF, such as
anything involving POV-Ray's brilliance model) by multiplying the
computed colour of the sample with the BRDF (which will actually be
hidden away in the sample computation) and then dividing it by the
probability that my sampling direction generator spits out that
particular sampling direction.

What exact formula to use is something I leave up to whoever can provide
a viable solution.

To give you a rouhg idea at what I'm aiming for, you might try the Phong
model:

    f(L,V) = k (Lm . V) ^n

where Lm is L mirrored at the surface normal.


> Also,
> 
> My apologies, but I'm trying to figure out what you actually mean when you say
> "keep track of the probability..."

What I mean by that is that I want to know the probability density
function of the sample directions.

> Do you tallying up the actual results of the random sampling so that you can do
> a summation and then divide by the number of random samples?

Something along those lines, yes. But I need to weigh the individual
samples by the probability density function of the sample direction
generator (or, more precisely, by the reciprocal thereof).


Post a reply to this message

From: scott
Subject: Re: Stochastics expertise needed
Date: 2 Sep 2016 02:39:06
Message: <57c91e8a@news.povray.org>
>> If you can post a graph of the BRDF that you're trying to simulate for the
>> purposes of your sampling algorithm, or a means of plotting it themselves, then
>> that might give anyone following along a nudge forward.
>
> I can't. That's the crux of the matter: The algorithm needs to cope with
> varying BRDFs. It might be Lambertian with a Phong highlight, or
> Oren-Nayar with a Blinn-Phong highlight, or (in the future) maybe
> Cook-Torrance, He-Torrance, Ward, Schlick, Lafortune, or whatever smart
> brains may still come up with and someone decides to implement in POV-Ray.

...or a BRDF created by interpolating real-life measurement data :-)


Post a reply to this message

From: clipka
Subject: Re: Stochastics expertise needed
Date: 2 Sep 2016 03:38:48
Message: <57c92c88$1@news.povray.org>
Am 02.09.2016 um 08:39 schrieb scott:
>>> If you can post a graph of the BRDF that you're trying to simulate
>>> for the
>>> purposes of your sampling algorithm, or a means of plotting it
>>> themselves, then
>>> that might give anyone following along a nudge forward.
>>
>> I can't. That's the crux of the matter: The algorithm needs to cope with
>> varying BRDFs. It might be Lambertian with a Phong highlight, or
>> Oren-Nayar with a Blinn-Phong highlight, or (in the future) maybe
>> Cook-Torrance, He-Torrance, Ward, Schlick, Lafortune, or whatever smart
>> brains may still come up with and someone decides to implement in
>> POV-Ray.
> 
> ....or a BRDF created by interpolating real-life measurement data :-)

Or that, yes.

(And would that then be a naive interpolation of a data array, or maybe
a spherical harmonics-based approximation?)


Post a reply to this message

From: Bald Eagle
Subject: Re: Stochastics expertise needed
Date: 2 Sep 2016 07:40:00
Message: <web.57c963eb8629941b5e7df57c0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:

> I can't. That's the crux of the matter: The algorithm needs to cope with
> varying BRDFs. It might be Lambertian with a Phong highlight, or
> Oren-Nayar with a Blinn-Phong highlight, or (in the future) maybe
> Cook-Torrance, He-Torrance, Ward, Schlick, Lafortune, or whatever smart
> brains may still come up with and someone decides to implement in POV-Ray.

Well, for now, you can - if there were a set of equations for the BRDF's that
could be easily plotted over the range 0-1 or 0-pi, then the shape might inspire
an equation to mimic them.   Presumably you already have a few such equations
working with POV-Ray, and some of the special development versions.

I've thought about this a bit and will have some more to say and ask, but for
now:

Is there a way to take the models available and fit a curve to them?
Polynomials, or Taylor series, or something like that?

And now I'm off to work.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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