Fixed Subscattering on Switches

I’ve done a small update on the plastic switch material. These switches are made of a semi-transparent material, a pretty old type of plastic. An obvious choice is using the Unreal Engine 4 subsurface shading model (subscattering model), though previously they still looked ugly. The change is very simple, but it makes them look significantly better – I’ve added a gradient in opacity along the vertical distance of the switch. This reflects the effect that more light goes through the top than through the bottom (as bottom of the switch is sitting inside its slot, covered from all sides).

Note that just like all other pictures on this blog, all pictures are preliminary and a work in progress. They do not reflect the final quality!

So with the new material, there is a gradient in color of the subscattered light (color of light that passed through the bulk of the switch material), simulating the effect that there is less light coming through the bottom part of the switch. In all pictures below, the right side is the old material (with no gradient in scattered light color and intensity).

The effect is much more prominent when the switch head is positioned against a light:

The actual implementation is trivial and required very little change in the base material. The color of subscattered light is now linearly interpolated between two preset values based on blue channel of the objects vertex color (with red and green colors being reserved for other functions when vertex color is used for masking). The switch is just painted yellow (full red, full green, no blue) at the bottom, creating the linear gradient as vertex color is interpolated between vertices:

In addition to the subscattering materials, I’ve also made a significant overhaul in how edge wear layer works. Now it’s possible to (optionally) mask edge wear on the object using vertex colors, to create areas where there is more or less edge wear. It can also be used in boosting mode to introduce extra wear where there usually is none.