[tuhopuu-devel] Re: Minnaert diffuse shader
Jonathan Merritt
j.merritt at pgrad.unimelb.edu.au
Thu Jan 13 13:41:13 CET 2005
Hi Everyone,
In the absence of further comments, I've played with the Minnaert model
a bit more and committed my latest changes. You can see an example of
the diffuse shading models here:
http://www.warpax.com/temp/diffuse-test.png
Sorry about my choice of a really gaudy purple. It's getting late over
here, so I don't feel like fixing it. Please make your own demo images,
and post them to Elysiun! :-)
The darkness parameter of the Minnaert shader can now take on both
positive and negative values. Positive values tend to look more like a
specular model, or a metal, because they darken the "glancing edges" of
an object. Negative values look more like velvet, because they lighten
the edges. (See the demo image.)
A major problem with all versions of the shader (mine, nVIDIA's and the
"original"), is that in the "velvet" mode, they all show very large
peaks in intensity around the edges of the object (caused by raising
small positive numbers to a negative power). This caused some quite
unsightly artifacts in the original patch version. To combat these
artifacts, I have used a "clamp and attenuate" scheme. The algorithm
for i is:
i = nl * pow( MAX2( nv*nl, 0.1 ), darkness );
if (darkness < 0.0)
i /= pow( 0.1, darkness );
As you can see, the first part is the ordinary Minnaert shader with
slight clamping of of low nv*nl. The second part isolates the "velvet"
case, and reduces the overall brightness so that the rim will never be
greater than 1.0 brightness (maybe I've overdone this darkening - it can
be adjusted if necessary?). The overall shader is still C_0 continuous
at darkness = 0, with darkness = 0 being identical to the Lambertian shader.
I'm now wondering: "why limit this kind of attenuation to the Lambertian
case alone?" ... why not attenuate any diffuse shader (eg: Oren-Nayar,
Toon, etc.) in the same kind of way? :-)
Anyway, please play with this and tell me what you think! :-)
Jonathan Merritt.
More information about the tuhopuu-devel
mailing list