Quick and Dirty PBR (with Team Color) - Tantares/Resurfaced GitHub Wiki
This is a quick and dirty guide to converting a colored multi-surface Bumped Specular material to one that is PBR-based using Resurfaced shaders.
Gather Your Tools
You will need:
- The Resurfaced shaders
- A Unity scene as per https://github.com/Tantares/Resurfaced/wiki/Resurfaced#unity-step-1
- The texture assets for your model
A Team Color Material
The shader you'll be using is Resurfaced/Standard (TC)
. The TC stands for team color. A completed material that uses this shader looks something like this:
It uses the following maps
- Albedo (RGBA)
- RGB - normal PBR albedo color
- A - normal PBR Smoothness
- Metal (RGB)
- R - normal PBR Metalness
- Bump (RGBA, normal map)
- A good ol' normal map
- Emission (RGB, optional)
- RGB emissive color
- Team Color (RGBA)
- R - Primary TC mask
- G - Secondary TC mask
- B - Team Color Smoothness
- A - Team Color Metalness
This material lets you make surfaces that are by default one Albedo/Smooth/Metal value per pixel and can be colored by 2 different user-chosen colors. The areas covered by those colors can be set to pull their Smoothness and Metalness from an alternate value stored in the TC texture. By convention, the idea is to set up the texture so the default textures represent a bare metal surface and the TC textures represent a very smooth paint surface.
The workflow for building a material looks like this:
- A. Decide what areas on your model will have team color
- B. Author the base textures
- i. Albedo
- ii. Smoothness
- iii. Metalness
- iv. Normal
- C. Author the Team Color masks
- D. Author the Team Color additional data
- i. Metalness
- ii. Smoothness
This guide wil walk through doing this for a texture.
A. Decisions
Take a picture of your base object and mark it up with your ideas for colors. For this one I'm gong to use primary TC on most of it, and secondary on just the rungs.
B. Base Textures
Next, we're going to author the textures.
Albedo
To make our albedo texture we will adjust the Diffuse texture from the previous workflow. I start by saving a copy of the file with a -a
for Albedo suffix so things don't get confused. Here's what this looks like:
We're first off going to change all that white painted metal to... TCable metal, and adjust the metals to PBR-valid albedo values. To select the right colors you can use the palette, or you can roll your own. Notice that I've removed all the white and I've also removed the blue things, which are handles
The other thing to do quickly here is to change the base colors of any nonmetals. Compared to the standard Restockish color palette, I find I need to go up by 10 points in S/V for colors. This is most evident here on the window.
We're also going to need to do some work to turn the 'white' into 'metal'. For my textures this involves removing the various 'paint noise' layers I use and drawing new metal burnish layers. I cranked up the opacity here to show you:
Here's the more-or-less final albedo:
Smoothness
Smoothness is a pain. I start with the Specular map but it'll need some changes:
Similar to the albedo map, we go through and use PBR smoothness values throughout and IMPORTANTLY a specific TC metal smoothness on the areas that will have TC.
For the look i'm going for, I actually invert the edgewear on metallized areas and cut its opacity to 50%. If you're using layer effects to do edges, check those too. In addition, I crank up the metal noise layer and the burnishing layer to get the brightness to a good place
Then I dump that smoothness map into the albedo texture's alpha.
Metalness
To make the metalness texture, save off a copy of the albedo with a -m
suffix.
Metalness is pretty easy. With the exception of very specific materials, everything will be black or white. Watch for things that should be holes in your texture (deep holes) but otherwise eliminate things like plating. These will be managed by normals and smoothness.
Bump/Normal
For this map just use your existing normal/bump combo. I find I get some decent mileage over tweaking the intensity though.
At this point you can actually preview it in the viewport and it won't look too terrible. It will look over-shiny on the team colored areas. This is intentional - the metallic team color without any assigned team color properties should be 'maximum smooth'.
C. Team Color Masks
So, now, putting the color back. We will start off by opening the Albedo texture and saving a copy of it, with the suffix -tc
for convention. We'll also grab the tc_template.psd
and drag its layers to the top of the -tc
. file.
Let's take a look at the way this template is structured:
This is laid out so each of the maps can be authored in black and white, and transformed to fit into the R/G/B/A channels as needed. For example, to author the Priamry TC, we add layers between the TC1Back
and TC Red Ramp
layers. You can also turn on and off each group to work on them as neeed.
Primary TC
First, I copy all the layers from the Albedo that make up the TC area into the TC1 section of the template. I also copy in layers that create detail in the color - hull lines, shadows, darkened imperfections, etc. This creates the thing we're working on
A reminder - we're working on a greyscale gradient-mapped image. So things you paint as white will turn bright red - the areas where TC is strongest.
This whole bit is a little artistic. You want to adjust the layers so areas where TC is present are basically white, with a few small imperfections. You can erase TC in some areas using layer masks to chip more of the paint off and show the base metal if you wish. I get good results from preserving hull lines and similar features, and preserving but reducing shadows.
This takes some work. Preview in editor with a white TC to ensure you are doing what you want:
Secondary TC
This is identical! But you do with the secondary layers, so you're authoring in green:
D. Team Color Data
Ok, the last set of data you need to author is the TC metalness and smoothness, which is done in the -tc
texture.
Metalness
This is just like the metal map from the base maps, but with the areas you painted with TC removed from the metal area. Simple enough
Don't forget to push this set of layers into the alpha channel.
Smoothness
This is a smoothness map like the one from the Albedo's alpha channel, but again, assuming TC exists. Be careful to make sure the edgewear is not black for TC areas in this one - it's not metal now!
The final TC map will look kinda crazy.
Final Notes
The Technicolor swatches use the following sets of values.
To set up something like the swatches in the editor,
- For metallic colors, Metal -> 1, Smooth -> 0.6 to 1.0, MetalBlenda nd SmoothBlend -> 0.0
- For paint colors, Metal -> 0, Smooth -> 0.5 to 0.8, MetalBlend and SmoothBlend -> 1.0
- For plasticky colors, Metal -> 0, Smooth -> 0.8 to 1.0, MetalBlend -> 0.0 and SmoothBlend -> 0.5-0.7
White paint with yellow paint handles:
Metal with gold handles:
Plasticky white with blue handles: