Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glossy-diffuse slab description as a gloss layer is possibly confusing #141

Closed
portsmouth opened this issue Nov 14, 2023 · 3 comments
Closed

Comments

@portsmouth
Copy link
Contributor

portsmouth commented Nov 14, 2023

We currently write in the spec:

The glossy-diffuse slab represents a dielectric with rough GGX microfacet surface BSDF, embedding a semi-infinite bulk of extremely dense scattering material.

This is the model we want to use physically, i.e. the slab is like the infinitely dense limit of the subsurface.

But then we say:

We choose to model this concretely as a layer of dielectric “gloss” on top of an opaque slab with a diffuse BRDF:

The reason we opted to describe glossy-diffuse as layer(diffuse, gloss) is then at least it's clear what the base color/roughness mean (i.e. the color and roughness of the Oren-Nayar base).

If you want to think of it instead as a dense subsurface inside dielectric, it's really not clear what base color/roughness should mean for the properties of the subsurface (e.g. there is no more Oren-Nayar model going on, so what is the roughness doing -- something like "rough volume", but that's not standard). Also if we did that with base color being the volume albedo say, technically the scattering would cause a color shift, requiring remapping (like the actual subsurface, but in some infinite density limit).

With the existing description saturation should occur for this layer too, due to the bounces within it. (And the coat would just add further saturation). That's not completely unrealistic, since even in the volumetric model some saturation will happen due to TIR and multiple scattering.

So I actually don't know what the best way to describe it is. Possibly the existing description is the best option given the currently available models. We might want to say though that we assume some remapping is done so that the supplied base color appearance is produced in some sense. How to define that so it is not incoherent I'm not sure though.

@portsmouth portsmouth changed the title Glossy-diffuse slab description as a coat layer is possibly confusing Glossy-diffuse slab description as a gloss layer is possibly confusing Nov 14, 2023
@peterkutz
Copy link
Contributor

We might want to say though that we assume some remapping is done so that the supplied base color appearance is produced in some sense.

This type of approach seems reasonable to me. It seems like "diffuse reflection" can be caused by a variety of different underlying mechanisms (e.g., microfacets, volumetric scattering, spongy internal structure, etc.) and from an artist's perspective it doesn't seem that important which one is happening. The important thing seems to be that there's some dielectric substance that exhibits specular reflection from its outer surface and diffuse reflection from below that. The overall vdiffuse reflection has some user-specified color, even though the underlying scattering events that lead to the diffuse distribution of light might have different colors. At a high-level, I feel like it's fine for the "roughness" to define the overall shape of the diffuse lobe without enforcing some low-level physical structure, but I see the problem of making the specification rigorous and clear.

If we're using Oren–Nayar for the BRDF but we don't want to say the roughness parameter represents a literal microfacet roughness, maybe we could consider describing the effect of the roughness phenomenologically instead, for example describing it as "retroreflection" instead of "roughness".

@portsmouth
Copy link
Contributor Author

portsmouth commented Dec 13, 2023

This type of approach seems reasonable to me. It seems like "diffuse reflection" can be caused by a variety of different underlying mechanisms (e.g., microfacets, volumetric scattering, spongy internal structure, etc.) and from an artist's perspective it doesn't seem that important which one is happening. The important thing seems to be that there's some dielectric substance that exhibits specular reflection from its outer surface and diffuse reflection from below that.

The overall diffuse reflection has some user-specified color, even though the underlying scattering events that lead to the diffuse distribution of light might have different colors. At a high-level, I feel like it's fine for the "roughness" to define the overall shape of the diffuse lobe without enforcing some low-level physical structure, but I see the problem of making the specification rigorous and clear.

Given the current models, I still think it makes the most physical sense to model "glossy-diffuse" as a dielectric layer on top of an Oren-Nayar (i.e. Lambertian microfacet) base.

But agreed it's a good idea to think about it more from the point of view of the end-goal of the artist, who wants ultimately to dial in a particular observed base color and highlight/lobe shape. For artistic purposes we can require that the base_color specified by the user matches the appearance (in some well-defined way), and arrange for that to be the case given the physical model.

What we could say for example is simply that we define the physical base albedo to be the value which makes the directional albedo of the coated base (at normal incidence say), equal the specified base_color (accounting in principle for the full light transport). This is similar in spirit to the color matching we attempt to impose in the subsurface remapping.

Note

This seems appropriate to do for the base, though for the coat I think it still makes sense to allow for the physical darkening to be applied (though possibly optionally), as that is a kind of secondary, realistic physical effect that may or may not be wanted artistically (e.g. to simulate varnishes, wetness, etc.). While the color of the base should be something that is directly specified without any additional darkening happening.

Then if implementations (hypothetically) did completely physically correct darkening due to bounces in the glossy layer, the reflection should perfectly match the desired base_color at normal incidence. (And we can hope to possibly later move to a more realistic model which is derived from the high/infinite density limit of a "rough subsurface", with some remapping that does essentially the equivalent, i.e. given an effective desired multi-scatter albedo compute the physical subsurface which implements that).

In practice of course people will need to use some kind of approximation to get a tractable BRDF. In my notes posted on Slack I derived a formula for this in the case of a smooth coat (here "gloss") and Lambertian base:

image

(where $R(1)$ in this -- the directional albedo of the coated base -- would be the base_color, and $E_F$ is the Fresnel factor averaged over the hemisphere, which can be well-approximated). This is only correct for this smooth, Lambertian (i.e. zero diffuse roughness) limit though.

We could also just point out that in practice, the standard albedo-scaling (reciprocal or non-reciprocal) can also be considered a semi-reasonable approximation of this. For example for a Lambertian base it reduces at normal incidence to albedo
$$F_0 + \rho_d(1 - F_0) = \rho_d + F_0 (1 - \rho_d)$$
which is quite close to $\rho_d$ for typical IORs, e.g. $F_0 = 1/9$ for $\eta=2$ .

Or alternatively, a better approximation (if doing non-reciprocal albedo scaling) would be to demand

$$F_0 + \rho_d(1 - F_0) = R(1)$$

i.e. set the base albedo to

$$\rho_d = \frac{R(1) - F_0}{1 - F_0}$$

(where $R(1)$ is the base_color), which would satisfy the requirement for the normal incidence albedo to equal the base color (within the albedo-scaling approx.).

Warning

An issue with this whole approach though is that, as noted in the pasted snippet above, it doesn't make sense to ask for a color component $R(1) < F_0$.

As the Fresnel reflection from the gloss will not allow this. So perhaps one could instead have the desired base color be expressed as a lerp factor between $F_0$ and 1 then, i.e. require (with $C$=base_color * base_weight):

$$R(1) = \mathrm{lerp}(F_0, 1, C) = (1-C) F_0 + C \ .$$

Then e.g. in albedo-scaling approximation,

$$F_0 + \rho_d(1 - F_0) = R(1)$$

so we require

$$\rho_d = \frac{R(1) - F_0}{1 - F_0} = C$$

Which is what we currently assume in the suggested albedo scaling approximation for glossy-diffuse in the spec (i.e. equation 30 here, since we say that base_color is the diffuse BRDF "reflection albedo color" and base_weight is a scalar multiplier of that).

So maybe this is a reasonable way to get consistency between the artistic requirements and the physical model, i.e. say:

The factor base_color * base_weight = $C$ defines the desired observed color at normal incidence (directional-albedo) $R$ of the glossy-diffuse slab, by the formula $R = \mathrm{lerp}(F_0, 1, C)$.

In other words, a black base_color means you see only the Fresnel specularity. A white base_color means it is 100% reflective due to a white base.

This is totally consistent with the resulting behavior one currently gets using albedo-scaling approximation, and could be considered a natural generalization of that to a more physically correct light transport model of the glossy-diffuse layer model.

@jstone-lucasfilm
Copy link
Member

Closing this issue, which is now addressed in #165.

jstone-lucasfilm pushed a commit that referenced this issue May 10, 2024
This PR adds a detailed discussion to the spec of the coat darkening effect (incorporating the ideas discussed in #136 and #141), with:
  - introduction of a new `coat_darkening` parameter (defaulting to 1, the physically correct case).
  - a physical definition of how this parameter operates to reduce the darkening (via boosting of the base albedo)
  - a suggested practical implementation of the darkening factor for the base lobe, taking into account the IOR of the coat, and also the roughness of the base (based on the derivations and discussions linked elsewhere).
  - A suggested implementation of the darkening of colored coats at grazing angles due to longer path length in the absorbing medium.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants