Simple PBR v5

It’s been awhile since I posted a new version of Simple PBR. It’s gone through a couple internal updates (one of which I brought back to v4 because I found it useful). If you want to some techno-rambling about what exactly is changed, I’ll describe it at the end of the post. A lot of you probably just want the shader and some basic instructions, so, here you go:

overview

Download it here: https://drive.google.com/open?id=0B4md98mV7RHJaGFKcVpmVjRvZ0U

There are two main nodes inside, “Simple PBR v5” and “Simple fastPBR v5”. Both give mostly similar results and have the same inputs. fastPBR is slightly faster to render. Not by much, you might not even notice the difference on big scenes, but Simple fastPBR skips a few things to optimize the shader a bit. In exchange for making you wait slightly longer, the regular version will give slightly more realistic results with higher roughness.

IMPORTANT: SIMPLE PBR v5 REQUIRES BLENDER 2.78+!!!! It is NOT compatible with 2.77a!


“Wait!! There used to be a Substance and Substance Painter shader, what do I do now?!”

Simple PBR v5 has transcended such things. You can now just use the regular Simple PBR or Simple fastPBR with Substance. An updated Blender Cycles export preset for Substance Painter is included. If you were using the one that came with Simple PBR v4, you should replace it with the new one. It will export maps for each of the 4 channels. Roughness, metallic, and normalOpenGL should be loaded as “non-color data”, base color should be loaded as the default “color”. You will need to add a normal map node in-between the normal input on the shader and your normalOpenGL image node. See below for the example setup.

Note that now all Simple PBR shaders use squared roughness. This is different from the raw glossy BSDF, but it’s easier to work with and it seems the way all the other community PBR shaders are going.


“How do I use Simple PBR?”

Glad you asked. Append it to your scene and plug it into the material output. Typically your textures go something like this:

example

The only other thing worth noting is that if you are not using a bump or normal map, you will need to manually supply the mesh normal with the geometry node as in the screenshot above (it’s set up in the source file too for your reference). This is due to some limitations with Cycles and node groups not initializing the shader normal properly in some cases, using the geometry > normal output just sets it manually to the correct value.


Simple glazePBR and Simple PBR Glass

Simple glazePBR is just the dielectric reflection component of Simple PBR. You can use it to add a realistic gloss to non-conductive objects that are not diffuse. Like, say, skin. Or you can make some sweet (and easy!) carpaint but sticking it after the regular Simple PBR.

Simple PBR Glass is, well, a glass shader. It was sort of a last-minute addition to the kit. It hit me that I often use a bunch of the same nodes when making glass shaders, which was the same impetus that created Simple PBR in the first place. So meet the refractive member of the family! It has built-in volumetric colors (absorption only! no performance worries here, I checked carefully!). It also will automatically switch to transparent shadows instead of caustics when roughness is set to 0, since Cycles can’t reliably produce caustics from sharp refractions. The “color density” input will adjust the strength of the absorption effect


Did you know that Cycles it getting support for Disney’s “principled BRDF”? It’s true: https://blenderartists.org/forum/showthread.php?403342-Cycles-Disney-Brdf
Once this is done it will more or less render obsolete all these community PBR shaders. There may still be a need for the glass and glaze shaders, it’s something I’ll look into when the time comes.


Finally, if you find Simple PBR useful, I’d appreciate if you could throw some coins in the tip jar in the sidebar



TECHNICAL MUMBO JUMBO SECTION

Ok, so what is actually new in v5? Here’s the important bits, I’ll explain why for each one:

  • Plain “Simple PBR v5” uses the new Multiscatter GGX glossy option in 2.78. This gives brighter, more correct results with high roughness. It comes with a bit of a noise and speed cost, hence the impetus for fastPBR, which uses the old simple GGX.
  • Diffuse roughness is now calculated as glossy roughness * 0.33 instead of using the glossy roughness directly. After actually reading some docs on Oren-Nayer shaders (how useful) I found that most real-world surfaces will not exhibit sigma values beyond 0.5, with most topping out around 0.3. This is something I probably should’ve remembered from my LuxBlend days… Anyway, I thought for awhile on the best way to handle diffuse roughness in Simple PBR. Using glossy roughness directly led to weird velvety-looks with roughness=1. I thought about disconnecting it, or locking it at a value, or exposing it as its own parameter. After awhile, I decided on using the glossy roughness * 0.33. It’s kind of arbitrary, but it gives a decent result in most cases without having to manually set it.
  • Simple fastPBR does not use Oren-Nayer at all, diffuse roughness is disconnected interally and set to 0. This gives a small speedup at the cost of realism on rough surfaces.
  • Roughness is squared in all cases. Most of the community PBR shaders, particularly Andrew Price’s, do this as it’s easier to work with and allows compatibility with most PBR authoring tools. This does mean it gives different results than a bare glossy BSDF, but I think most people will figure it out. Additionally, the roughness squaring is done as roughness*roughness, rather than roughness^2, just to be safe. This does not make a speed difference that I’ve ever observed, but why do things the potentially slower way?
  • Substance Painter export no longer packs roughness/metallic/height to an RGB texture. In 2.78, Cycles adds native support for single-channel textures (grayscale, float, scalar, single, whatever you want to call them). By exporting roughness and metallic into seperate grayscale files, they can be loaded using one channel each, meaning a total of 10 texture channels are loaded. Basecolor and normal both require 4, as Cycles does not have an RGB texture type, just RGBA. The old packed method required initializing a 3rd RGBA texture meaning 12 channels total. So the new method saves you 16.7% texture memory at the cost of making you load a 4th image node. (I recommend the “multiple images” option on the node wrangler addon, btw). Previously, seperate textures would’ve result in their own RGBA textures internally resulting in 16 channels, hence the intial design of the packed version. This is no longer needed.
  • You shouldn’t need to manually disable heterogeneous volumes or transparent shadows with the glass shader. I tested carefully to make sure these weren’t getting kick on when they weren’t supposed to, and there is no render time difference that I can pick up.
  • There is no fake caustics effect on the glass shader when roughness is 0. As far as I know, this can’t actually be done reliably in Cycles shader nodes. It would require modulating shadow opacity based on distance traveled along the vector to the light, and the vector to the light is not known when evaluating the graph. The “fake caustics” setups I’ve found all just fudge using some other vector which is not reliably correct, such as length along the eye path or viewing angle.

Importing Substance Painter texture to Cycles

You should also check out the latest version of the PBR node group here: https://jtheninja.wordpress.com/2016/09/18/simple-pbr-v5/


 

Substance Painter is a powerful physically-based (PBR) texturing tool. It’s primarily aimed at game use (for now…), but you can easily make use of its output in Cycles. In this tutorial, I’m going to show you how to do that.

To start, I’ve given everyone’s favorite monkey an interesting paint job using the default color, height, roughness, and metallic channels.

suzanne

First order of business is to export these for Blender. Hit File > Export, and just use the default “Document Channels + Normal” preset.

export channels

Now let’s look at our shader in Cycles. We’ll start by making the simplest, most standard physical shader, a diffuse/glossy mix with fresnel.

starting nodes

NOTE: Some people like to use the layer weight node instead of the fresnel node. If that’s you, go right ahead. I’m just using the fresnel node here for simplicity.

Base Color

Our first channel to deal with is base color. There’s not much to this one. We have a base color image, we’ll just load it and plug it into the diffuse BSDF’s color slot.

base color attatched

Roughness

Our next texture if the roughness map. As you might have guessed, we’re connecting it to the roughness inputs on both the diffuse and glossy nodes. However, there’s a couple things we need to set to make sure Cycles interprets the map correctly. The first is to change the node from “color” to “non-color data” (as that is what the roughness map is). Any channel that is not set as “sRGB” in substance painter should be loaded as non-color data. Here we see that base color is sRGB (and thus should be loaded as color), but the rest of our channels are luminance (marked with an “L”), so they should be loaded as non-color data.

sp channel type

The other thing we need to do is square the roughness value to match the range between SP and Cycles. To do that, add a math node, set it to “power”, connect your roughness map to the top slot, and set the bottom slot to “2.0”.

rough attached

Let’s check how it looks so far:

color_rough_monkey

Ok, it’s a start. The colors are right at least. Now let’s deal with that height channel. There’s a few different ways to do that:

Height Method 1: Bump Node

One obvious way to handle the height channel is to do what SP shows it as: load the height texture and stick it in as a bump map. To do that, we’ll pass it through the bump node and attach that to our normal inputs

bump node

This works ok, but you often need to fine-tune the bump strength, and if you have a normal map for your object, we have to add more spaghetti (and load another texture) to integrate the two. There’s a better way, namely…

Height Method 2: The Normal OpenGL output

Substance Painter can generate a number of “converted” texture maps. One of which is the “Normal OpenGL” channel, which generates an OpenGL-style tangent-space normal map using the height channel and the object’s normal map (if it has one). We can attached it with the normal map node, like usual.

normal ogl node

Let’s try that:

normal_monkey

Perfect! Works right out of the box! In this case, our object didn’t have a baked normal map in Substance Painter. But in case it did (such as baked sculpting detail) the normal map will contain that as well as your height painting, so you don’t need to do anything else to connect the two.

Optional Height Method 3: The Displacement Output (Which Doesn’t Work Right)

There’s one more method you can do. It doesn’t really behave the way it should since it relies on an unfinished feature in Cycles, but you can instead attach the height map to the displacement output. If you don’t turn on experimental features, this has basically the same result as the bump node method. However, if you enable experimental and change the displace mode to “both” (aka, auto-bump), Cycles will displace the vertices of the mesh as best it can to fit the height map, then adjust the normals to fit the rest of the way.

It’s kind of cool, but again, this is an UNFINISHED FEATURE of Cycles that DOES NOT WORK QUITE RIGHT. (don’t enable subdiv, trust me). It’s probably best you just forget I mentioned this and use the normal map method.

Metallic

Ok, one more channel. This one gets a bit complicated. Up until now, our shader has been a simple dielectric shader. We now need to introduce an alternate shading path for metal, and use the metallic map to blend between them. To do this, you are going to add a mix node at the end of the chain, attach your metallic map to the mix factor, then put an extra glossy BSDF on the second input, and attach your base color, rough (from the power node) and normal (from the normal map node) to this glossy BSDF.

metallic attached

I’ve highlighted our newly added nodes in red. Areas that are dark in the metallic map will use our diffuse/glossy fresnel mix we created earlier. Areas that are bright in the metallic map will shift over to this glossy-only shader. Since metals have colored reflections, we attach the base color to the glossy-color input here, unlike our other glossy BSDF on the dielectric side. Since roughness and normals are shared, we use the squared-roughness and normals just like on our other BSDF nodes.

Wrapping Up

Here is our final monkey!

final_monkey

This shader setup is just the very basic elements required to translate the shader. There are numerous other effects you can add. For example, some people like the look of metal shaders that blend two glossy BSDFs at slightly different roughness. You can add that in to your shader (use an extra math node to scale your roughness map). Some people prefer to use the layer weight node instead of fresnel. It’s all up to you, feel free to experiment!

You can make a node group out of your shading nodes here (minus the image textures) so you don’t have to set this up all over again for every material. Or you can just use mine. Grab it in this post: https://jtheninja.wordpress.com/2016/09/18/simple-pbr-v5/