I have a collection with 40 subcollections in it, which all contain heavy geometry.
I use the Collection Info Node with Instance on points to control, which of these subcollections is visible.
I would expect for Blender to only load the visible instance into RAM, however all objects inside the collection end up being loaded.
While this works fine in the viewport, as soon as I hit render, my RAM starts filling up and crashes my computer. It’s appears as if every subcollection gets loaded into RAM, even if just one is visibly instanced.
I noticed the same behavior when keyframing the “hide_render” checkmarks in the outliner. All subcollections that are set to “hidden” still end up in RAM when rendering, even though just one gets rendered.
Is this intended to work this way?
Have you tried to instead of outputting Geometry, outputting instances?
Instances load up the geometry once and only store the transform matrix for each instance (loc, rot and scale)… where as the geometry makes each instance real, so in addition to loc, rot and scale, its every single face / vert / uv / material index etc.etc.etc.
Dang, that actually might have been the solution, but it turns out the “Instances” socket was just one that I accidentally created (it’s identical to the “Geometry” one).
The problem in my case is that the Collection Info Node loads the whole collection into RAM, not just one of its children.
Hmm it seems to be working as intended for me…
have you tried making that collection that you are duplicating from, exluded from the viewlayer? not just hidden from render/
Yes, I did that.
- Add a monkey to empty collection, give it subsurf 5.
- Duplicate a couple of times and see the memory usage at the bottom of the screen.
- exclude collection from view layer (memory goes down)
- add a single vert object, add geometry nodes.
- drag and drop collection into geometry nodes (memory goes up).
I guess that’s just how Blender works. The data has to be stored somewhere in memory, and as soon as there could be a reference, it needs to be loaded in already.
I appreciate your input nevertheless!
Hmmm it looks fine on my end still.
Have a look at this file – test.blend - Google Drive
Please note that all the ram usages below are for the main ram, not graphics ram
Open the file - ram usage goes up to 156mb to 1.5GB.
Then plug the collection info into the instance input on the instance on points node - ram usage stays consistant at 1.5GB.
Then change the integer number to 0 - ram usage jumps to 2.4gb, changing the particle number does not increase ram here
changing back, doesnt drop it, but save close reopening does (blender doesnt release it on change)
if you now reopen the file back to the standard, and go add → collection instance → instance 2. you can duplicate it as many times as you want but hte ram usage wont go up apart from that initial load up
If you delete all those instances, and then enable up collection 2, duplicating the subsufed suzanne will increase ram usage.
This has been how blender has handled instances for ages. Essentially, if you are able to click on a object and edit it straight away, it keeps it in ram. If you are using something like dupli-collections or dupli-verts or geometry nodes, then it only keeps one in ram and offsets it all.
Just note that from my understanding, this issue is to do with the viewport only, not a render engine (as the render engine ‘should’ only load what is needed)
Thank you very much for taking the time to investigate my problem and for providing the blend file. I looked at it and could verify everything you mentioned.
I probably didn’t state my problem clearly, so I’ll try again. I am aware that adding more instances doesn’t add to the overall ram.
- I expected the Collection Info node to only load exactly one of its children into RAM – whichever is the active instance.
- I did not expect all elements of said collection to end up being loaded.
My problems after hitting F12 for rendering stemmed from subsurf-modifiers that were set to twice the levels for rendering.
I optimized all my assets, cut down on sub-d-levels and bought more RAM and now it’s working fine.
Glad you got it all working!