Bake Wrangler - Node based baking tool set

Oh that sounds pretty cool, i’m actually more interested to see how much faster bakes would be.

What are you baking that takes so long? PRB passes are all super fast…

Oh just do a lot of game assets more the amount im backing and the iterations a single bake might take me 50 seconds every texture. 12 seconds if im iterating on 1k maps first.

Sadly baking is hardly ever something that is perfect on the first go :confused:

Also not a super big deal i more want to see it from a metrics point of view.

I have question about UDIMs… If a UV is at 1.0,1.0 is it in tile 1001, 1002, 1011, 1012, all of them, none of them? I think it should just be in 1001, but blender shows it as being in all 4 tiles…

Anyway I think my UDIM baking is close to working, I just need to figure out how to integrate it with the object splitting which adds a whole layer of complications -_-

1 Like

UDIM’s were originally a quick hack to select the right texture based on the UV range a piece of geometry falls into that was meant to be performant in a shader. Off the top of my head, I believe the “correct” solution is that if a sample falls right on the edge, the UV tile with the highest number wins, simply because it’s convenient to make shaders behave this way. I may be wrong however, so don’t take my word for it.

… or was it the lowest number? :sweat:

A Vertex can and must be in all tiles because a triangle can span as many tiles as it needs.

However, putting triangles across tile boundaries is bad practice, so you might as well not support it. :man_shrugging:

The issue is that because currently blender has no meta data about tiles associated with an object or uv map I have to figure out the UDIM tiles by inspecting the uv map… I can create the tile number with some fairly simple maths, but uvs exactly on the edges throw it out… I’m just going to call them as being in the lowest tile…

for u, v in uvs:
        if int(u) == u and u > 0: u -= 1
        if int(v) == v and v > 0: v -= 1
        tile_no = (int(v) * 10) + int(u) + 1001

My one line formula destroyed by edge cases :stuck_out_tongue:


OK! It will be very intresting for speed testing)

There is a question about margine baking individual objects
It is clear that there is no such function in the blender and you have to invent new workarounds.
I found your setup “Mask Margin”.
I show an example
This is my comlew model

I use global 128 for margin and mask margin in 8k texture

And it works badly

Please note that some islands are blocked by Margin neighbor islands.
I use such own node tree for margin flow

(Mask is UV with 0 margin)
This is the result

Do you think it is possible to implement it in BW for autoflow?

My solution to this when I made Meltdown was to do the margins in the compositor in post using the Dilate/Erode node. However, BW doesn’t use the compositor, and that would be quite annoying and slow to do in Python I imagine.

however, BW uses blend files!

Yes, margins in blender are bad. If you make them too big they will cover adjacent stuff. They work with a single object, but the colors they produce don’t actually seem very good to me any way?

I never bake Normals with margins turned on.

I don’t currently use the compositor in any way. I did experiment with using it and I wasn’t really happy with the results. But it’s also currently the only way I can see to add denoising…

Does the the compositor provide a way to generate ‘good’ margins?

Like, I could potentially abandon using blenders built in margins and calculate my own (which probably needs to use the compositor). But I haven’t been convinced that it produces results that are worth the effort of implementing it…

I mean the main issue is that the margins are generated per object and get layered over each other when multiple objects occupy the same map. What really needs to happen is for the margins to be generated after all the objects are drawn. Also when margins overlap, the pixel colour should be interpolated from the surrounding islands.

Inpaint node kinda works for this, though its interpolation region is way too small…

yeah im not sure as well some times i do my bakes in marmoset as well then use the UV as a mask so i can get the blender bake with marmoset margins LOL

This is inpaint (which blender uses something almost identical to this node internally to make margins) on the left, vs Dilate/Erode smooth feathering followed by inpaint on the right. Which results in less banding of the margins.

I don’t really know how we could achieve the marmoset type margins, if it’s even really possible…

I can sort of imagine a system where I bake the blender margins for each object and then some how blend them together using masks with some sort of linear falloff…

I’m not sure what marmoset does as well but what really helps is they have a smooth slider that basically lets you control how smooth the whole bake will be.

Normals are the most difficult map to get right, thats why you can find so many normal errors in games because at some point you just need to move on.

I’ve currently been working on designing and prototyping software that is a texture capturing and post processing toolkit in rust, i regret choosing rust LOL.

The problem with blenders margins is that it doesn’t handle margin overlap. You really need to keep a gap between your UV islands large enough so that the margins don’t overlap I think… Or you end up with:
Really weird transitions between the island edges… Or super sharp ones if they are close together (these islands are almost certainly too close):

I don’t think I can solve these sorts of problems with the tools I have…

If there is nothing you can do than that’s just how it is.

Ever thought about adding handplane as a pass ?

EDIT: i personally don’t use it i use marmoset but that is payed software and handplanes is free and might let you get away with just letting people swap to it to get something blender can’t do.

I mean, I can make the margins better. But it’s quite a bit of work and they will only be marginally (pun intended) better. You should just avoid overlapping margins :stuck_out_tongue:

I think I could even fix the problem with the bad transitions, but it would only work for UV islands in separate objects, no ones that were part of the same object. Which seems kinda meh…

I don’t really want to add more 3rd party software dependencies unless there is a super good reason. It just makes maintaining the code that much more difficult. Like maybe if there was something I could pass a normal map to and have it produce super nice margins I would think about it… :wink:

Understandable and LOL maybe so far things are not looking good with rust.