AcademySoftwareFoundation / OpenPBR

Specification and reference implementation for the OpenPBR Surface shading model
Apache License 2.0
496 stars 21 forks source link

specular_color should not generate a complementary color #145

Closed portsmouth closed 6 months ago

portsmouth commented 12 months ago

Currently it does, because we say:

The specular_weight and specular_color parameters modulate the Fresnel factor.. The light transmitted through the dielectric will be compensated accordingly to preserve the energy balance (thus generating a complementary color if specular_color is not white).

We had a long discussion on Slack, and agreed that this is not the behavior that is wanted (most likely). Really one wants only the specular reflection to be tinted, not the base. This is also something that we wanted to fix up in the Standard Surface model. So the question for OpenPBR is how to describe that physically and unambiguously.

For a dielectric interface, it is physically unambiguous to stipulate that only the Fresnel reflection (from the top side) is tinted. This tinting is obviously ad-hoc/unphysical, but harmless as it merely multiplies one scattering mode (marked in red below) by a factor, effectively deleting some energy by an unspecified mechanism. Also it makes it totally clear what the effect on the light transport is, for an implementation.

image

Furthermore for the case of a layer of dielectric on top of a base, it is natural to interpret the specular weight as controlling the presence/coverage of the layer.

With weight w and color tint C, the resulting lobe combination would be approximated as:

w*C*fspec + (1 - w*E[fspec])*fbase

(where E is the reflectance). This is also how MaterialX does its layering throughput calculation.

For the base dielectric (e.g. a solid piece of glass) there is only the dielectric interface (no base), so only the Fresnel tinting applies (and we can interpret the specular weight in this case just as a multiplier of the tint), i.e. the lobe combination looks like:

w*C*fbrdf + (1 - E[fbrdf])*fbtdf

(so physically, all the regular transmission effects, e.g. TIR and Snell's window seen from below, and the refraction of the interior seen from above, are totally unaffected by the specular color or weight).

We anyway need to clarify this in the spec, to make it explicit how the specular color and weight parameters actually modify the physical configuration to achieve the desired effect.

portsmouth commented 9 months ago

See #152 for related discussion of how the weight should be interpreted.