





 
 




 
 


I've just released an experimental version of POVRay implementing two
alternative models for diffuse reflection, besides the classic socalled
Lambertian model:
https://github.com/POVRay/povray/releases/tag/v3.7.1alpha.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
socalled Lambertian model, which is what POVRay 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 nondirectionality 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 OrenNayar model is based on the presumption that the surface is
comprised of microscopic facets of somewhat random orientation that form
Vshaped 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) OrenNayar 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 OrenNayar
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 OrenNayar
model, with ROUGHNESS = 0.0.
 The LommelSeeliger 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 LommelSeeliger model, specify:
finish {
diffuse FLOAT
lommel_seeliger K
}
where K specifies the weight of the LommelSeeliger model, ranging from
0.0 (pure Lambertian) to 1.0 (pure LommelSeeliger)
Have fun, and feel free to go crazy testing!
Post a reply to this message


 
 




 
 


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


 
 




 
 


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 nonzero
lommel_seeliger setting gives you an average not of the LommelSeeliger
and Lambertian models, but of the LommelSeeliger and OrenNayar models,
with the Lambertian model just being the sigma = 0.0 special case thereof.
Post a reply to this message


 
 




 
 


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
> socalled Lambertian model, which is what POVRay uses.
I think I wrote nonsense there.
Also, a few more notes:
 My implementation of the OrenNayar model turns out to be bugged.
 The mix of LommelSeeliger and Lambert is also known as "LunarLambert".
Post a reply to this message


 
 




 
 


clipka <ano### [at] anonymousorg> wrote:
> Am 31.03.2016 um 19:27 schrieb clipka:
>
>
>  My implementation of the OrenNayar 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


 
 




 
 


"And" <49341109@ntnu.edu.tw> wrote:
> clipka <ano### [at] anonymousorg> wrote:
> > Am 31.03.2016 um 19:27 schrieb clipka:
> >
> >
> >  My implementation of the OrenNayar 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 OrenNayar model itself I
have confirmed.
Is this the bug you said?
Post a reply to this message


 
 




 
 


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 OrenNayar 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 OrenNayar 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


 
 




 
 


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 OrenNayar 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 OrenNayar 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=10.5*..., B=0.45*...(Both
rely on the sigma)
And the result albedo seems rho*A + rho*B*(2/364/45/pi) instead rho
itself. So maybe you can divide it when apply the diffuse albedo feature.
Post a reply to this message


 
 




 
 


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=10.5*..., B=0.45*...(Both
> rely on the sigma)
>
> And the result albedo seems rho*A + rho*B*(2/364/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


 
 




 
 


"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=10.5*..., B=0.45*...(Both
> rely on the sigma)
>
> And the result albedo seems rho*A + rho*B*(2/364/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/364/45) energy per second.
So get the actual albedo rho*A + rho*B*(2/364/45/pi).
Post a reply to this message


 
 




 