PBR Workflow

Started by cyphyr, June 28, 2019, 06:15:53 AM

Previous topic - Next topic

cyphyr

I have been looking at some of the models produced by KitBash3D and really like the quality and variety of their models. I will probably get a couple of kits when they are next on sale (they are on the pricey side but you do get about 30 models per kit!).
They use PBR images for their textures.

My question regarding Terragen is about the application of the PBR texture.

I assume that the sliders in the default shader should be set to 1 where a texture is loaded since the value of the texture is held within itself rather than in the shader node.
A fully black texture with the defuse slider set to 1 will give a fully black output.
A 50% grey texture with the defuse slider set to 1 will give a 50% output.
By setting the slider to 1 this allows the PBR texture to fully control its own values (as PBR textures are designed to do).
Is the above correct?
Obviously once this is set up the sliders can be tweaked for fine control.

Secondly in the specular tab should I be using Glossy or Metal textures?
Either way I assume the slider should be set to 1 to allow the PBR to do its work.

Thanks and advice greatly appreciated

Richard
www.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

digitalguru

Interesting question,  I'm curious how those would to preserve energy conservation since AFAIK the TG shaders are not energy conserving.

Seem to remember a post where Matt showed how to balance translucency with diffuse to keep energy to equal 1 (with a kind of percentage formula) I guess the same would hold true with specular conservation too.

QuoteObviously, once this is set up the sliders can be tweaked for fine control.

I would modify the source images rather than tweaking the shaders, I'm doing a project where I'm mixing the same populations both in Terragen and Maya and keeping the adjustments to the bitmap level meant both renders matched very well.

Matt

#2
Update 2022: For Terragen 4.5 and later, use this much simpler method instead: https://planetside.co.uk/forums/index.php/topic,30229.0.html

Edit 2019: I've edited this post to add instructions for the Fresnel effect on metals, and also updated the instructions for using roughness maps.

Quote from: cyphyr on June 28, 2019, 06:15:53 AMI assume that the sliders in the default shader should be set to 1 where a texture is loaded since the value of the texture is held within itself rather than in the shader node.
A fully black texture with the defuse slider set to 1 will give a fully black output.
A 50% grey texture with the defuse slider set to 1 will give a 50% output.
By setting the slider to 1 this allows the PBR texture to fully control its own values (as PBR textures are designed to do).
Is the above correct?
Obviously once this is set up the sliders can be tweaked for fine control.

Yes, that's all correct.

QuoteSecondly in the specular tab should I be using Glossy or Metal textures?

If you have a glossiness map, use that, but enable "invert roughness image", because glossiness is the inverse of roughness.

If your metalness map is close to black, just ignore it. But if you have highly metallic surfaces then you should take a different approach.

I assume that if you have a metalness workflow then you also have an albedo (or base colour) map. For non-metals (i.e. dielectrics, which most materials are), albedo or base colour should be assigned to "diffuse colour". For metals, albedo or base colour should be assigned to "reflectivity".

To create a non-metal surface:

1. Set "diffuse colour" to white (1). Assign the albedo map to "diffuse colour image".
2. Set "reflectivity" to white (1), "reflection tint" white (1). You can use "index of refraction" at the default value of 1.5.
3. Set "roughness" to 1.0. Then either assign your roughness map to "roughness image" or use a separate Image Map Shader to load your roughness map and then plug the image map shader into the "roughness function". If you use an Image Map Shader you can experiment with the "data is linear" option on its Colour tab. Make sure you set the Image Map Shader's projection mode to "UV (if available)", and enable "Tile X" and "Tile Y" to avoid some surprises.

If you have a glossiness map instead of roughness, assign the glossiness map to "roughness image" and enable "invert specular roughness image".

To create a metal surface:

1. Set diffuse colour to black. This is important.
2. Make your surface highly reflective by setting "reflectivity" to 1 (no texture map) and "index of refraction" to 10.
3. Assign your albedo map to "reflectivity image".
4. Set "roughness" to 1. Create a separate Image Map Shader to load your roughness map. Then connect the image map shader into the "roughness function" of the Default Shader. Make sure you set the Image Map Shader's projection mode to "UV (if available)", and enable "Tile X" and "Tile Y" to avoid some surprises.
5. Add a Reflective Shader after the Default Shader (the Default Shader should feed into the main input of the Reflective Shader). Set its roughness to 1, and connect the same roughness function that you did for the Default Shader. The reason to use a Reflective Shader is to add a Fresnel effect to make the reflectivity ramp up to 1 at glancing angles. In the real world this occurs even on dark and coloured metals. Without it your edges might look too dark.

If you have a metalness map that has different values within it, then really you need to mix two materials and use the metalness map as the mix controller. You can use a Merge Shader to do the mixing, and make use of its "mix controller" input. For most natural objects the metalness should be black (0) so you don't have to do this.

Notes on roughness vs. glossiness:

As I said earlier, glossiness is basically the inverse of roughness. But there may be discrepancies between renderers if they use a different mapping between 0 and 1. I plan to add more options to the shader to control the gamma/colour space of the image to help account for these differences. Without those options, you may need to experiment with gamma corrections of 2.2 or 0.454 on your roughness and/or glossiness images.

I recommend using a separate Image Map Shader to load the roughness map. This way you can experiment with the "data is linear" option on its Colour tab. This also helps if you need to connect the same roughness function to more than one shader, which happens a lot.

If you see any these issues, please send me comparison renders of what something looks like in TG vs. what it looks like in other renderers. This helps me understand what changes I need to make or what options I need to provide in the UI.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

Matt

Quote from: digitalguru on June 28, 2019, 11:01:59 AM
Interesting question,  I'm curious how those would to preserve energy conservation since AFAIK the TG shaders are not energy conserving.

Seem to remember a post where Matt showed how to balance translucency with diffuse to keep energy to equal 1 (with a kind of percentage formula) I guess the same would hold true with specular conservation too.

This only applies to translucency. If you don't use translucency then the Default Shader is energy conserving as long as you stay within the slider ranges for all parameters.
Just because milk is white doesn't mean that clouds are made of milk.

cyphyr

Thanks Matt.
Good to have it laid out systematically.
www.richardfraservfx.com
https://www.facebook.com/RichardFraserVFX/
/|\

Ryzen 9 5950X OC@4Ghz, 64Gb (TG4 benchmark 4:13)

digitalguru

QuoteIf you don't use translucency then the Default Shader is energy conserving as long as you stay within the slider ranges for all parameters.

Good to know, and ditto Cyphyr's comment, great to see the shader recipe laid out, bookmarking this post!

WAS

#6
Quote from: Matt on June 28, 2019, 02:23:45 PM
To create a metal surface:

1. Set diffuse colour to black. This is important.
2. Make your surface highly reflective by setting "reflectivity" to 1 (no texture map) and "index of refraction" to 8.
3. Assign your albedo map to "reflectivity image".
4. This is the same as for non-metals: Set "roughness" to 1.0. Assign your roughness map to "roughness image". If you have a glossiness map instead of roughness, use that but enable "invert specular roughness image".

If you have a metalness map that has different values within it, then really you need to mix two materials and use the metalness map as the mix controller. For most natural objects the metalness should be black (0) so you don't have to do this.

The Metallic directions don't seem right. The output is very bugged. Certain angles of the surface just come out black (couple maps weren't on repeat), and the material doesn't look right at all. It does have a high value metallic map, but it seemed to just indicate everything reflective but the pock marks so I ignored it.

https://cc0textures.com/view.php?tex=Metal05

WAS

Seems much more closer to the textures just using the metallic as reflectivity, roughness as roughness and albedo as albedo.

Matt

WAS, you'll get better results with the path tracer. But the appearance depends a lot on the environment. The screenshot on the website appears to be an interior shot.
Just because milk is white doesn't mean that clouds are made of milk.

WAS

#9
Quote from: Matt on June 28, 2019, 07:38:02 PM
WAS, you'll get better results with the path tracer. But the appearance depends a lot on the environment. The screenshot on the website appears to be an interior shot.

I did a test inside a illuminated cube, with a "ceiling" light just for good measure, and it was immediately still wrong and not even worth finishing.

I think with the case of rough metals, one may have to do a mix of the two methods -- metallic albedo, and than metallic map reflectivity. This gives the richer depth from metallic albedo, but allows for indirect surfaces to still be somewhat lit, not as bright as it would be in a entirely lit cube, with additional light source however.

Also a note; PT is sooo slow inside a cube -- and still a issue with only 55-70% CPU usage across both cores / four threads -- additionally CPU doesn't feel the need to boost itself any and peaks at 3.7 instead of going to overclock limit of 4.2ghz. The benchmark renders pretty quick but also doesn't use all my CPU.

Added a TGD of what I was doing, maybe I am doing something wrong with your method (top one). Textures located here: https://cc0textures.com/view.php?tex=Metal05

It's possible this is related to the fact this metallic surface is suppose to be highly diffused due to imperfections, and the provided displacement doesn't adequately allow for this effect with TG shaders without an additional displacement map mixed in.

WAS

#10
Also having issues with TG suddenly not reading displacement correctly for PBRs or displacement based on images. No matter what, TG will only apply displacement in certain points, and by points, I literally mean points. It ignores all other data, despite plenty of it throughout the whole image.

https://cc0textures.com/view.php?tex=Ground23

This is the texture set, and it cannot produce the displacement provided by the texture set, nor any custom displacement maps I give it. The always only have a tiny points of peaks. No matter how intense, or how smooth I make it, the same issue occurs.

FYI, nothing is wrong with the maps, they render right in Unreal/Blender/CrazyBump, and I've used this shader set before and remember leaf-like shapes and branches, not this weird effect.

DannyG

I was messing with these a lot some time ago, I do know with ground textures like this 8K is the only way to go anything else will look cheesy. Not sure what size you guys are using. This is my test with 8K
New World Digital Art
NwdaGroup.com
Media: facebook|Twitter|Instagram

WAS

#12
Quote from: DannyG on June 29, 2019, 03:56:28 PM
I was messing with these a lot some time ago, I do know with ground textures like this 8K is the only way to go anything else will look cheesy. Not sure what size you guys are using. This is my test with 8K

Interesting. I'm using 8k too, including edited 8k maps from diffuse.

Wait, I see the problem, I left the image source enabled in the default shader!!

DannyG

Here a render w/ pathtracer & exaggerated srf details.
Scale on your file is 5m. I would definatly make that 1m X 1M also Add the AO map, pass the basecolor & AO through a multiply color
New World Digital Art
NwdaGroup.com
Media: facebook|Twitter|Instagram

WAS

#14
Quote from: DannyG on June 29, 2019, 04:50:04 PM
Scale on your file is 5m. I would definatly make that 1m X 1M also Add the AO map, pass the basecolor & AO through a multiply color

Yeah, as noted, I upped scale trying to debug the issue.

PT makes the mug/dirt look much more realistic and not like puddy. Probably the exaggerate details. Can work in some cases, but can look really bad in others (grainy).

Repairing some of the broken cc0 textures I got in the rock category (the ones with lines in their seams). I'll probably re-upload them here (since they are CC) so they can be used properly.