Blender 3.1.2 Optix Texture Bake (on dense Mesh)

Sooo, I’m trying to bake a node setup into a diffuse texture on veeeery dense mesh.(7.6M Vertices)
Right now the bake is stuck at 0%. I’m reading out GPU usage with GPU-Z (atm its at 7% Load). My CPU with standard windows task manager (at 15-20% usage). RAM is at about 50% usage. I don’t know if Blender uses CPU or GPU for the initialization, but either way its not using all the resources.

CPU: AMD Ryzen 5 1600 (6 Core 12 Threads 3.6Ghz)
GPU: Nvidia RTX 3070ti
RAM: 32 GB 3400Mhz

Blender Settings:
Engine: Cycles
Preferences: Optix (GPU only)
Feature Set: Experimental (tried Supported too)
Texture Size: 4096x4096
Tile Size: 4096
Samples: 16
Denoising: Off
Bake: Diffuse, Color Only

Also I have to say, I used the same Node Setup for a Mesh of about 200k Vertices with exactly the same settings and that one just blazed through within under 30 seconds. Soooo, is there a Vertex limit for baking or am I missing something else?

Edit: I also just saw that in the console it states:
ImportError: cannot import name ‘Mapping’ from ‘collections’ (F:\SteamLibrary\steamapps\common\Blender\3.1\python\lib\

The evaluating of the shaders and the raytracing happens on the GPU. But the rasterisation of the uvmap polygons is done on the CPU. Also the generating of the margin is a postprocessing step that happens on the CPU, and in the case of the AdjacentFaces method that does scale with the number of polygons.

You could try to set the margin size to 0 and see if it makes a difference.

1 Like

Since you are baking only Diffuse color you can lower samples from 16 to just 1.
This will decrease baking times.

1 Like

the margin size was on 0, but putting it on 0.001 did the trick just now. Now it also works with 8k textures very fast.

huh? That’s really strange. The margin generation is purely a postprocessing step that happens after the actual baking. A margin of 0.0 or 0.001 shouldn’t really make any difference either. Maybe that it being larger than zero means the margin generation gets called (instead of skipped completely), but as .001 pixel gets rounded down to zero I’d expect it to not do anything. This is a bit suspcious.

We are both talking about the UV margin? Like when i go UV smart project → margin size

Oh that margin. I was talking about this one.

It would have been very strange if that made a difference . You can’t even set it to .001 I think ;-).

In your case it means it tries to bake the same pixel multiple times from different polys which hangs or is very slow. That’s actually an interesting bug to try to look into once.

It’s obviously wrong if the uvmap has overlaps, but it should not hang IMHO…