Thursday, March 12, 2015

Unreal Engine 4.7 New "Two-Sided Foliage" Shader

Along with some other great updates, UE 4.7 now has a  "Two-Sided Foliage" shader. This is a great enhancement to the traditional Two-Sided option for "Default Lit" shaded materials. This shader enables sub-surface coloring on the back sides of thin planar geometry such as leaf planes and grasses adding much more realism. Below are 2 examples of the effect. The first is a screen capture of a mid-poly tree using "Branchlets" (as I call them) or "Fronds" (as with SpeedTree) made up of planar mapped branches, twigs and leaves on a single surface rendered in UE 4.4 without the Foliage shader option. A little "Emissive" self illumination has been added to help show both sides of the surfaces. Not an ideal solution but you get the idea. Also, this first render did NOT use a skylight. Just an omission on my part, not to demonstrate any particular effect.
A standard "Default Lit" 2-sided shader in UE 4.4

This 2nd image is the same tree using the new Foliage shader with the Sub-Surface effect. Notice how nicely lit the backs of the leaves are. This scene does also contain a skylight so there is a little indirect illumination as well, but it is not responsible for the sub-surface effect.
"Two-Sided Foliage" shader from UE 4.7

Here's a screen shot of the material setup. The Diffuse texture is also used to dictate the sub-surface illumination. Wiring it through a multiply parameter allows for some fine tuning. Epic recommends that you use perhaps a separate texture for this that has more contrast to dictate how the sub-surface effect varies within the texture map (twigs, veins, etc.). Cranking up the Multiply effect on the Sub-Surface Color can eventually wash out the effect much above 3 or 4. The Multiply parameter is not required on the Diffuse property itself but I like the added control to adjust the look.
A material using the new "Two-Sided Foliage" shader in UE 4.7

Below are also 2 screen shots "in game" of the tree in UE 4.4 and then in 4.7 Again, there was no skylight used in the UE 4.4 sample and perhaps a little too much "Emissive Color". In addition, a simplified Normal map was used, just the diffuse shader run through the nVidia filter in Photoshop. In the 4.7 sample a proper Normal map was used to specify and enhance the random orientation of the leaf normals, producing a far superior looking tree without any additional enhancement.

Tree in Unreal Engine 4.4 with standard "Default Lit" shader

Tree in Unreal Engine 4.7 using "Two-Sided Foliage" shader 
with enhanced Normal map and Skylight for indirect illumination.

No comments:

Post a Comment