AcademySoftwareFoundation / OpenPBR

Specification and reference implementation for the OpenPBR Surface shading model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Oren-Nayar roughness parametrization is not sufficiently clear

portsmouth opened this issue · comments

We say:
image

But the Oren-Nayar model actually involves a parameter $\sigma$ which parametrizes the roughness, and we don't say exactly how this is related to the roughness parameter in our model.

I suggest we follow the approach from Mitsuba here:

        /* Conversion from Beckmann-style RMS roughness to
           Oren-Nayar-style slope-area variance. The factor
           of 1/sqrt(2) was found to be a perfect fit up
           to extreme roughness values (>.5), after which
           the match is not as good anymore */

        const Float conversionFactor = 1 / std::sqrt((Float) 2);

        Float sigma = m_alpha->eval(bRec.its).average()
            * conversionFactor;

So to be precise, we take

$$ \sigma = r/\sqrt{2} $$

where $r$ is the base_roughness in $[0,1]$. This is the scheme used in Arnold for example. If there are no objections, we can just specify the same relationship in OpenPBR.

Another good reference point for implementations of Oren-Nayar Diffuse is Open Shading Language, which is often followed by other shading languages when they need a standard reference.

Here's the language that we use to describe this in the various MaterialX implementations of Oren-Nayar Diffuse:

Based on the OSL implementation of Oren-Nayar diffuse, which is in turn based on https://mimosa-pudica.net/improved-oren-nayar.html.

https://github.com/AcademySoftwareFoundation/MaterialX/blob/main/libraries/pbrlib/genglsl/lib/mx_microfacet_diffuse.glsl#L3

Arnold uses the model from that blog post too, but with the mapping described, rather than the one from the blog post which is:

$$\sigma = \pi r \ .$$

With that mapping, we (actually, Eugene d'Eon) found:

"The impact of this to the user is that only the portion diffuse_roughness in [0, 0.2] corresponds to a realistic Beckmann surface. For 80% of the parameter range, the model basically produces a nonlinear change in brightness that doesn't correspond to the underlying physics of the spiky surface and doesn't really buy the user anything but an unwanted change in diffuse color they need to correct for. ... For the alpha=4.44 (roughness 1) end of the range, the surface is so spiky that the reference begins to look like the sheen model that approximates a forest of fibers along the surface normal covering the surface."

Hence the switch to $\sigma = r/\sqrt{2}$.

It seems like some more investigation is needed here to verify the best mapping. Also, I'm a bit uncomfortable using a non-peer-reviewed blog post as the source for the model (OK in an internal implementation perhaps, but not in a public specification), even though the results might be good. Maybe there is something equivalent in the published literature?

Here's the way that Open Shading Language references the blog post, with a clarification about which of the two implementations in the post is used:

// Simplified math from: "A tiny improvement of Oren-Nayar reflectance model"
// by Yasuhiro Fujii
// http://mimosa-pudica.net/improved-oren-nayar.html
// NOTE: This is using the math to match the original ON model, not the tweak
// proposed in the text which is a slightly different BRDF

https://github.com/AcademySoftwareFoundation/OpenShadingLanguage/blob/35820fc99b3ad285308ce3ad0389ef84469ce929/src/testrender/shading.cpp#L472

So far, I'm not aware of any more formal way to reference this implementation, but I'd love to hear from others if they know one.

Just a few pertinent slides re. Oren-Nayar and its roughness parameter s vs. GGX+Smith and its α from Earl Hammon, Jr. in PBR Diffuse Lighting for GGX+Smith Microsurfaces

image
image

Is it out of the question at this point to consider alternative diffuse models that would mesh naturally with GGX?

Is it out of the question at this point to consider alternative diffuse models that would mesh naturally with GGX?

Indeed, we're discussing some such alternative models on Slack, with Eugene d'Eon (feel free to join in obviously). His model is based on a generalization of Smith model beyond heightfield to a model of a "porous" medium with 3d structure, as far I understand (so looks a bit more volumetric than e.g. Oren-Nayar).

From my point of view, the traditional Oren-Nayar model is not bad visually i.e. fulfills the goal of being more realistic than naive Lambert model, as explained in the original O-N paper (and fairly simple and efficient, which is a plus), though it does suffer from some subtle artifacts and not-so-subtle darkening, both of which can be fixed though with some simple modifications (e.g. building on model of Fujii mentioned above).