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

add-ons
texturing
free

(Altgrsgs) #21

Really nicely made, thank you!


(DanielEngler) #22

update 0.1.3:
port to blender 2.8

It’s just a port. no bug fixes.


(özgür) #23

Hi, thanks for sharing
Blender 2.79
79

Blender 2.80.35 (update 0.1.3)
2%2C80
Bake ??


(PixelPete) #24

Awesome! Great to have this in 2.8, thanks!


(DanielEngler) #25

Err, how the hack did that happen? I’m fixing …

update 0.1.4:
bugfix: missing bake button


(Roberto Sánchez) #26

Hi. Great work. I’ve tried to install the addon (0.1.4) in blender 2.8, i’ve added the files to the addons folder, the addon is showing in the preferences, and i can enable it, but can’t find it in the UI.
Where can I find it?


(DanielEngler) #27

The tab is in the properties panel of the Shader Editor. Also in Compositing and Texture Node Editor, but this is a bug!

I’m currently reworking the add-on, because there are a number of bugs and missing features.


(MikaKettunen) #28

This add-on is amazing! Very useful! Thank you DanielEngler!


(Roberto Sánchez) #29

Thank you man!
I’ve managed to find the addon and used it a bit. It’s amazing. Thank you very much, I know how hard is to code this kind of things.
I wanted to report a little… bug? that I’ve found… When, in a shader, you have multiple output material nodes (i use them a lot to preview the result of the output of some nodes in the node tree) the metallic channel renders to black in all the baked textures. (For example, if I have a principled node with a red color in the diffuse channel, and it has the metallic slider set tu 1.0, the baked color texture renders black instead of red) In order to get the baker to work, I have to delete all outputs nodes and leave just the final one.

I dont really have a problem with it, but I thought the possibility of making that a feature. Would it be posible, in the addon, to have the possibility to pick wich output node to bake? That would be useful in a case were the user wanted to test, for example, two differents color combinations for a given material. He could configure one node tree with two outputs, and just pick up the one he wants to bake. Besides, there would be no need to erase manually all the outputs nodes placed for testing (i´m sure im not the only one doing it).
It is just an idea tha came to my mind, I don’t know if it would be possible to implement.

Have a good day!


(DanielEngler) #30

Yes, that’s a bug. I’ll fix it with the next release, that should be done in a few days. I’m currently reworking the confusing UI besides fixing bugs. So, thanks for reporting.

There is an easy solution for this. Just let the active Material Output node be the one for baking. This way you get what you see.


(Roberto Sánchez) #31

But, if I have more than one output, the metallic bake fails… xD
Anyways, would it be cool to be able to pick up the desired node from the addon itself (a list?)
If the node tree is very big, navigating trough it to find the desired output node could be confusing or time consuming, so the list might help. :slight_smile:
I have a bit of experience with coding, but I dont know anything about python and blender programming. But I am willing to learn the basics and try to implement that feature myself :stuck_out_tongue:


(DanielEngler) #32

You have to have a Metallic input linked or at least two Metallic values with different values somewhere in the node tree. That it’s not working with the current version is a bug.

A list in the UI will work fine for one selected object. For more selected objects at the same time (batch baking or multiple selected to active) the list will become a unnecessary confusing heap of Material Outputs. I want to keep it as simple to use as possible.

You can always make a fork. No problem with that!
I was familiar with Python before. All I learned about writing add-ons for Blender I did with this and the other add-on I made.


(Roberto Sánchez) #33

What about this… a button that says something like… batch procesing, you press it and an outliner-like window with all the output nodes listed (or thumbs views) shows up, where you can do multiple selection over them, you select the ones that you want, click ok. And then bake.
The addon UI would only need to show that litlle button. The pop up window or panel for node selection would be showed only during selection and would go away with user confirmation or cancelation.
If that still doesn’t appeal to you… well no problem. If I had how to pay you to implement that feature, I’d do it, cause I’ve been already missing it. But, since I live in Venezuela and is virtually imposible here to do e-payments… or have the money (at last for me) Then I’ll try to find the time and knowledege to implement it myself, along with an option for inverting the output of the channels (useful for some PBR workflows like unity, where the metalness workflow uses a glossiness map for roughness)
Again, many thanks for the Add on, it is amazing. :slight_smile:


(DanielEngler) #34

An option (EnumProperty) with “bake active Material Output” (default), “bake selected Material Outputs”, “bake all Material Outputs” is possible. An issue will be the texture names/file names/paths that have to be unique and consistent, to prevent accidental overrides. I might put this on the todo list, but with low priority.

The inverted roughness for glossiness workflow is already on the todo list.
(btw: Unity supports roughness workflow. But I understand, that people want to keep a consistent workflow through an entire project.)


(DanielEngler) #35

update 0.1.5:
autodetection: support for more shader nodes
new UI
bugfixes


(ViAdvena) #36

Hello there! I wanted to try your addon but I got an error :disappointed_relieved:
This kind of addon would be very useful for me. Please help me.
My Blender 2.80 build: 8a51af7d1c98 (2019-01-31)

Traceback (most recent call last):
File “/home/viadvena/.config/blender/2.80/scripts/addons/Principled-Baker-master/pbaker_bake.py”, line 720, in execute
image = self.new_bake_image(obj.name, job_name)
File “/home/viadvena/.config/blender/2.80/scripts/addons/Principled-Baker-master/pbaker_bake.py”, line 388, in new_bake_image
image = self.new_image(image_file_name, image_alpha)
File “/home/viadvena/.config/blender/2.80/scripts/addons/Principled-Baker-master/pbaker_bake.py”, line 335, in new_image
image.save()
RuntimeError: Error: Image ‘Cube_color.png.003’ could not be saved to ‘alfa/TMP/Baker/Cube_color.png’

location: :-1


(DanielEngler) #37

Oh, that’s a stupid bug. :confused:
The image file path (on Linux) should start with a ‘/’ (eg. ‘/path/to/image.png’)
As a workaround you could try to put a second slash before the file path, like this: ‘//alfa/TMP/Baker/’

I’ll fix this tomorrow.
This happens when you test on Windows only. :roll_eyes:


(ViAdvena) #38

Thank you for answer. I’ll be waiting for updates)
And it’s great that I participated in testing your great addon on my OS :nerd_face:


(ViAdvena) #39

By the way if you could implement baking in Eevee it would be super awesome!
Don’t understand why Blender devs push me to bake in Cycles every time when I need it…


(DanielEngler) #40

update 0.1.6:
bugfix: file paths
other bugfixes

File paths should be working properly, now.


That’s out of my power. :smile:
I already thought about temporary changing to Cycles and after baking back to Eevee. But I had some crashes with the alpha and beta just by changing the render engine. So i dropped it. This could be an option, till the blender devs make baking in Eevee possible.