Translucency

Coming from a background in games I’m aware that “Translucent” transparency can cause a lot of issues in rendering. It can be expensive for performance on consoles as well as cause depth sorting issues with other translucent objects such as particles and other VFX. For that reason, I went for the more performant option of using the “Masked” blend mode in Unreal. This blend mode has the benefit of being very close to an Opaque shader in performance terms as well as being able to cast proper shadows which account for the transparent parts of the material.

The downside of using “Masked” is that it makes your opacity mask binary (either a value of opaque or transparent) and so you can end up with a material which looks low res and jagged around the edges. To combat this downside I used the post process effect of dithered Temporal Anti-Aliasing in the material. This post process softens the jagged edge and results in a convincing look without the issues I mentioned when using “Translucent” blending.

Fuzzy Shading

Fuzzy Shading is a node which comes with the Unreal Material Editor that allows you to fake the look of a fibrous surface such as velvet or moss. When you observe fabrics with little loose fibers such as wool you will notice that the surface tends to get brighter toward the edges (normals perpendicular to the camera) and darker in the core (normals parallel to the camera). This effect is similar to Fresnel and it’s vital when trying to emulate fabrics. Having the materials and bunching them up in my hand I was able to see relatively how bright or dark I should make them and what settings I should use on the FuzzyShading node.

Fabrics with a deeper pile such as wool appear much darker when viewed face on due to the long fibers. It’s a bit like looking down on a forest of trees with a dark forest floor. Interestingly with some of the fabrics like rayon, I observed the reverse, a light center with a dark edge. This was interesting and probably due to the fibers being shaped and aligned in a single direction. Incidentally, I used the FuzzyShading node within my Subsurface material rather than use the “Cloth” Shading Model because it allows me more freedom – “Cloth” doesn’t have Subsurface Color options.

Improving the Collection with Material Functions

When I initially released the fabric collection on the Unreal Marketplace I received some great suggestions for improvements from the people who bought it. One of the users mentioned that he used a lot of blend shaders which combined two or more materials using blending in the material editor. My original release works well with materials and material instances – but it didn’t really support material blending. I thought this was a great idea and in order to support this workflow, I completely remade a new variant of the entire library structure using Material Functions. The power of Material Functions is the ability to pack a whole material into a single node. These nodes can then be easily blended together in the Material Editor in a myriad of ways.

I hadn’t done much work with Material Functions before and they presented their own unique challenge in order to present a user-friendly package. For the Unreal Engine free month promotion I released version 1.1 of the fabric collection which includes this new Material Function library. I also took the time to preserve the control and structure you get from a Master/Child relationship between the functions. Even with this Material Function variant you can still make large changes to a whole subset of materials or just edit an individual child instance. Also included in this release are several examples of how to use the new functions – vertex painted blends, blends driven by blueprint and complex animated masks.