POV-Ray : Newsgroups : povray.beta-test : Experimental alternative diffuse models Server Time
22 Dec 2024 14:48:14 EST (-0500)
  Experimental alternative diffuse models (Message 1 to 10 of 21)  
Goto Latest 10 Messages Next 10 Messages >>>
From: clipka
Subject: Experimental alternative diffuse models
Date: 31 Mar 2016 13:27:57
Message: <56fd5e1d@news.povray.org>
I've just released an experimental version of POV-Ray implementing two
alternative models for diffuse reflection, besides the classic so-called
Lambertian model:

https://github.com/POV-Ray/povray/releases/tag/v3.7.1-alpha.8545805%2Bav122

I'd like to invite you to toy around with them as you deem fit.


To explain what these alternative models do, let me first bore you to
death with some background information:


In a totally strict sense, diffuse reflection is the effect that light
hitting a surface bounces off in a direction that is entirely
independent of the angle of incidence. There is essentially just one
manner in which this can happen, and it is perfectly described by the
so-called Lambertian model, which is what POV-Ray uses.

Surprisingly enough, for this type of reflection to happen, the object's
surface must be _perfectly smooth_; all of what we might call
"diffuseness" must be from scattering within the material itself -- the
same process we now know as "subsurface scattering". So the Lambertian
model can be thought of as a subsurface scattering model, suitable for
materials in which the light doesn't travel far before exiting again (in
technical terms, materials with a very low "mean free path" between
scattering events).

As soon as the surface exhibits any kind of roughness, other effects
kick in that mess with the neat non-directionality of the Lambertian
model; for instance, in a bumpy surface, portions of the surface which
are angled towards the light source will receive more incoming light;
since each portion of the surface will emit light preferentially in the
direction of its surface normal, this will bias the outgoing light
towards the direction of incoming light.


The alternative models try to account for such effects in different ways:


- The Oren-Nayar model is based on the presumption that the surface is
comprised of microscopic facets of somewhat random orientation that form
V-shaped pits, with each individual facet exhibiting Lambertian
reflection. The model takes into account not only microfacet
orientation, but also shadowing and masking of light by the opposite
side of each pit, as well as interreflection between the sides. For the
sake of computational simplicity, instead of the full model I've
implemented the more commonly used simplified version, known as the
"qualitative model", which eliminates one term that contributes only
little to the result, and uses a very rough approximation for
interreflection.

To use the (qualitative) Oren-Nayar model, specify:

    finish {
      diffuse FLOAT
      oren_nayar ROUGHNESS
    }

where the ROUGHNESS parameter is a metric for the roughness of the
material. (Currently this is the _sigma_ parameter in the Oren-Nayar
equations; however, please be aware that this may still be subject to
change without notice.)

The Lambertian model can be considered a special case of the Oren-Nayar
model, with ROUGHNESS = 0.0.


- The Lommel-Seeliger model has its roots in astronomy, where it is used
to model "lunar type" (i.e. rocky or dusty) surfaces, while the
Lambertian model is used for "icy" surfaces, and weighted averages of
the two are used to model anything in between.

To use the Lommel-Seeliger model, specify:

    finish {
      diffuse FLOAT
      lommel_seeliger K
    }

where K specifies the weight of the Lommel-Seeliger model, ranging from
0.0 (pure Lambertian) to 1.0 (pure Lommel-Seeliger)


Have fun, and feel free to go crazy testing!


Post a reply to this message

From: Le Forgeron
Subject: Re: Experimental alternative diffuse models
Date: 31 Mar 2016 15:08:16
Message: <56fd75a0$1@news.povray.org>
Le 31/03/2016 19:27, clipka a écrit :
> oren_nayar ROUGHNESS

ok... what is a good value, excepted for 0.0 which disable it ?

No link to equations, no idea about what is sigma.

For lommel_seeliger, it's clear: from 0 to 1.

It also seems the parser allow both oren_nayar & lommel_seeliger at the same time.
Is it intended ? Is there a fusion of models (when neither is 0) ?


Post a reply to this message

From: clipka
Subject: Re: Experimental alternative diffuse models
Date: 31 Mar 2016 15:26:59
Message: <56fd7a03$1@news.povray.org>
Am 31.03.2016 um 21:08 schrieb Le_Forgeron:
> Le 31/03/2016 19:27, clipka a écrit :
>> oren_nayar ROUGHNESS
> 
> ok... what is a good value, excepted for 0.0 which disable it ?
> 
> No link to equations, no idea about what is sigma.

It's the standard deviation of the facet slopes, and can range anywhere
from 0 to just short of infinity. Something around 0.3 might be a good
place to start.

> It also seems the parser allow both oren_nayar & lommel_seeliger at the same time.
> Is it intended ? Is there a fusion of models (when neither is 0) ?

Strictly speaking, with the current implementation a non-zero
lommel_seeliger setting gives you an average not of the Lommel-Seeliger
and Lambertian models, but of the Lommel-Seeliger and Oren-Nayar models,
with the Lambertian model just being the sigma = 0.0 special case thereof.


Post a reply to this message

From: clipka
Subject: Re: Experimental alternative diffuse models
Date: 2 Apr 2016 12:35:58
Message: <56fff4ee$1@news.povray.org>
Am 31.03.2016 um 19:27 schrieb clipka:

> In a totally strict sense, diffuse reflection is the effect that light
> hitting a surface bounces off in a direction that is entirely
> independent of the angle of incidence. There is essentially just one
> manner in which this can happen, and it is perfectly described by the
> so-called Lambertian model, which is what POV-Ray uses.

I think I wrote nonsense there.

Also, a few more notes:

- My implementation of the Oren-Nayar model turns out to be bugged.

- The mix of Lommel-Seeliger and Lambert is also known as "Lunar-Lambert".


Post a reply to this message

From: And
Subject: Re: Experimental alternative diffuse models
Date: 5 Apr 2016 02:15:01
Message: <web.570356e876d9c5203feafd5e0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 31.03.2016 um 19:27 schrieb clipka:
>
>
> - My implementation of the Oren-Nayar model turns out to be bugged.
>

I like the feature, could I help test it? I have read this model on wikipedia
and thought about it for a while.


Post a reply to this message

From: And
Subject: Re: Experimental alternative diffuse models
Date: 5 Apr 2016 08:55:00
Message: <web.5703b49276d9c5203feafd5e0@news.povray.org>
"And" <49341109@ntnu.edu.tw> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> > Am 31.03.2016 um 19:27 schrieb clipka:
> >
> >
> > - My implementation of the Oren-Nayar model turns out to be bugged.
> >
>
> I like the feature, could I help test it? I have read this model on wikipedia
> and thought about it for a while.

I just tried your new texture. The bigger the sigma the surface appears darker
when applying the same diffuse value. It is from the Oren-Nayar model itself I
have confirmed.

Is this the bug you said?


Post a reply to this message

From: clipka
Subject: Re: Experimental alternative diffuse models
Date: 5 Apr 2016 14:43:30
Message: <57040752@news.povray.org>
Am 05.04.2016 um 14:50 schrieb And:
> "And" <49341109@ntnu.edu.tw> wrote:
>> clipka <ano### [at] anonymousorg> wrote:
>>> Am 31.03.2016 um 19:27 schrieb clipka:
>>>
>>>
>>> - My implementation of the Oren-Nayar model turns out to be bugged.
>>>
>>
>> I like the feature, could I help test it? I have read this model on wikipedia
>> and thought about it for a while.
> 
> I just tried your new texture. The bigger the sigma the surface appears darker
> when applying the same diffuse value. It is from the Oren-Nayar model itself I
> have confirmed.
> 
> Is this the bug you said?

No; since it's an intrinsic property of the model, I don't consider it a
bug.

What I got wrong is the dependence on "sideways" illumination, if you
know what I mean.

In the model there's a term depending on the angle between the light
source and eye directions /projected/ onto the surface (the azimuth
angle, if you like). Normally I should compute the projected vectors,
normalize them, and compute the dot product, to get the cosine of the
angle. But I forgot the normalization step.


Post a reply to this message

From: And
Subject: Re: Experimental alternative diffuse models
Date: 6 Apr 2016 03:55:01
Message: <web.5704bfa076d9c5203feafd5e0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 05.04.2016 um 14:50 schrieb And:
> > "And" <49341109@ntnu.edu.tw> wrote:
> >> clipka <ano### [at] anonymousorg> wrote:
> >>> Am 31.03.2016 um 19:27 schrieb clipka:
> >>>
> >>>
> >>> - My implementation of the Oren-Nayar model turns out to be bugged.
> >>>
> >>
> >> I like the feature, could I help test it? I have read this model on wikipedia
> >> and thought about it for a while.
> >
> > I just tried your new texture. The bigger the sigma the surface appears darker
> > when applying the same diffuse value. It is from the Oren-Nayar model itself I
> > have confirmed.
> >
> > Is this the bug you said?
>
> No; since it's an intrinsic property of the model, I don't consider it a
> bug.
>
> What I got wrong is the dependence on "sideways" illumination, if you
> know what I mean.
>
> In the model there's a term depending on the angle between the light
> source and eye directions /projected/ onto the surface (the azimuth
> angle, if you like). Normally I should compute the projected vectors,
> normalize them, and compute the dot product, to get the cosine of the
> angle. But I forgot the normalization step.


OkOK. That sounds very easy to fix for you.

I derived a solution on what I said the albedo value getting dark when sigma
increase.
I study the formula from the wikipedia. It said A=1-0.5*..., B=0.45*...(Both
rely on the sigma)

And the result albedo seems rho*A + rho*B*(2/3-64/45/pi) instead rho
itself. So maybe you can divide it when apply the diffuse albedo feature.


Post a reply to this message

From: clipka
Subject: Re: Experimental alternative diffuse models
Date: 6 Apr 2016 07:07:31
Message: <5704edf3@news.povray.org>
Am 06.04.2016 um 09:52 schrieb And:

> I derived a solution on what I said the albedo value getting dark when sigma
> increase.
> I study the formula from the wikipedia. It said A=1-0.5*..., B=0.45*...(Both
> rely on the sigma)
> 
> And the result albedo seems rho*A + rho*B*(2/3-64/45/pi) instead rho
> itself. So maybe you can divide it when apply the diffuse albedo feature.

Thanks! That correction factor appears to make a lot more sense than the
hack I had come up with :)

Not too surprisingly, experiments indicate that it does indeed fit like
a glove.


Post a reply to this message

From: And
Subject: Re: Experimental alternative diffuse models
Date: 6 Apr 2016 07:40:01
Message: <web.5704f46d76d9c5203feafd5e0@news.povray.org>
"And" <49341109@ntnu.edu.tw> wrote:
>
> I derived a solution on what I said the albedo value getting dark when sigma
> increase.
> I study the formula from the wikipedia. It said A=1-0.5*..., B=0.45*...(Both
> rely on the sigma)
>
> And the result albedo seems rho*A + rho*B*(2/3-64/45/pi) instead rho
> itself. So maybe you can divide it when apply the diffuse albedo feature.

Should say:

For a small area 'da', incident light irradiance 'E0', and if the incident angle
'theta_i' is fixed, it will receive E0*da*cos(theta_i) energy per second. then
emit
rho*E0*da*cos(theta_i)*A
+rho*E0*da*B/pi*(
                 sin(2*theta_i)*(theta_i/2 - sin(2*theta_i)/4)
                +2*sin(theta_i)*(1/3 - pow(sin(theta_i),3)/3)
)
energy per second.


Then I apply a condition that a homogeneous hemisphere lighting, equivalent to a
fixed incident radiance 'Li', then the small area 'da' receives Li*pi*da energy
per second, emit rho*Li*pi*da*A + rho*Li*da*B*(2*pi/3-64/45) energy per second.
So get the actual albedo rho*A + rho*B*(2/3-64/45/pi).


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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