combine all the highpoly pixel arrays into a single array. I use a global to deliver the correct data to the renderer. Since baking/rendering is a blocking operation no one can bake more than one objcet at the same time anyways.
Details
- Reviewers
Campbell Barton (campbellbarton) Sergey Sharybin (sergey) - Maniphest Tasks
- T41092: Very high memory usage for Cycles baking compared to ordinary renders
- Commits
- rBS394c5318c6fe: Bake-API: reduce memory footprint when baking more than one object (Fix T41092)
rC2015345f93a3: Bake-API: reduce memory footprint when baking more than one object (Fix T41092)
rB394c5318c6fe: Bake-API: reduce memory footprint when baking more than one object (Fix T41092)
rB087ee57dbaa2: Bake-API: reduce memory footprint when baking more than one object [test build]
Diff Detail
- Repository
- rB Blender
Event Timeline
For the records, a final solution via this approach should use R instead of G to store baking_object_id
The biggest thing i don't like about is the usage of Global for such a task. I wouldn't want this G to become worrying about some specific jobs.
| source/blender/blenkernel/BKE_global.h | ||
|---|---|---|
| 100 ↗ | (On Diff #2518) | Don't do this. It's not what G is intended to handle. |
- Merge remote-tracking branch 'origin/master' into arcpatch-D772
only updating the patch, I may resume working on it soon
- Different approach, no longer using G (using Render though)
@Sergey Sharybin (sergey) how about now?
Ok, question: is it possible to pass the object_id via python API rather than requesting it from the Cycles side?
Ok, question: is it possible to pass the object_id via python API rather than requesting it from the Cycles side?
I always assumed the object id is not consistent between Blender and Cycles, but I can look at it. I can see how that would be beneficial here.
An option is to have a RE_engine_object_id_get(re, object). Wouldn't that be more safe-proof?
Just an update against latest master, still waiting to hear from @Sergey Sharybin (sergey) (or @Campbell Barton (campbellbarton) perhaps?)
- Merge remote-tracking branch 'origin/master' into fix-bake-dupli
Tested this patch for the last day,
works fine and reduces memory usage drastically in many cases, thus avoids many crashes with baking.
@Dalai Felinto (dfelinto), i'm still not sure why it's a function of RenderEngine instead and not an argument of bake() function.
- Passing object_id (id of the lookup table) to the renderer (cycles)
@Sergey Sharybin (sergey) you were right, there was no reason not to pass the id for the renderer.