I recently added a button to ucupaint to make it possible to copy layers from an ucupaint material from blender asset library into the current ucupaint material:
Previously to do that you’d need to drop the material onto some temporary object and then copy layers from it manually.
Now that copying layers from assets is an option, we can easily reuse procedural layer stacks, aka smart materials, between different ucupaint materials!
Note: The button will be there in the next release of ucupaint (presumably 2.4.0). If it’s not out by the time you’re reading this you can test it by switching to the master branch. You can do it from the addon itself if you click on the “i” icon on the top right of the addon panel and then on the cog icon to the right of “Branch”.
About smart materials
Smart material is just a material that can take properties of the surface into account when applying different layers, which is especially useful for dirt and edge wear.
You don’t need ucupaint to make smart materials in blender. Everything that you can do with ucupaint you can also do without it, just much slower. Ucupaint is a layering addon, and smart materials are all about layering, so as you can imagine it’s a pretty good combination.
I’m a big fan of everything procedural because I’m lazy and I can’t imagine drawing edge wear by hand. Even if you need significant variation in edge wear on different parts of the model you can get very far just by layering multiple noise masks of different scale. You can also paint masks for different types of procedural edge wear rather than edge wear itself if you need more control over how and where it appears on the model.
How to make smart materials
Let’s look at this painted metal material as an example:
I wrote a guide on how to use ucupaint in the previous post if you need a general introduction to the addon.
Here’s a quick high-level breakdown of how I put together this material.
The base layer is paint - yellow, non-metal, full roughness:
The reason it’s full roughness is just because I use textures in roughness channel later to add glossiness to the paint.
I add some subtle dirt spots on it using a curve on a grunge texture to isolate only a small range of values from it. This way I don’t need to search specificaly for a “Very Subtle Spots” texture and can just use practically any grunge texture for this:
For roughness I use two scratch textures with different scale. Both of them are in Object coordinate mode, which you may also know as triplanar mapping. I often do that for textures that have big detail in them because then I don’t need to worry about how UVs are rotated.
You can increase Projection Blend to make sure there are no seams between different projections. I usually increase it all the way to 1.0
because it works best in most cases.
Then I add dirt layers - I added three solid layers with AO and some dirt texture in the mask, added in burn mode. The reason I have multiple dirt layers is I wanted slightly different textures for AO of different radii:
It’s probably an overkill and two would have been enough but I didn’t want to spend too much time optimizing this material.
Next I bake bevel normal to get smooth edges:
The main edge wear layer is showing metal underneath the paint - it has metallic 1.0
and roughness 0.2
to make it shiny. There’s an Edge Detect mask on it, two scratch textures blended in burn mode and curve modifier after that to boost the contrast of the mask a bit.
There’s also a second edge wear layer that I added specifically for visible smaller radius edges on bolts. I could have limited it to the bolt geometry with Color ID mask, but I didn’t do that because it doesn’t hurt on other geometry too, and besides we’re making a smart material so it makes sense to not mask anything by geometry:
Finally I add some dents with a bump texture, this layer only affects the Bump channel. For it I used built-in ridged noise with a distortion value of 6.0
and then made into subtle small dents with the help of the curve modifier.
Making it an asset
To reuse this material we need to mark it as asset and put it into an asset library.
To mark it as asset all you need to do is to right click on the material anywhere and click Mark as Asset. For example you can do it in the ucupaint UI itself:
After you do that you’ll see that it has appeared in the Current File library of the asset browser:
Of course it’s hard to understand what’s going on with the material by the regular UV sphere because we have a pretty complex smart material that doesn’t even rely on UVs that much because I used triplanar mapping for most textures.
On the panel on the right you can click Capture Screenshot Preview to capture a square area of the viewport to use as a preview:
And we get this:
Asset library in blender is just a path to a folder with .blend
files in it that have these materials marked as assets. You can add paths in blender settings on the File Paths tab:
To make your ucupaint materials easier to find I suggest making a new category for them. You can add a new category through the asset browser by clicking the + button on the left and then you can drag your material into it:
And now we can use it in any blend file!
Trying it out
Now in any file we can right click on it and copy layers from it onto the active ucupaint material:
Here’s what it looks like on some models form thebasemesh.com without any tweaks:
You can of course tweak the values of different layers after pasting them to make sure they work best for geometry of a specific model, but it’s a good starting point and will save us a ton of time when texturing!
We can also apply smart materials onto a part of the mesh rather than the entire mesh if we paste the layers into a group with a Color ID mask on it.
Smart masks
In this post I described how to use this for smart materials because it’s usually faster to use a material as a starting point for your new customized material rather than starting with a B/W layer mask and having to set all the channels from scrach. It is however possible to make smart masks too.
A good workflow for creating smart masks is to put masks on Layer Groups. You can then put anything you want inside of them, from solid color to full PBR texture sets from polyhaven.
Performance
Keep in mind that the more baked masks you have in your smart material the more time it’ll take to rebake it on paste. You can bake less maps by baking only one map of each type (AO/Edges/etc) and then reusing them in different layers with different curves by opening them with Open Available Image as Mask:
You may also bake them at low resolution when making a smart material and then rebake at higher resolution before the final material bake in the final model.
Make sure the scale is right
While some layers in smart materials may use model UVs and therefore the scale of the details will be relative to the object size, some things like edge detect radius and AO radius, as well as triplanar-mapped textures rely on actual world-space scale, so when making for example an edge wear mask you’ll need to decide what category of objects you’re making it for.
This isn’t really a problem because normally edge wear would look different on objects of different size anyway, so you would normally want different kinds of masks on them. But it’s just something to keep in mind.
That’s it
There are a lot of things that can be made procedural in ucupaint, with or without rebakes, for example you can make masks from gradients to isolate only top or the bottom of the model, you can make procedural dust with fake lighting generator, and in the future it will also likely be possible to use custom node groups which will allow you to create any procedural effects of your own. That will open a lot of possibilities for advanced smart materials.
If you haven’t yet tried ucupaint it’s a free and open source addon available on the extensions platform. You can support it by donating via github!
Thanks for reading <3