AcademySoftwareFoundation / OpenPBR

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

Purpose of base_weight and specular_weight? #76

Open lukasstockner opened 1 year ago

lukasstockner commented 1 year ago

From what I can see, both of these inputs are only used as multipliers for base_color and specular_color respectively.

If that is the case, they appear to be redundant, since the same effect could be achieved by just adjusting the color inputs instead.

portsmouth commented 1 year ago

I agree that base_weight and specular_weight are both not strictly needed, as they are just multipliers to the base_color and specular_color.

I'd like to suggest we remove those parameters, and then rename specular_ior_level to specular_weight. Then the new specular_weight functions similarly to the old control, but in a more physically-based fashion (i.e. dials reflectivity between [0,2] * the unmodulated Fresnel, via IOR modulation).

This doesn't remove any functionality as base_color and specular_color can still be multiplied if needed.

ZapAndersson commented 10 months ago

I strongly disagree. Having a weight for each parameter is extremely useful, and I am posting an issue https://github.com/AcademySoftwareFoundation/OpenPBR/issues/134 where I advocate for a weight for every section.

Also note that the energy conservation math applies to the weights, not to the colors. So having a specular weight of 0 means no energy goes to the specular layer, and no attenuation of the diffuse will occur, whereas a specular weight of 1 but a black specular color creates a fully absorbing specular layer and the diffuse will be attenuated accordingly.

(At least this was the case for the great grandfather of OpenPBR, the 3ds max Physical Material. This is key, because you do not want adding a checkerboard to the specular color affect the diffuse level, or even worse, mapping a red-green checkerboard to the specular color generate some kind of bizzare complementary-color tinting of the diffuse. Quite the opposite, only the weight should go into the attenuation of the lower layer, so the attenuation is achromatic, without unexpected complementary-color effects, and without unexpeceted intensity changes just beause the mapped specular colors intensity happened to change)

andre-ilm commented 9 months ago

If the only reason for the weight is to prevent coloured transmission affecting the slab below, then there are other ways that this could be accomplished. Having the weight parameter affect the slab below but not the colour one could have problems if the colours are not normalised.

portsmouth commented 9 months ago

See https://github.com/AcademySoftwareFoundation/OpenPBR/issues/145 for more discussion of the physical meaning of specular color and weight.

As described there the "energy conservation math" works, for the case of the glossy-diffuse base (which produces the primary "specular" lobe), by having the specular weight mean the presence weight of the dielectric "gloss" (or perhaps equivalently the embedding dielectric of the diffuse medium). This makes sense because when the specular weight is zero, the reflection from the diffuse base should be unaffected. The specular color tint is applied instead as a non-physical tint to the Fresnel reflection factor for rays incident from above (i.e. the color tint is not physical absorption, it is just a non-physical tweak to the Fresnel factor).

As noted, for bulk dielectric where refraction occurs (and SSS), it doesn't seem to make sense to use this intepretation of the weight (as we don't want specular weight to kill off the refraction effects, seen from above or below, which it should if it functioned as a presence weight for the bulk dielectric). In that case, the weight should instead just be a multiplier to the color tint.

(While base weight is just purely a convenience to allow the base albedo of diffuse/metal to be textured with a 0-1 weight. It can be rationalized at least as a consistency thing to have every "lobe" controlled by the parametrization have some scalar weight associated with it, which dials the effect roughly on or off).

Note, we need to modify the spec to clarify these interpretational things.

virtualzavie commented 3 months ago

I think this issue is reasonably addressed by #157?