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

texturing
add-ons
free

(ViAdvena) #41

Thank you for your work, now it’s working just fine!
Can we expect to see progress bar when it’s baking?


(ViAdvena) #42

And I have one question: I set margin to 16px but on texture it’s not applied…


(DanielEngler) #43

update 0.1.7:
bugfix: margin not applied


Thanks for your feedback! You found an other bug!

That’s already on the nice-to-have-feature-list. When I find the code in blender, I can implement this feature.


(ViAdvena) #44

Yeeeh! Power of community, so cool :muscle:

Good news! I will be watching on updates :nerd_face:


(Emir Sinan Gürlek) #45

Hi @DanielEngler , thank you for the great plugin!

Adding 16-32bit option for displacement and normal maps could be nice. It’s almost a necessity to get rid of banding effect etc.

Also there might to be a problem with TIFF and TARGA formats as I can’t open them in Photoshop (They open fine on GIMP though).

For vector displacement baking you should check @Secrop 's ShaderNodesExtra addon. In short it adds a DisplacementBake node which lets you bake position map, then you feed that position map to object vector displacement and bake.
Maybe you could simplify the process and include in your addon?


(DanielEngler) #46

32bit float is on the TODO list.

I’ve no clue how to solve the issues with TIFF and TARGA. For saving I’m just using the blender build in function image.save(). Maybe some formats don’t like messing around with the pixels (image.pixels[]).
Also, I don’t have photoshop, what makes testing a little difficult.

I’ll take a look into DisplacementBake. To be clear. You mean this: https://www.youtube.com/watch?v=vgKjn1mV2hI
Unfortunately, I can’t even install add-ons in 2.80 right now. They just don’t show up in the list. Files and settings removed, fresh unpacked. Nothing.


(Emir Sinan Gürlek) #47

Yeah, I mean that.
Also consider implementing this:


(smadoc) #48

EDIT: Not surprisingly it was my fault. HAHA. I thought I tried installing the one for 2.79 by its self, but just tried it again after removing all of them and installing again and it seems to be working now, and shows up in the “T” tool panel, on the last tab. Now…using it that’ll be another fun adventure, but looks pretty simple. :slight_smile:

Now of course I have two other issues. One is some of my materials don’t use the principled shader so I’ve either got to convert them (would be good node experience I guess) or use blenders built in baking.

Also, so far I haven’t had luck with getting this addon to work. I set the path, and the other options but nothing happened when I hit bake. One texture doesn’t use the Principled shader, the other texture does, but only for bump, and it only had a diffuse color set, with out a node being plugged into it. I’m guessing that may be why it’s not working. I’ll try later with something else though.

My original problem

Read through the comments and didn’t see anyone else mention this being a problem, so maybe I’m not doing something right…

I downloaded both Principled-Baker and Principled-Baker_for_2.79 addons, Installed via “Install add-on from File” button.

It seemed to work, as I could enable it the first one, but with the first one but don’t see the options in the node editor properties section.

The 2.79 version won’t enable it comes back with this when I try to enabled it:

Syntax Error
Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\modules\addon_utils.py", line 331, in enable
    mod = __import__(module_name)
  File "C:\Users\Sma\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Principled-Baker-master\__init__.py", line 32, in <module>
    from . pbaker_settings import PBAKER_settings
  File "C:\Users\Sma\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Principled-Baker-master\pbaker_settings.py", line 15
    use_autodetect : BoolProperty(
                   ^
SyntaxError: invalid syntax


I also tried uninstalling both and just installing the one for 2.79 and got the same error message.

Any help is appreciated.
Thanks,
Sam

Oh, also I found this from the Blender Procedural Texture group on Facebook.


(DanielEngler) #49

Not necessarily. Other nodes are supported, too.
btw: The add-on uses the build in baking. :wink:

If “Autodetect” is enabled, only linked inputs (like Color, Roughness etc.) and inputs with different values in different nodes (good example is Metal) are will be considered.

I confused myself with 2.79/2.80 add-ons, too. :smile:


(smadoc) #50

Ahhh good to know. :slight_smile:

I think the problem I’m coming across now is some of the materials I’m using don’t easily go into a single principled shader. One, in particular, I’m trying is a procedural rust texture (which I suppose has its own problems when it comes to being baked to an image texture) that uses multiple diffuse colors that get mixed with various factors to produce a material that has essentially rust underneath a paint color. Not a node mixing expert so its going a little slow atm, but I won’t learn if I don’t try lol.

I must be missing something. What does it mean if when I click the bake button nothing happens? I tried to bake a test texture, forgot to unwrap it first, hit bake and it worked, created a blank png, but gave an error. After unwrapping the object (a cube with some bevel) and trying again nothing happens.

I’m not using many of the principled inputs, just a diffuse color (white) for metallic and a noise texture run through a color ramp and bump map for normal. I’m also using two different principled shaders that are being mixed with a mixed shader.


(DanielEngler) #51

Objects with no UV map causes errors. That’s a bug! I’ll fix this tomorrow.
Arg! I hope you didn’t save or have a backup. Some materials might be messed up.

This simple setup should work fine.


(DanielEngler) #52

update 0.1.8:
new: Auto Smart UV Project
bugfix: no UV map as potential input error


(smadoc) #53

Ahh that explains it. Don’t think the one object I was testing it on had UVs, but don’t remember now haha.

As far as backups go, I switch back and forth from laptop and desktop and usually save on a network drive as well so I end up with 3 copies of a file at some point lol. If the material did get messed up I can likely fix it easily enough. :slight_smile: I’ll try the updated addon and let you know how it went.


(smadoc) #54

Ok, back to the same problem I was having before haha.

EDIT: Oh, and no, it doesn’t appear to have messed up any of the materials. Which reminds me…if a material isn’t principled at all that’s a problem right? Haha, I just remembered the scene I just tried doesn’t use a procedural texture yet (it’s a texture that has paint, but with random spots of multi colored rust). I’ve gotta figure out how to convert it to one, or maybe I’ll ask the original creator if that’s possible. Problem is, my thought process at the moment would be to use multiple principled shaders running into mix nodes…hmmm

It seems like the only one that works (and by works I mean, it allows me to enable it) for me is the 2.79 version you did what, 8 months ago? I downloaded your new updated version, installed from zip file, expanded it to confirm it was 0.1.8, but when I clicked on the check box to enable it, it gives the same error I had above when trying to enable it. This was in 2.79 btw.

Original Error in 2.79

Traceback (most recent call last):
File “C:\Program Files\Blender Foundation\Blender\2.79\scripts\modules\addon_utils.py”, line 331, in enable
mod = import(module_name)
File “C:\Users\Sma\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Principled-Baker-master_init_.py”, line 32, in
from . pbaker_settings import PBAKER_settings
File “C:\Users\Sma\AppData\Roaming\Blender Foundation\Blender\2.79\scripts\addons\Principled-Baker-master\pbaker_settings.py”, line 15
use_autodetect : BoolProperty(
^
SyntaxError: invalid syntax

I just tried it in 2.80 (is it supposed to be run in 2.79 or 2.80?) and while I was able to enable it, when I tried to use it it gave an error about UV project. I then did a UV unwrap (because…duh me… it sort of has to be done to bake textures haha) and tried to run it again and got a different error. Both are below:

New Error in 2.80

Traceback (most recent call last):
File “C:\Users\Sma\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\Principled-Baker-master\pbaker_bake.py”, line 801, in execute
if self.settings.use_smart_uv_project:
AttributeError: ‘PBAKER_settings’ object has no attribute ‘use_smart_uv_project’

location: :-1

bpy.data.screens[“Default”].shading.type = ‘SOLID’
bpy.ops.object.editmode_toggle()
bpy.ops.mesh.select_all(action=‘SELECT’)
bpy.ops.object.editmode_toggle()
bpy.ops.object.editmode_toggle()
bpy.ops.uv.smart_project()
Traceback (most recent call last):
File “C:\Users\Sma\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\Principled-Baker-master\pbaker_bake.py”, line 835, in execute
self.guess_colors(obj, job_name)
File “C:\Users\Sma\AppData\Roaming\Blender Foundation\Blender\2.80\scripts\addons\Principled-Baker-master\pbaker_bake.py”, line 197, in guess_colors
node_types = ALPHA_NODES[job_name]
KeyError: ‘Emission’

location: :-1

Not sure if I’m doing something wrong, or I’m just finding bugs that didn’t present themselves to you haha. I know how it is though, you do all the testing you can think of and others find problems that didn’t show up for you. :slight_smile:

At any rate, thanks for your work on this so far, at some point it’ll work for me I’m sure! Sorry for any headaches this is causing you.


(DanielEngler) #55

You found a bug. I can’t fix it tomorrow. It looks like mixes with emission nodes don’t work right now.

Principled-Baker is for Blender 2.80
Principled-Baker_for_2-79 is what the name says and outdated! I changed the initial post to make it more clear. I’ll fix the bug you just found and make a backport to 2.79 in a few days.


(smadoc) #56

Wooo yay me lol. Although I don’t think the material I was trying to bake has an emittion shader, unless that is the bug…lol.

I should have figured that one version was for 2.79 and one for 2.80, I guess I did figure it out eventually haha.

I Did a test with two principled shaders in one material, and as I figured it didn’t work that well. I’ll have to figure out how to mix colors into one principled shader.

I’ve been using some procedural materials from blenderinsight, and he’s got some new ones for 2.80 that are princpled and work pretty good with your plugin. I might be able to look at those and convert the materials I need. I’m sure he’ll get to it eventually but I really should learn how this stuff works, plus the sooner I can get them converted the better, as I’d like to try baking them and get an animation I’m working on started rendering. An 11 second video at the moment would take around 2 or 3 days to render, and the whole video is longer than that…but…I’m kind of veering off topic here haha…