[Bf-committers] BRDF conversion - Was Farsthary anouncement
Yves Poissant
ypoissant2 at videotron.ca
Fri Feb 6 03:40:46 CET 2009
From: "Brecht Van Lommel" <brecht at blender.org>
Sent: Thursday, February 05, 2009 2:03 AM
> Heh, the thing I thought may be difficult is turning the physical ones
> into legacy ones, so they would still give reasonable results when using
> algorithms that rely on splitting things up (for example irradiance
> caching, SSS, baking GI for games, .. ). I have never tried this though so
> I wouldn't know.
>
> The other way around seem quite doable to me _if_ you don't expect those
> things to give physically correct results, which I think is reasonable.
Let's examine material properties that are related to reflections and not
bother with transparency and transmission for now. We will already have
enough for now.
Legacy material parameters are many :
ka - controls the amount of ambience component contribution
kd - controls the amount of diffuse component contribution
ks - controls the amount of specular component contribution
es - controls the tightness of the specular component
kr - controls the amount of reflection component contribution
dr - controls the distance at which the reflections are no more visible
And let's not care about the material color for now. Compared to that, a
simple BRDF is controled by one single parameter :
r - controls the material microscopic roughness.
The only control you have on a BRDF is the distribution of orientation of
the microfacets of the material's surface. That is admitedly not much. But
like I mentioned earlier, the power of physically plausible materials is
that the BRDF (in that case BSDF) can be stacked (or layered).
The problem, then, is finding a reliable function that will map those 6
legacy parameters into that single physical one. So let's examine each one
of those legacy parameters and see if we can make any intelligent deduction
from their values.
ka - This parameter is supposed to control the amount of ambient light
hiting the material. Essentially, that would be all the indirect
illumination coming from the environment excluding the explicitly placed
lights in the scene. All this parameter value can tell us, is essentially
how much indirect illumination we assume we have in the environment. And
this indirect illumination is assumed to be perfectly uniformly distributed
all over (except when AO is used but AO is not a material property).
Whatever its setting, the "quality" of the ambience shading is always that
of a perfectly rough (lambertian) surface so if we were to use this
parameter to set the BRDF roughness, we would have to conclude that the
material roughness is always 100%. Clearly, this is generally not the case.
kd - This parameter is supposed to control the amount of diffuse reflection
of the lights only. Whatever the setting of this variable, the shading
falloff of the diffuse part always follows the lambertian (cosine) law
(Oren-Nayar and Minaert shaders modify that though) so if we only had the
diffuse contribution parameter to rely onto, we would have to conclude that
the material is perfectly rough but absorbs more or less the light that it
receive. In fact, this parameters comes multiplying the material color but
it does not modify its surface roughness. Diffuse roughness is constant at
100%.
ks - This parameter is supposed to control the strength of the reflection
coming from the lights in the scene. Notice already, that we now have two
parameters that are both supposed to control the amount of reflection from
the lights in the scene: kd and ks. Except that ks is assumed to be related
to a smooth material. Not a perfectly smooth not a perfectly rough material
but a controlable smoothness of the material. Like kd, this parameter does
not control the apparent roughness or smoothness of the surface though. Only
its absorption of the light that hits the surface. According to physically
plausible prrinciples, kd and ks should be interdependent and should both be
controled by one single parameter even though they are related to two
different material roughness properties. This seemingly contradiction is
solved with double layer BSDF.
es - This is a parameter that truely changes the apparent roughness of the
surface and this is our most reliable parameter for determining material
roughness. In fact, several 3D application convert the specular exponent to
roughness when they want to use legacy material properties in a physically
plausible rendering engine. Jim Blinn was the first, AFAIK, to publish a
function to convert Phong exponents to roughness. I've seen all kind of
conversions, some quite complex and some very simple like just taking the
reciprocal of the exponent as the roughness. At work, I have my own. None of
all those conversion functions are better than the other and the perfect
conversion does not exist. The reason is that although it seems a good
candidate for judging the intended roughness, in practice it is not that
reliable for several reasons:
-- The strength of kd vs ks comes modifying the apparent roughness given by
es. Since the material parameters were tweaked so the render looks
acceptable, there is no way telling from es alone what was the intended
roughness.
-- Legacy material designers used to force the width of the specular
component and increase ks to compensate for the lack of area lights in the
scene. Larger highlights would simulate the reflection of a larger light
instead of the point light that was actually placed in the scene.
-- Legacy material designer were designing their material with non gamma
corrected displays and the resulting highlight width is usually much larger
than it should have been.
-- The actual material look that was seeked for was impossible to obtain
with the parameters at hand and the end result is something that just looked
acceptable and workable.
kr - This parameter is supposed to control the amount of reflection coming
from the environment but not from the lights in the scene. Notice how this
is similar to ka. The difference is that kr addresses the reflection from a
perfectly smooth material while ka addresses the reflection from a perfectly
rough material. Of course, a material cannot be perfectly smooth and
perfectly rough at the same time but having both a ka and a kr on legacy
materials is not uncommon. What deduction can we make about the roughness of
the material in face of this contradiction? Not much.
dr - This parameter controls the reflection falloff distance. That is the
distance of the object being reflected at which its image is
undistinguishable anymore. This actually can tell us a lot about the surface
roughness. In human vision, there is a solid angle of bluriness where the
observed objects become so blurry that we cannot make sense of them anymore.
As this solid angle increases, the distance at which objects are too blurry
decrease. This solid angle represent the spread of the reflection pattern
from semi smooth surfaces. This could be a relatively reliable parameter to
decide on the equivalent roughness. The problem is that this parameter is
very rarely set. And even when it is set, it is usually set to compensate
for lack of HDR in the surrounding objects and as a result, this distance is
usually set too long. Here again, lack of gamma correction makes this
parameter miss the mark even further.
So we end up with a lot of parameters that gives us contradictory
information about the intended roughness of the material. The reliable
conversion from legacy parameters to hpysical parameter is hard. Very hard
and unreliable.
Now, let's turn to the reverse conversion, that is converting roughness to
legacy properties.
I already mentioned that the parameters kd and ks are interdependent and
related and should be controled by one single parameter. But it is less
obvious that the parameters ks and es are related. They are related by the
law of conservation of energy. As the reflection pattern become tighter (the
highlight narrower), the same light energy is reflected in a narrower solid
angle and become very bright. Conversely, as the material becomes less
smooth, the reflection pattern solid angle spreads wider and the reflected
energy also spread wider so the highlight brightness becomes duller. The
equation that links ks and es in the Phong or Blinn-Phong shaders are called
BRDF normalization (see "Real-Time Rendering", 3rd Edition, page 260). So we
now have 3 legacy parameters: kd, ks and es that could and should be
controled by one single parameter. And since we already know how to convert
roughness to specular exponent, we could choose the roughness parameter to
control all those 3 parameters.
If you look at it, dr and es are also directly related. They are both
directly related to the reflection pattern solid angle spread. So that makes
4 legacy parameters that could be controled by the single roughness
parameter.
We are left with ka and kr. I think that anyone who have worked with legacy
renderer know well enough that in most cases, ka should always just be left
at zero or at least to a very low value. Inside a physically plausible
rendering engine, there is no interpretation for ka anyways so this
parameter should be ignored entirely.
As for kr, the perfectly smooth reflection from a surface that also have
partially smooth properties and perfectly diffuse properties seems like an
aberration. But it is not so. In fact, there are materials that act exactly
like that. Those materials can be modeled with double layer of BSDF. And in
fact, double layer materials can much better mimick other seemingly
incongruities or contradictions of legacy materials. But that is another
story.
Yves
More information about the Bf-committers
mailing list