AcademySoftwareFoundation / OpenPBR

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

Should non-physical tinting affect lower layers? #81

Open lukasstockner opened 1 year ago

lukasstockner commented 1 year ago

The spec currently mentions that if specular_color is used to affect the color of the specular reflection, he underlying layers (diffuse/SSS/transmission) should be tinted according to the complementary color to preserve energy.

This makes sense from a physical perspective. However, from what I can tell, these parameters are intended for artistic control rather than physically motivated. Therefore, I'd argue that affecting the lower layers is unintuitive and unexpected - for example, if a user wants to achieve a white object with a green specular highlight, they'd need to set the base_color to something like (0.96, 1.0, 0.96). Instead, I'd suggest to scale the lower layer's intensity according to the maximum value across components, in order to preserve energy without tinting it.

portsmouth commented 1 year ago

There isn't an easy way to express this in a physically-based manner though, without dropping down to some specific approximation (like albedo scaling with some ad-hoc modification).

In the spec currently we say that the specular_color modulates the dielectric Fresnel factor, and thus:

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).

Even that doesn't really make sense physically, because the IOR of the dielectric is inconsistent with this modulated Fresnel factor (as noted).

Perhaps the most physical thing would be to say that specular_color (or specular_tint) is effectively modelling an extra, thin-film of purely absorbing index-matched material.. so the specular_color just multiplies the highlight and the base.

Though then one couldn't produce a green specular lobe with an un-tinted (e.g. white) base lobe. That seems rather unphysical though, so do we really want to support it?

portsmouth commented 6 months ago

@lukasstockner Just to note, the changes we propose in https://github.com/AcademySoftwareFoundation/OpenPBR/pull/157 explicitly decouple the underlying layers from the specular_color tint.

We now say:

image

This eliminates any complementary color due to the specular_color tint.

This is still unphysical (we are artificially tinting a Fresnel factor so losing energy), but in a really clear, minimal way that is easy to account for theoretically.

portsmouth commented 6 months ago

.Addressed in https://github.com/AcademySoftwareFoundation/OpenPBR/pull/157, can be closed.