How can I save memory while rendering?

I know, I can ALD+D instanced objects instead of SHIFT+D them, but that’s not the solution. I already done that on every object it was possible. But are there other ways to reduce memory? For example link objects from other .blend files in a certain way?
Textures and so on are also not scalable.
Edit: (I mean RAM/VRAM of course, not disk space)

If you are using the subdivision modifier on any object, check that it isn’t set to high, especially on objects that are far away from the camera.
Remove anything that doesn’t need to be there including null objects.
Textures for background object could be reduced in size.
Render out in passes, foreground, background etc and re combine in the compositor.
You could try freezing any objects that have modifiers on them.
Bake your textures.
Try different tile sizes if rendering with cycles, I know with mental ray in Softimage, I could lower the render bucket (Tiles) size and that would sometimes reduce the amount of memory needed allowing me to render. Not sure if it works with cycles but could be worth a test.
Just some ideas, hope they help.

1 Like

I tried with using multiple render layers, but my problem is, that it doesn’t really work. I have trees and grass and the trees stand on the grass, so “in” the grass… Do you have any idea how I could do that with render layers? I mean, if I just put the trees and grass in separate layers it surely doesn’t work because of the alpha maps.

You will need to create mattes for the each layer so you can combine them back together in the compositor. Look into cryptomatte.

Other wise you can render out RGB mattes . That is where each object or sets of objects are either pure red or green or blue. So you would render out the beauty pass with just the trees and the beauty for just the grass. Then another pass where the trees are all green and the grass is all blue. You can then use that RBG pass in any compositor to put them back together.

Best thing for you to do is look on youtube for tutorials about using cyptomatte in blender.
There will also be many tutorials about creating RBG mattes on youtube. Even if they are in a different application like maya the workflow is the same.

1 Like

How to use cyptomatte in blender.

This is in after effects showing you how you use RBG mattes, but the same principle applies in any compositor.

The problem with using cryptomattes is the loss of interaction between the trees and the grass. The shadows, reflections and so on. Otherwise that would be a perfect solution of course, but if the trees would not cast any shadows or project them on a flat plane and not on the grass, that would look very weird.
Or do I even understand it right? Or is there a way to use cryptomattes and don’t lose the interaction between the different “cryptolayers” I would call that?

You would also need to render out shadow passes etc. I would recommend playing around with passes using a very simple scene, maybe just a few cubes till you get the hang of it. It can get complex and way more than can be explained here.

If you are just rendering off a still image I would be happy to do that for you. My pc has 2080ti and 32 gig of ram so should be able to handle it.

Otherwise I can take a look at your scene and see if I can get the ram usage down for you.

1 Like

Thanks for the offer to render my scene, but it’s more a general problem.
But if I render just the shadow pass, the memory is exactly the same because cycles has to calculate the objects nevertheless. I already played around with the shadows pass but it doesn’t save memory.
example.blend (1.4 MB)
That’s the example scene. The cube should project the shadows on the “grass” and while rendering there should be either memory for the grass or the cube, but not both.
Do you understand what I mean? I don’t know if I’m speaking too Germanish English

Yea that can be a problem, what is in the scene, just trees and grass?

Uploaded an example scene

Thanks I have taken a quick look at it.
So what I would do is render out the ball as one pass, then the grass as another using render layers.
You will want to put each one into its own collection so you can turn the collections on and off as needed for each render layer.
I would then create another one called shadow, this would have both object in it. I would use an override on the material for this render layer with a simple diffuse shader. This will give you the shadow. You would loose any bump detail in the shadow but that may be ok.

I would also turn on cyptomatte on the shadow pass and use object so you can isolate the objects from the shadow pass and use them to matte everything together.

I am putting my kids to sleep now but if you still have issues let me know and I will set up your sample scene so you can take a look at it.

1 Like

Thanks once again!
Sorry, but not, it’s not okay that I lose the bump details in the shadows on the grass. That’s exactly the point what I mean. I need both. The shadows on the grass and saving memory.
But I think that’s too much what I wish, it probably just don’t work how I want it.
But thanks for your engangement!

By bump details i meant on the texture, so if you had bump on the grass blades you wouldnt get that on the shadow, which may be ok if you arnt that close to the grass, there are ways around it, but creating a simple diffuse with only the bump, but it gets really complicated when you start doing that kind of thing.

So I hate to say the obvious thing… Time to buy more memory :slight_smile:

Oh, then I understood it wrong. I thought you mean with bump the grass. Well, that’s of course not a problem :smiley:
But if I do it with your three layers, the sphere, the grass and then with both, than that’s the problem. I cannot render the shadow layer with both in it because that’s too much memory for my GPU.
But yeah you’re probably right, I have to buy a better GPU or render with the slow CPU.

If you dont use the diffuse texture on the shadow pass and just the bump texture it may be enough to have you render on the GPU, But at the end of the day sometimes you just need more.

1 Like