Simple PBR v5

UPDATE

You should use the Principled BSDF shader instead of PBR node groups such as Simple PBR. See https://jtheninja.wordpress.com/2017/05/11/substance-and-blender-2-79/ for more information.


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 kicked on when they weren’t supposed to, and there is no render time difference that I can pick up.
Advertisements

Sharing my compositor tools (Blender)

Using Blender’s compositor to post process your renders? Need a few shortcuts? I have some shortcuts. Below is a pack of 9 compositor node groups that will take care of various effects for you. There isn’t really any coherent organization to these, they’re just some node groups I use that I thought other people might find useful.

You can download it here:

Google Drive Link

The glare nodes:

There are 6 of these, all with the same general UI. They are all additive and easy to chain together.

Anamorphic Flare – A horizontal two-bladed spike flare. Reminiscent of the distinctive horizontal flares produced by anamorphic lenses. Horizontal flares are easy to compose and look cool, so they’re fairly popular to add some ‘umph’ to bright lights.

6-blade Flare – Works like anamorphic flare, but uses a more traditional 6-point pattern.

12-blade Flare – Adds a soft 12 point flare, meant to be used on top of the anamorphic or 6-blade flares

Glow – Uses the glare node’s “fog glow” mode to add an attractive bloom to bright objects. Bloom is a very useful effects as it’s one of the few lens distortions seen in both cameras and the human eye

Gauss Bloom – Another bloom node, using a gaussian blur instead of the glare node’s “fog glow” effect. Much faster to calculate, but the result isn’t as pleasing.

Ghosts – Uses the glare node’s “ghosts” mode to add a lens ghosting effect.
Controls:

Strength – Intensity of the flare. This is a scale factor before it is added to the image, so values over 1 are totally fine.

Saturation – Adjusts the final saturation of the colors relative to the original pixels.

Blur (not supported on fog glow) – Blurs the flare before adding it to the original render

Mask (not supported on ghosts) – Masks out regions so they do not contrbute to the flare.

Min Intensity (gauss bloom only) – The intensity of a pixel before it will flare. I wish this control was on all of them, but the glare node does not use an input for its “threshold” value.

Lens FX

The lens FX node adds various lens artifacts to the image, such as vignetting, barrel/pincushion distortion, and chromatic abberation. (note: the vignetting has some internal hardcoding for 16:9 images, you may need to crack open the node group as tweak this)

Controls:

Vignette color – The color to blend into the vignetted regions

Vignette blur – The softness of the vignette edges

Vignette strength – The ratio of vignette color vs original image.

Disotortion – Stregth of the lens distortion effect. Positive values create barrel distortion, negative values create pincushion distortion

Dispersion – Strength of the chromatic abberation effect

Luma Clamp

Because sometimes this is useful. This node will clip the value (calculated from HSV) to the given value. Please use with care, and note that the 1.0 value may be too low in many cases.

External Motion Vector

Blender has a kind of weird way of storing motion vectors, in that it encodes two keyframes into different channels. The vector blur node expects this, so it doesn’t behave properly with single-keyframe vector passes from other render engines such as Arnold. If you need to use that, just drop this node between your image node’s vector-pass output and the vector blur node. It will copy the red and green channels to blue and alpha, giving the vector blur node the data it needs.

Simple PBR v4

UPDATE

You should use the Principled BSDF shader instead of PBR node groups such as Simple PBR. See https://jtheninja.wordpress.com/2017/05/11/substance-and-blender-2-79/ for more information.


Oops, I kept forgetting to post this. Awhile back, I made a note on the old Simple PBR that it had some mistakes in it, and this video by CynicatPro showed a better shader: https://youtu.be/pNiVB7tRG68

I also mentioned I had modified Simple PBR to take these things into account. At some point I mentioned I was going to post it, but kept forgetting to, Well, some people kept commenting to remind me, so, while I watch Bob Ross on Twitch, I’ve packed it up.

Say hello to Simple PBR v4 (no, I never posted v3, it was short lived).

~~~~UPDATE July 18 2016: I’ve modified the roughness calculation for diffuse slightly. This should give less wacky results. Same download link as before ~~~~

https://dl.dropboxusercontent.com/u/1706676/YouTube%20Summary%20Files/simple_pbr_v4.zip

Inside there you’ll find 4 node groups:

Simple PBR v4 – Simple PBR, which is sadly becoming a bit less simple internally, but it remains a simple metal/rough shader on the outside. This is the main shader, everything else is modifications of Simple PBR. It should work for metal and opaque dielectric surfaces.

Substance PBR v4 – Simple PBR v4, but with the roughness squared. This will make it play nice with roughness maps generated by Allegorithmic’s substance toolkit.

PBR Fresnel – a group of just the fresnel mask part. This is essentially the same as the group CynicatPro makes in his YouTube video. But it’s there if you need it (such as adding gloss to skin).

Substance Painter PBR v4 – name is a mouthful. Anyway, it’s Substance PBR v4, but with even more mods. It has a channel split and the normal map node integrated directly. It’s designed to be used with a Substance Painter export preset that is included in the bundle. That would be the “Blender Cycles.spexp” file. To install the preset, toss it in your Substance Painter shelf folder. See this doc on where to find that: https://support.allegorithmic.com/documentation/display/SPDOC/Creating+export+presets

Note that these groups will not behave properly with the normal input disconnected. If you are not using a bump or normal map, feed in the default normal from the texture coordinate or geometry nodes (either works).

_____

If you are not using Allegorithmic’s Substance tools, you can stop reading now. The rest of the post deals with integrating these shaders with the Substance twins.

The Substance Painter preset will generate 3 maps:

basecolor (nothing weird here)

“metalRough” – includes roughness in the red channel, and metalness in the green channel. The blue channel is blank.

normalOpenGL – Painter’s OpenGL Normal converted map. This map compiles your height and normal channels together with your baked normal map to create a single final normal map.

You will find corresponding inputs for each of these 3 maps on the Substance Painter PBR v4 node group. Just plug them in, and change the normalOpenGL and metalRough to non-color data (this is important, they will not work correctly as “color”). Don’t worry about adding a normal map node or splitting metalRough’s red and green channels, the node has all of that built in, then passes it to Simple PBR. Just import your textures, set non-color data on metalRough and normalOpenGL, attach them to the group, hook the group to your mat output. Nothing else to it!

Screenshot 2015-10-30 22.21.59

Remember that Substance Painter exports PNG files as 16bit, which Cycles will import as float textures. These use more memory, and if you’re rendering on an Nvidia card, you can only have 5 in your scene. Rendering on AMD? Well, you get zero. This has nothing to do with the Simple PBR shaders, just something you should be aware of. You can use a format that is 8bit in Painter, like Targa. Or just live with it.

Blender Cycles: Simple PBR shader

UPDATE

You should use the Principled BSDF shader instead of the method described here. See https://jtheninja.wordpress.com/2017/05/11/substance-and-blender-2-79/ for more information.

__________

There are a lot of ubershaders out there for Cycles. Node groups that promise to cover every possible use you might have, mimicking the ubershader in Blender Internal, and some similar shaders in other renderers, like Arnold’s aiStandard.

This isn’t one of those node groups. The problem with those things is that they end up being a 700 pixels tall node with 27 buttons and sliders on it that doesn’t make any sense at all. I’ve never bothered with those things, because I don’t want to sort through all that crap. Ubershaders like this work for BI or Maya/Arnold because they have UI things like checkboxes and tabs and rollouts. Node groups don’t have those. Even then, they aren’t perfect. Occasionally you find yourself trying to outsmart the ubershader because you need some specific effect it isn’t set up for. For those tricky shaders, Cycles’ bare-metal node design works great, you can have things just the way you want.

All this is a rambling way of establishing that all that crap is useless 90% of the time. Handling tricky shaders is great, and Cycles has a way to do that. But most shaders AREN’T tricky. Look around you. I’m betting most of the items in your room right now could be described with a simple metal/coated-glossy shader, and most of the ones that aren’t are made of glass. A lot of the time in Cycles, you’ll find yourself dragging the same set of nodes together, especially for environment trinkets. This grind is why I made Simple PBR. A minimalistic physically-based shader for all those times you DON’T need over 9000 sliders. Say hello:

default

exploded

Simple PBR makes things like wood, plastic, ceramic, and metal easy. All the bits you need are pre-wired and packaged, you just need to supply values and textures. Simple PBR has just 6 inputs:

-Albedo aka Diffuse Color
-Specular Color, controls brightness of non-metal reflections
-Fresnel IOR, controls fresnel effect on non-metal reflections
-Roughness: the input for gloss/roughness/microfacet/whatever-we’re-calling-it-this-month
-Metalness: blends between metallic and non-metallic reflections
-Normal: bump/normal maps plug in here.

You can download it here: https://dl.dropboxusercontent.com/u/1706676/YouTube%20Summary%20Files/simple_pbr.blend.zip

Currently, metal reflection color is controlled by the albedo input. I’m a bit indecisive on whether they should be controlled from this input or specular color, or its own color. That might change in a future version. Also note that as a result currently spec color is not actually a color, it’s a 0-1 spec intensity value pretending to be a color. Any color isn’t actually used. (this might change in future versions of Simple PBR, if they exist).

After some thought, I decided to attach the spec map by using it to scale the fresnel mix factor used to mix diffuse/glossy reflections. In my opinion, this produces the best combination of physical accuracy and ease of artist control.

The roughness value is shared by diffuse, glossy, and metal components. It’s just Cycles’ usual 0-1 roughness value. Remember that in your gloss maps white is rough, black is shiny. Don’t forget to invert your map if needed, like when your gloss map is slightly modified version of your spec map.

The metalness input is there because metals are weird. They DO have colored reflections, and they don’t have fresnel. This input controls the blending of a second glossy shader that handles this department.

Some other example renders:

Brown albedo

metalness_none

Metalness increased to 50%:

metalness_half

Metalness at 100%

metalness_full

With textures

textured