Principled Baker (for blender 2.8 and 2.79) (bake PBR textures from Principled BSDF nodes)


(sirmaxim) #61

First, thank you! This is what I’m doing manually and it’s a pain. I was considering ways to script it, but this is very, very handy if it works the way I think.

This appears to be baking everything except normals with emit? If so, you should set the samples to 1 as you don’t need more than one when baking emission. Normals should have a good sample rate though if you’re going to bake that way.

FWIW, it is possible to bake tangent normal maps using emission as long as it isn’t selected to active:

Selected to active with that can require some troubleshooting if it works at all and your displacement has to be set to bump only to get anything useful out of it. And it then has to be merged with geometry normals. Overall, it’s a pain.

My workflow is bake a selected -> active normal, save as 32-bit full float exr and then merge other normals on top of that base to bake the final textures. I also convert that to a curvature for material mixing, but that’s another matter.

Does this work with more than one material at a time? I’ve only had a brief glance at the code.

Output even with exr appears to be 8 bit. Is this a bug? I don’t see a bit depth setting anywhere.

(DanielEngler) #62

Yes, the only exceptions are normals and emission itself. Settings for samples in the add-on are on the TODO list.

That’s why the add-on uses only blenders build-in baking functions. More fancy stuff is a little out of my realm right now.
Are tangent space normal maps needed?

You can have multiple materials per object. Only the auto detection does not check, if a material is assigned. (possible future feature?)

It’s an annoying bug. :roll_eyes:
Saving results per hand works find, but that’s missing the point of the add-on.

Thank you for your help over there and your feedback!

(sirmaxim) #63

The standard normal bake type is a tangent space normal map so that’s already covered. :smiley:

My comments about it are simply that it can be done with an Emit bake type with the right nodes between the normal and emission bsdf as long as you’re not trying to get geometry normal information from a high poly. If you’re thinking about the tangent socket on the principled bsdf. I have not used it and I don’t think other engines actually support that anyway. It’s for anisotropic (brushed metal pot effect).

The ‘right nodes’ I mentioned, will not work properly selected>active (normal is geometry node):

It can also be useful to bake AO, though that can have complications. I was hoping it would respect normal/bump, but it appears that it doesn’t. However, the AO node does have a normal input and it appears to work pretty good. Might be worth looking for a way to mix the normal inputs to bake it (emit would work for this node). Or perhaps using several AO nodes for each normal input mixed might be easier to do, if longer to bake.

(DanielEngler) #64

Okay. Normal maps still confuse me in all directions. :smile:
Blender does the job for us. That means nothing to do for us here and no need to limit selected to active bake.

Good you’re asking. AO is already on the TODO list. I thought about the same to use the new AO node to do this. Baking from the ‘AO’ output of nodes is possible.

Next update should be done in the next days.

(DanielEngler) #65

update 0.2.0:

  • 16/32 bit support
  • image settings
  • samples setting
  • Glossiness (invert Roughness) option
  • progress feedback (cursor)
  • Ambient Occlusion from node (for testing)
  • backport to Blender 2.79
  • bugfixes

(Simon) #66

I’m getting this error in windows 10 in v2.80.45:

Traceback (most recent call last):
File “C:\Users\Simon_Desktop\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\Principled-Baker-master\”, line 1070, in execute
if not self.settings.use_overwrite and self.exists_new_bake_image_file(, job_name):
File “C:\Program Files\Blender Foundation\blender-2.80.0-git.6bab905c9d40-windows64\2.80\scripts\modules\”, line 659, in getattribute
return super().getattribute(attr)
AttributeError: ‘PBAKER_OT_bake’ object has no attribute ‘exists_new_bake_image_file’

location: :-1

Having selected the high res then low res, I get this error messing when hitting the bake button. Any workarounds?

(Simon) #67

Just ticked the ‘Overwrite’ option, it did SOMETHING and claimed it was baking an AO, but the texture was just a black constant. After waiting a while for a response, I received this error message:

Traceback (most recent call last):
File “C:\Users\Simon_Desktop\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\Principled-Baker-master\”, line 1127, in execute
del new_mat[MATERIAL_TAG]
KeyError: ‘property not found in group’

location: :-1


(DanielEngler) #68

update 0.2.1:

  • fixed: selected to active missing image file check
  • fixed: selected to active wrong texture names
  • fixed: empty material slots errors

Thanks for your bug report! Found an other bug this way.
I hope everything works now.

(Simon) #69

And thankyou for the addon! :slight_smile:

Can’t wait to test again!

Kind regards,


(smadoc) #70

Awesome, I see that you updated the 2.79 one as well. I haven’t worked on the project i wanted to bake the textures on in a while, still need to convert, or try converting some to principled, which I’m going to try and work on today.

Also, funny enough (unrelated to your plugin), on my desktop 2.79 crashes due to something in the drivers for gpu, but 2.80 works. On my laptop, 2.80 has UI glitches and corrupts the user preferences for 2.79. When I load 2.79 on the laptop after trying 2.80 the UI…the layout for 2.79 looks rather similar to 2.80, and i get a warning saying eevee isn’t installed lol

Anyway, I’ll give your plugin a try again if I can get at least one of the textures converted to principled.

(sirmaxim) #71

Did you import your 2.79 settings when you setup 2.8? That might be the issue.

AO testing. Not sure what it’s supposed to do, but here’s what I imagine it should do:

(DanielEngler) #72

There is a bug with AO and colors. I’ll fix it as soon as I can.

Baking AO works this way: The AO channel is baked from the ‘AO’ output only (currently only one AO node in tree supported). I think that’s what you mean.
The color has to ignore the color output from the AO node, because the AO is mixed in the color. This gives as results: pure color without AO and AO as single channel.

(Simon) #73

I just somewhat succesfully tested a lowpoly only bake of the shader node tree. I’m impressed with how closely it resembles the original. Though One thing I noticed is that it seems to hit a limit with how many nodes it can process. I have an object that has several shaders mixed into the material output, and each shader shows, but some of the colour ramps I mixed into the RGB channels don’t show.

(smadoc) #74

I don’t think so. Usually, I just delete the “old” 2.80 and unzip the new one. I don’t think I import the settings. Most of the time as soon as the splash pops up I click to get out of it, but I suppose anything is possible lol.

I’m not an expert with such things, so not sure if this applies, but I seem to remember seeing something about there being a limit in blender its self when it comes to textures or nodes…or something, but I’ve never run into it, so can’t say for sure.

(DanielEngler) #75

Can you share the setup, please. A short description should be enough. This sound like a bug, and might not be covered by my test files.

(Simon) #76


Unfortunatly it’s NDA :frowning:.

But you could set up something similar layering several principled shaders by mask and having 2 layers of mixed color ramp nodes per shader, masked by curvature or something similar.

(DanielEngler) #77

I can totally understand that.

I can’t reproduce errors with several mix shader nodes connected to masks and other mix shader nodes and principled bsdfs as well.
Can you provide only the part of the basic structure of the tree, that produces the error without any(!) image texture? No mask texture, no color, metal, etc. Just replaced by noice, voronoi, or any generated texture. So you can not violate the NDA.

(Simon) #78

I’ll see what I can do :slight_smile:

Kind regards,


(Simon) #79


I seem to have had better luck baking this time around. I love the ability to transfer the new baked textures into a new material, and that worked pretty nicely. Although my node network was a bit simpler, this worked quite well this time around.

The only issue I had this time around was that it seemed to multiply the vertex normals into my normal map which isn’t something I wanted. Say I had already baked the normals, and I just want to mix in some heigh details. If I don’t have ‘selected to active’ It should just be taking a snapshot of the normal as it would appear straight from the node tree right?

Kind regards,


(DanielEngler) #80

In one of the early versions the input color of one Normal Map node was just copied. It did not use the normal bake of blender. It hat too many limitation, like it could only bake from a normal map node.
To achieve this again without loosing mixing and Bump, etc. nodes, I can build in an option to bake without auto smooth. I didn’t though about it till now!
I’ll build that in the next version. Till than you can temporarily disable auto smooth.