The existing random walk subsurface scattering code worked like this:
1. Perform lambertian diffuse transmission bounce into volume
2. Trace path until we hit the surface again
3. Perform lambertian diffuse transmission bounce out of volume
This has the advantage that unlike other approaches for handling the interface
(e.g. not doing anything by treating it as transparent), the appearance
of the BSSRDF converges to a classic diffuse BSDF as the radius goes to zero,
so we can easily e.g. swap it out for a diffuse BSDF for secondary bounces.
Also, it's very straightforward to implement, and doesn't need much storage
(which is important for GPU performance).
However, it also has downsides - for example, it's not particularly physically
plausible, and it leads to excessive white edges.
Therefore, this commit replaces the entry bounce with a GGX refraction bounce.
The exit bounce remains lambertian, because
a) This way the BSSRDF still converges to a lambertian BSDF for radius->0
b) This way we avoid having to store a bunch of extra data in the path state
c) In materials that are well-described by subsurface scattering models,
the path will generally encounter many internal bounces. Therefore, the
incoming distribution at the exit interface is basically diffuse already
anyways, so the impact is much lower than for the entry bounce.
d) It looks good, and that's what really matters in the end ;)
Previously, the Principled BSDF used the Subsurface input to scale the radius.
When it was zero, it used a diffuse closure, otherwise a subsurface closure.
This sort of scaling input makes sense, but it should be specified in
distance units, rather than a 0..1 factor, so this commit changes the unit.
Additionally, it adds support for mixing diffuse and subsurface components.
This is part of e.g. the OpenPBR spec, and the logic behind it is to support
modeling e.g. dirt or paint on top of skin.
For typical materials, this will be either zero or one (like metallic or
transmission), but supporting fractional inputs makes sense for e.g.
smooth transitions at boundaries.