PBR workflows - Metallic/Glossiness....?


(Pottsie) #1

Hello,

In the context of Substance Painter, at what point should one go the metallic or glossiness workflow route? I feel there are some gray areas here, but I can’t seem to find information.

Let’s just say it’s a painted object, with the underlying object being metal. I’ve read that it should be the glossiness workflow, since paint is a dielectric. Ok. But what if it’s chipped paint, metal showing through yet still being the majority painted. Or let’s say it’s like a plastic coating, with metal underneath. I’m thinking the coating should abide by the glossiness rules, and of course, the metal by the metallic rules. Would it just have to be two different maps then? Of course, I understand rules are meant to be bent or broken. But I’m still wondering what other people think.

I do realize within SP (and Blender), you can adjust for “metalness”, but yet the rule of thumb is one should either choose complete metal or complete non-metal (with some exceptions). So the metal slider, be it in Blender nodes or SP, should be on either end.

Again, just curious what others think.

Thanks!

*Update - just found this link. An interesting discussion.

https://polycount.com/discussion/171689/pbr-the-problem-with-greyscale-metalness


(pixelgrip) #2

with the principled shader and the metallic input,you can input a mask with black and white values for example where the metal is.then the shader makes this white masked areas glossy ,but left all black aeras with the basic specular value as is,for all non metal for ie.
so the input is basicly for masking,of course you can set up the shader to 1 without a input,then you have basicly a glossy/metall shader.

here this explanes all shader properties
https://docs.blender.org/manual/en/latest/render/cycles/nodes/types/shaders/principled.html

if you want a more layer based shader,then the mix with a second glossy shader ect could maybe more what you want,for example a more custom shader with metallic+sparkle layer+clear coat ect

mostly you can get a good result with only the principled shader.as sayed, the great possibily with many node combinations you can do in blender, makes cycles very powerful.


(CarlG) #3

I don’t use SP, but the general idea is to have it create those image based texture maps for you. Just guessing, but I think metalness is the preferred workflow as the maps should plug right into the principled shader.

Metalness: You can’t really go wrong as long as metalness is kept fairly binary and albedo is shared to control the color of the metal. Anything dielectric covering metal should be dielectric (paint on metal, rust etc). Things like 50% wood and metal doesn’t really exist, but some in-between values can exist for antialiasing purposes. Keep that in mind if you decide to use grayscale metalness values for artistic purposes.

Glossiness: It allows separate controls for albedo and glossy color, which allows more flexibility for special materials, but it’s easy to set up non-plausible materials.

Keep in mind that SP output is kind of optimized/meant for single shader use in game engines. In Cycles that means plug everything into a single principled shader and you’re good to go. But I prefer using different shader setups for different materials, i.e. separating metal and wood then using the metalness as a mask. That allows me to easily modify further using my own procedural stuff.


#4

Edit: I went back and actually read everything above… One thing I will add though is that SP gltf/glb exports imported into Blender is da bomb. Everything is set up and I love it! And thus far, I find that I am able to achieve the results I want on everything I need with metal/rough. That is just me though.


(JonMicheelsen) #5

Conversion in most cases are as simple as 1.0 - sqrt(Roughness) = gloss and 1.0 - (gloss * gloss) = Roughness

Albedo Metalness to Albedo Specular conversion is as simple as Specular = (Metalness * Albedo) + ((1.0 - Metalness) * 0.04), New Albedo = Albedo * (1.0 - Metalness)

Extracting a metalness from the Albedo Specular model, is a little bit more dificult, but you should be able to eyeball it by running some contrast on both and combine the two.

WARNING! Reading ahead might just confuse you a lot if you are new to this! :slight_smile:

The specular input in Principle and Unreal are there to roughly approximate a much more complex model of index of refraction’s effect on specular reflection which is something only used in movies sometimes currently, though next gen game rendering might try to solve it in a nice way - cause it ain’t. It involves stupid small numbers and rare high numbers, that doesn’t fit well inside the range of a texture, as well as an abstract imaginary number most often called extinction coefficient. The values also varies with light wavelength, which is something that translate really bad into rgb, so you would need at least 6 texture channels.
Having a Metallic + Albedo + single channel Specular + an optional non metallic specular tint is a way to simplify greatly. The 0-1 range Specular is multiplied by 0.08, which is why it’s 0.5 pr default in Principle and Unreal, and why I mentioned 0.04 above for conversion, and only used on non metallic surfaces, for the specular incident angle intensity math.

I personally always use the Metallic + Albedo + single channel Specular when writing game shaders and making textures. It is possible to remap metalness and specular inverse and pack the latter into the otherwise unused black part of metalness with some custom unpacking, to avoid having to use a whole texture channel - they fit nicely being mutually exclusive by design.

Here’s a link to a much more in depth blog by Sebastian Lagarde, about mental reflections on why we the industry do what we do and where we might be heading, rendering wise: https://seblagarde.wordpress.com/2017/09/09/siggraph-2017-physically-based-materials-where-are-we/


(pixelgrip) #6

from which source do you have this conversations ?
afaik the roughness in the principled shader and if i am not wrong all other shaders with roughness are using already the disney paper roughness ( roughness²).
so if you have a glossy map, you only need to invert the non color glossy map,to get a roughness map for example.depents from where and which engine you have the map of course.

in the specular value ,you can input higher values as 1 if needed.the formular for the specular you can read at the link from my first post in this thread


(cgCody) #7

The principled BSDF does, but all shaders prior to it’s inclusion do not. To my knowledge, they haven’t been changed as my materials with squared rough textures don’t seem to be broken.


Anyway, to answer the OP question, metalness and glissiness (or specular) are two different ways of thinking about the same problem.

In a metalness workflow, you describe a surface by how ‘metallic’ and ‘rough’ it is
In a specular workflow, you use ‘specularity’ and ‘glossiness’ to define a material.

One thing that might throw people off is the word “metal” in the metalness workflow. This doesn’t mean you reserve this paradigm for only metallic surfaces. It means you will describe a surface by how metallic it is (ie 0 metalness for a plastic material). The principled BSDF is metalness workflow centric as is the default shader in Substance.

Both the metalness and specular workflows have their merits, but I’m of the opinion that the metalness workflow makes more sense.


(pixelgrip) #8

i havent looked at all shaders ,but the glossy shader node has roughness * roughness like the principled shader

https://developer.blender.org/diffusion/B/browse/master/intern/cycles/kernel/shaders/node_glossy_bsdf.osl

and here you can found all principled specular maths
https://developer.blender.org/diffusion/B/browse/master/intern/cycles/kernel/shaders/node_principled_bsdf.osl


(cgCody) #9

Ahh you’re right. And it looks like it has been changed for all nodes: https://developer.blender.org/rB7613ffc944ebc133f1f906ea737ab55718434cc4


(JonMicheelsen) #10

I have the conversions from Unity’s source code, they have a toggle somewhere - or at least the code a toggle would run. I have to admit it’s a few months since I read through it though, and I’m pretty green on that engine currently…

The reason for the square root is because the Unity GGX uses a power of 4 on inverse Gloss where the Unreal one uses a power of 5 on Roughness in the calculation of the scattering term(D) and the geometric attenuation term(Vis).
I don’t know if Blenders Pricipled shader is based on Disney Principled shader(it think this is the case), or Unreals shader - that is based on the Disney Principled one. The Disney one uses a roughness remap, it essentially goes Roughness = Roughness * 0.5 + 0.5, before throwing it at the specular calculations with a power of 5 - Unreal does not remap, but still pows roughnes by 5 - Unreal’s near 0 values(it’s technically clamped at 0.02, if I remember correctly :P), is really really sensitive, if the remap is added it actually behaves a lot more sensible. They might have done this to mitigate the blurring of Temporal Anti Aliasing - there is no comment on this in the code, but it would be a qualified guess, since TAA generally makes everything look rougher. I have yet to look at Blenders Principle code. But purely practical to people wanting to run Gloss from a PBR preset(not the old school none PBR one!!) through Principled in Blender, the conversion mentioned above should do the trick!

Edit: I should point out my angle is real time game engine shading, I have little experience in the inner workings of off-line rendering. Looking through the Blender render code now, I can see there’s a lot more attention to details game engines would skip or rough approximate :smiley:


(pixelgrip) #11

yep, its based on disneys principled shader

do you have a link, or something we can read about? the power of 5 is sometimes used in fresnel approximations for metal.i have not read such math for roughness somethere.


(JonMicheelsen) #12

Hehe, I’m actually remembering wrong here. This is Unreal’s GGX:

float D_GGX( float roughness, float NoH )
{
float a = roughness * roughness;
float a2 = a * a;
float d = ( NoH * a2 - NoH ) * NoH + 1.0; // 2 mad
return a2 / ( pidd ); // 4 mul, 1 rcp
}
So, roughness is pow 4, not pow 5.
Note the code was refactored in Unreal 2.20, so a2 is no longer acquired pr D_GGX function call.
Sorry about that :frowning:
And yeah, the Fresnel approximation does a pow 5 as well, but not on roughness:

vec3 F_GGX( vec3 SpecularColor, float VoH )
{
float Fc = pow5( 1.0 - VoH ); // 1 sub, 3 mul
//return Fc + (1 - Fc) * SpecularColor; // 1 add, 3 mad

// Anything less than 2% is physically impossible and is instead considered to be shadowing
return saturate( 50.0 * SpecularColor.g ) * Fc + (1.0 - Fc) * SpecularColor;

}

Note SpecularColor color in this case is lerp(Specular.rrr * 0.08, BaseColor, Metalic);

Here’s Brian Karis original notes on the choices behind the shading in Unreal.

Page 14 got some notes on Gloss to Roughness conversion here as well:

Unity’s code I can’t currently check.

Edit: On a separate note, I would say full RGB specular and RGB albedo can do the job most accurate - but is much harder to work with and as diffuse/specular values in sum can overshoot easily. The whole metallic workflow is most of all a “safer” less error prone use case for artists - and a game engine performance thing - think in terms of two less deferred buffer channels and texture channels pr asset. Metallic can also be relatively low bit depth and is mutually exclusive to for instance sub surface opacity, making the two pack-able at half range - a typical thing a Tech Artist(what I do) would do to hit 60fps :stuck_out_tongue: By safe, I mean in terms of less causes for possible weird lighting in a game environment. I’ve seen several examples of in house engine debug tools that could warn about too bright/dark/smooth etc values hitting the lighting :stuck_out_tongue:


(pixelgrip) #13

thanks for posting the links,still interesting paper.

a few weeks ago we had a thread about look dev export for unreal iirc.

edit,it was vray, however here is the unreal video i mean


(JonMicheelsen) #14

Interesting! I’m a big fan of workflows where the tool looks like the final product, though most often the easiest on the spot fix - if you have a clean uniform standardized pipeline - is a one click export-all-from-tool/re-import-to-game-engine-viewport, for the artists to use.

There is actually several code paths in Unreal’s shader core for the importance sampled reference models they used when constructing the real time rendering. They are real time but very heavy to run, in the order of 64 times more expensive lighting :stuck_out_tongue:
They can be manually activated by compile time branches, just search the shader code base for “Hammersley” and you’ll land right smack in the middle of it!

The Frostbite paper is a gem!