Bake Wrangler - Node based baking tool set

I’m going to try to commit to having a beta of the next version available in the first week of March. I have to go away for a week and don’t have a laptop that I can really use to develop stuff on and need to study for Biology exams. But assuming I don’t get trapped somewhere by a new lock down I should have enough time (and hopefully energy) to get something ready enough to try out.

1 Like

Thanks, Albedo works fine, also Emisiion works too for me

Sorry for my rushed previous (and now deleted) post, it seems that it wouldnt bake because half my objects were marked as non-selectable. But this is the first time i use the addon to bake a model that consists of a higher number of meshes (15), and i ran into two issues.

  1. Some objects don’t show up in specific bakes, like in this image. They are from the same bake, and in the remaining passes all other objects can be seen just fine. I can fix this by creating a new pass node and bake the missing objects again, but then i have to combine the images externally.

Edit: Okay i found that in my spagetti mess i only had some unconnected sockets, but i think this only reinforces my second point.


2. I needed 30 Object nodes and 15 mesh nodes to bake each object, wouldn’t it be easier to match and bake objects based on their names?

It has been discussed before. But there are a lot of posts so I will recap:

Essentially the released versions up to this point have been focused on getting everything working correctly and providing bake passes for most of the things people want. Automatic high to low matching was just a bit outside the scope.

Also while I’ve done a bit of work improving the UI there is still more to be done. Like I said above I’m trying to commit to having something out in the first week of march that will have some of the UI changes.

Matching objects by name is certainly something we can look at then. It’s umm, not super simple because often mappings are not 1:1 (multiple high mapping to a single low). Think about how you normally name things and get back to me on exactly what you would need. This really goes for everyone, to describe their workflows and how things can be done to improve them. I will sent an email out to everyone who bought it soonish and ask for input.

Hi there.

I’m in the process of setting up a “non destructive” pipeline script for preparing meshes with modifiers and procedural shaders for export to game engines.

Basically the flow Im seeking is that I want to be able to create my “assets” using multiple objects, multiple shaders per object and then completely automate the process of baking all these shaders onto a “merged” mesh (Im creating a new mesh in my script and using a union boolean modifier merging all the meshes that are a part of my asset to a single mesh, then unwrapping with Blenders UV project and packing using UVPackMaster 2).

Now could I configure my bake wrangler setup directly from within my script? What I need to set is:

  • The objects to bake from (which will be many, up to several hundred. I could put them all in a single collection if that helps)
  • The mesh to bake to (a single mesh)
  • Texture resolution, cycles “tile” resolution (since Cycles bakes are like ridiculously slow if you dont set the tiles to your texture res)
  • Cycles sample count (I always set this to 1 as I dont typically bake anything like AO in Blender)

I will also need some kind of handle/way of continuing my script after that Bake wrangler has finished all of its baking, so that I can run some after-baking bpy code.

For the rest of the setup I think I could just reuse the same node graph for pretty much all my assets, which I suppose I could just append from another .blend file and then somehow tell bake wrangler to use it? Right?

Im also curious if there are any limitations when baking metallic, specular and other Cycles shader based bake types which are not supported by Cycles baker. Are there any nodes/node setups which are not supported/could cause issues (like putting a bsdf inside of a node group for instance)?

Lastly while Im well here, are there any options for automatically converting textures for DirectX based renderers (Unreal Engine to be specific)?

Would love to see some up to date demo of the addon also (since there seems to have been quite a lot of stuff added since the video linked on the original post here in the thread was uploaded).

Cheers :slight_smile:

1 Like

Also I just kinda assumed that baking from several objects to another is supported for all PBR bake types, is that correct?

The specific maps that Im looking for are:

  • Albedo
  • metallic
  • roughness
  • emissive
  • opacity
  • normal, if possible as high to low res baking pass combined with normals manipulated from the shader graph of the high res meshes. But since bake wrangler is in the node graph I suppose this would work quite easily with some math nodes?
  • subsurface
  • clearcoat

Hi,
I just noticed that the addon is crashing on 2.91.2. Is it a known issue? I have attached the crash file it produced.
Works fine for the same scene and settings in 2.90.1

BW_BakeTest1_2_90_001.crash.txt (27.5 KB)

It says on top of the blendermarket page that 2.91.2 is incompatible.

Like you said 2.91.1 should work, so should 2.92

yes… now I understand… thanks

Hi nether, Idk if you saw my previous questions but I just bought the addon and noticed there are no standard color/math nodes (like the MixRGB etc).

Do you think you could add some common nodes as such?

EDIT: I also cant seem to get it to use my GPU (tried setting it under the pass node > Device), but my GPU usage sits at around 3% during the baking so Im guessing its still my CPU thats doing the work.

I have a GTX 1060 6gb

EDIT 2: Another thing is that if you use the texture normals bake pass and has nothing plugged into the normal slot of your principled bsdf it will output black atm (I bet its just not writing anything). Maybe you could solve this by adding a color setting to the clear image option in the output image path node (so that you could manually set it to the normal “default” of 128, 127, 255)? Otherwise if you were to add math/MixRGB nodes I suppose you could fix this as a user that way around (I really want to see some math/MixRGB nodes :stuck_out_tongue: )

I have been away, so only looking at your posts now… Are your original questions answered? Adding many objects to be baked to one is very easy if you use Collections (just select what ever collection as Source and the single object as Target). Tile size is actually automatically set to texture size for many ‘emit’ type passes (most render stuff can be overridden)

Your GPU is almost certainly being used, but blender generally doesn’t tax the GPU very much for baking, especially if you aren’t doing lighting passes. I don’t actually know why that is the case, but a single blender instance just doesn’t seem to use that much. You can run multiple different bakes at the same time if you want and while I didn’t really design it with this in mind, you can use Bake Wrangler to launch a bunch of different bakes (each using a separate node tree) at the same time. Your log file will probably look a bit garbled though.

If you have no texture normals, it doesn’t draw anything. It’s certainly possible it should draw it as blue instead… I’ve written about Mix an Math nodes before and the problems/limitations. There will be more capacity to do ‘post’ processing of bake data in the next version. I’m interested to hear from people that want mix or math type functions: What exactly do you want and how do you plan to use it?

Well welcome back then :slight_smile:

I’m interested to hear from people that want mix or math type functions: What exactly do you want and how do you plan to use it?

The 3 use cases Ive found so far would be that issues such as this with the normal thing could be easily fixed user-end with support for it. Another is that it could help packing shaders that has PBR values above one (so that you can manually divide by 10 or whatever before packing) (however I dont think the baker supports values above 1 anyway as is, couldnt get it to pack anything in HDRI range at least(?)).

And lastly Im currently setting up a system where Im packing multiple PBR channel into each texture channel (Im very certain not a lot of people do this lol). But the idea is that I can use math formulas like

15*16+13=253 (storing the values 15 and 13)
253%16=13 (unpacking 13)
(253-(253%16))/16=15 (unpacking 15)

to store and unpack multiple values into one. So if I have a 32 bit channel I could using the method above for instance store 4 PBR channels with a bit depth of 4 (could be useful for some game assets that the player never view from up close).

Im currently solving this last “use case” by using imagemagick however, so Im first baking out all my textures into individual BW .exr files and then using image magick to pack it using a similar math formula as described above.

Another use case is implementing stuff like sRGB manually (which is useful when packing linear data along with sRGB into the same texture).

But Im sure theres plenty of stuff you could do lol

If I was to write a wish list for what math functions/operators that I would like to see it would be something like:
Multiplication
Division
Addition
Substraction
Modulo
power
log
Floor
Combine/Separate rgb

Alternatively maybe just make 1 math node that lets you write expressions that gets handled by python in it? Like you hook up a input node and then you get a variable “a” that you can use in the expressions, hook up another and you get variable “b”.

And also, I didnt quite figure out how I can know when the script have finished running?

Like I mentioned above Im currently planning on using image magick for my packing and I would like to be able to then automatically run my image magick script as soon as all my maps are finished.

You can run multiple different bakes at the same time if you want and while I didn’t really design it with this in mind

Not to be too demanding of you, but if it would be easy to implement some kind of multithreading? For some asset that Im using as testing my bake takes around 11 minutes currently (around 1 minute per PBR bake). Otherwise I will just make sure to launch several bakes at once in the future :slight_smile:

Another thing that I would like to see is the ability to bake the output of certain nodes in your shader graph. Like if I want to bake the IOR input to a fresnel node for instance.

Remapping the RGBA channels isn’t a problem, you can do that in the current version though it’s going to work a bit differently in the next version and hopefully be easier and better.

Doing maths on the values also isn’t a problem from a programming perspective, but it turns out that python is very slow when dealing with large data sets. So for performance it’s better to use functions built into Blender. I have some ideas on this which we can test out.

I’m not sure about getting values greater than 1 from a bake, maybe someone else knows the answer. I can look into it.

Getting values out of different nodes in your shader presents problems. The way to do it currently is just hook the value up to an input of your BSDF that you aren’t using and bake that input (use clear coat or something). I can think of two alternatives, one would be a bake pass that lets you enter a node name and value name. It would require you to use consistent naming and could be annoying. Alternatively to that would be adding a shader graph node with say 10 numbered sockets and a bake pass that lets you pick one of those 10 sockets as the input value.

For simultaneous baking, maybe a node similar to the Batch node except it executes ‘x’ inputs simultaneously and each input would need to not have dependencies on each other… I’m unsure how useful it would be because you have Memory usage vs GPU/CPU usage. It’s possible that if a single bake instance is being throttled it’s a memory issue, but it seems worth experimenting with.

Finally as to triggering when the process finishes, that’s a bit tricky to do in Blender as it is currently. I think I would need to add a function to the BakePass operator that your script could poll to find out when it had finished…

Like I’ve been saying I hope to get a beta type thing of the next version out within about a week. It’s all been mostly ready for the last couple of months, I just haven’t been able to finish up the last bit yet.

2 Likes

Hello I love this addon it really makes the tasks of baking very easy and useful. Thanks a ton!

I don’t know if this suggestion was made previously but if it hasn’t been made here is my idea:
Can you add something so the baked maps/textures are saved into blender file instead of saved to an external location? Cause sometimes you may forget to adjust some setting (like island margin) before baking and it can be useful to see the results immediately. Plus this way you can save the textures the way you want them to look. Since you can just click on “Image” and “save as” anyways that seems like a simpler method to me than to going to the folder it is saved and constantly dragging that to the shader editor manually to see how it looks. But this is really just a small addition that may speed up the workflow.

I don’t want to impose this of course so ideally something like a checkbox to toggle would be ideal or a different image output node. But it might be more difficult if it is modular like that so I just want to leave the suggestion and you can evaluate if that is a good idea or not. I saw some post about color space before, so I do not know how this would effect the whole ordeal but I just wanted to put it out there.

All in all, thanks for this addon. It is absolutely fantastic. Thanks for making and supporting this addon :heart:

Thanks for the insights :slight_smile: Everything of what you said sounds good to me. Regarding baking output of different nodes I would personally prefer your first suggestion with bake pass based on named nodes to minimize node spagetti.

Like Tailguneer1 said. Thanks for making and supporting this addon. I would likely just give up on making textures for my game assets in Blender if it wasn’t for the existence of this.