The Next Frontier of Texturing Workflows
Over the past few years, we have visited more than 200 studios around the world. During each visit, we gather feedback and requests, we talk about workflows in general – what works and what doesn't, and what's missing in each studio's pipeline. Over time, we've accumulated a long wishlist from the game industry that we try to order, prioritize, and eventually turn into features or products. Today, we are unveiling and going into detail about one of these wishes: dynamic material layering.
There was a time not so long ago where each surface, wall, or object in a game had a single material applied to it. This was either a seamless tiling material, a complex atlas, or a unique set of textures designed especially for this asset. Sometimes objects would get broken into separate sub-objects, each with their own material, or you could have a detail map overlay to add details artificially, but that was pretty much it.
A classic "baked" material, specific to this asset
In today's and tomorrow's games, this method doesn't cut it anymore. Virtual worlds are getting bigger and bigger, TV resolutions are increasing, we need more assets and we need these assets to be more diverse and more detailled without blowing up the memory! The good news is that recent hardware can handle very complex shaders, and with complex shaders come a lot more possibilities and freedom.
Most modern games use complex shaders and tricks to blend different materials seamlessly on objects, characters, and terrains. An armor, instead of being custom-painted or generated for a specific character, could be a combination of a chainmail, two types of cloth, and a leather material, all dynamically blended in the shader. Not only does it make sense if you think about how these objects are built in real life, but it also saves a lot of memory because these materials can be reused on an unlimited number of assets. It makes asset customization a piece of cake.
These methods also have the advantage of breaking the barrier of texture resolution, allowing for quasi film-quality characters and objects, as seen in Ready at Dawn's The Order: 1886, Naughty Dog's upcoming Uncharted 4 or Epic's Paragon for example.
In-game screenshot from The Order: 1886, developed by Ready at Dawn and SCE Santa Monica Studio
This all sounds great, but a piece of the puzzle has been missing for a while. There is no tool that allows you to visualize these complex shaders while you are working on the texturing.
The usual workflow consists of painting black and white masks in a painting application, exporting these masks to the engine, applying them on the asset and only then seeing the result of the materials blended together. If some fine-tuning is needed, we're back to square one: return to our painting app, tweak the black and white mask, and reimport it.
This is tedious, time-consuming and quite simply not very fun or intuitive for the artist.
What we call Dynamic Material Layering is a way to visualize these complex shaders on your asset directly in Substance Painter 2. You get an extremely accurate preview of the final in-game result while still being able to use all the painting and masking tools that Painter has to offer.
After inserting simple tags in the shader, Substance Painter will automatically generate a custom user interface for you to easily blend materials and paint masks. The range of cases supported is pretty wide, from material layering to detail maps or animated materials.
That's one of the crucial aspects of this feature. This means that technical artists or graphics engineers can provide the artists with a template, giving them all the artistic freedom they can while also keeping them within set boundaries to control performance and shader costs.
When it's time to export the results, Substance Painter can pack and spit out the masks along with a small file describing which materials were blended and how. This information can then easily be transferred to any engine and automatically converted into a working material.
In this example, we have a Unity shader that's designed to blend four materials together using three different masks packed into an RGB map. That's a lot of inputs and parameters to set up manually.
The shader UI in Unity 5
We made some adjustments to the shader and converted it for Substance Painter, and the tool automatically adapted its UI to facilitate our task. All we have to do now is fill up the material slots with our materials and get right into the fun stuff: the mask painting.
We have full freedom over how to build the masks, either by hand-painting, using generators, particles or a mix of all the above. We can also tweak any setting of the shader, knowing that everything we do here will also translate to the engine. In our example, we can fine-tune the scale of each material and tweak the normal intensity or the contrast of the masks.
What we end up with is an asset that has much higher material quality and detail than if we had created a unique texture set for it, while only needing a single RGB texture. The cost of the different materials applied to the object is negligible since they will likely be re-used on hundreds of other assets as well.
Once we're finished, Substance Painter exports this composited RGB texture containing the masks and a small text file containing all the information needed by the shader.
Back in Unity, we built a simple script that translates and transfers this information to any material automatically. All we have to do is select our object, pick the Layered Material, and look for the text file we exported from Substance Painter. Voilà!
Dynamic Material Layering is still in development and is currently being beta-tested by multiple studios. We expect to release it to the general public when we think it's ready and easy enough for everyone to use. In the meantime, a preview of the feature will be available in the Substance Painter 2.1 release in a few weeks for studios and individual artists who want to venture into the world of layered materials!