Want to master Blender? Click here! and get our E-Book
When you purchase through links on our site, we may earn an affiliate commission. Affiliate Disclosure
Last update: April 27, 2021

How view layers can help you render large scenes with less memory in Blender

Sometimes the scenes we work with in Blender are so large that they don’t even fit into memory. In those cases, we get an “out of memory” error when we render in Blender. There are multiple ways to deal with this, but one way that does not have us trade away quality is view layers.

The components needed to separate a scene are the view layers and collections. Turn off a collection for the current view layer with the checkbox next to its name in the outliner. Make sure you have transparent background turned on in your render settings and composite each layer together with an alpha over node to get your finished scene.

Let’s see how we can use view layers to separate our scenes into manageable pieces and combine them later.

How view layers work in Blender

Before we get to the setup, there are some concepts we need to understand. First view layers.

The view layers in Blender 2.8 and later were previously was called render layers in 2.79 and earlier.

If we start with a blend file, it can have one or more scenes. Each scene then has one or more view layers, and each view layer may include one or more collections.

To begin with, we care about the view layers and the collections. Let’s start with view layers.

A scene has collections and for each view layer each collection has some settings that tell Blender how that collection is going to be handled for the view layer.

We can create, rename, and remove view layers. In the application header to the far right, you can see a drop-down menu for scenes and view layers. On the right side of the view layer drop-down there are two buttons. The left one creates view layers and the right one delete the selected view layer.

You need to have at least one view layer to be able to render at all.

View layers have their own tab in the properties panel. However, this panel mostly contains render engine specific settings. Except for the view layer section at the top.

In this section, we have two check boxes. The “use for rendering” checkbox will render the selected view layer when we press F12 and render. This setting is local for every view layer. We can have some view layers that we render and some that we don’t.

The second checkbox, called “Render single layer” will override the first checkbox. This is a global setting that affects all view layers. Having this checked says, “Render only the currently selected layer no matter what other settings are in effect.”

Here is an example: Suppose we have 3 view layers created, but we decided that we didn’t need one of them, then we can deselect the “Use for rendering” checkbox so we don’t waste render time on this layer.

Then we rendered the other two layers by pressing F12 and once those layers where done we could see that the last layer was needed after all.

We can then press “render single layer”, go to the non-rendered view layer and render that separately.

The alternative would have been to check “use for rendering” for the missing layer and uncheck this setting on both the previously rendered view layers.

Much simpler to just check one box. Imagine if you had a hundred view layers that you had to uncheck this checkbox for.

That is essentially all we need to know about the view layers for now. Most of the magic happens with the collections.

Collections and their relation to view layers

All settings that we use to separate a scene into collections can be accessed through the outliner.

Each collection has a few settings that can be set for each view layer.

Some of these settings are hidden by default. To enable them, we need to go to the filter options and enable all the “restriction toggles”.

The settings in the outliner, specific for each view layer are:

The exclude checkbox to the left of the collection name
The eye icon that controls viewport display. This is what we toggle with “H” and “ALT+H” in the 3D viewport. An object hidden in the 3D viewport like this is still visible in the final render.

There are two more settings that by default are hidden that are view layer specific. These are “holdout” represented by a circle and “indirect only” represented by a bouncing arrow.

The only setting that has an effect on memory usage is the exclusion toggle. By disabling a collection from the view layer.

If we divide up a render into two view layers and just exclude half the collections in one of them and do the opposite in the other collection to have them combined afterwards, we most likely will run into some issues.

An excluded collection is truly excluded. This means we miss out on indirect effects on an excluded objects neighbouring objects.

An excluded object does not give any indirect light or reflections. It is like the object was never there.

Because of this we have to intelligently select groups of objects in our scene depending on how close, they are to each other.

A simple example would be to have a collection for foreground objects, another for midground objects and a third for the background and exclude them from each other.

However some of the midground objects may be affecting the shadows and reflections on objects in the forground and the background.

In those cases we might want to include some of the midground objects in the foreground collection and similar for the background collection.

This is where holdout and indirect only come into play.

The indirect only will not render the objects in the collection, but all indirect effects on surrounding objects will be visible.

The holdout flag will leave an alpha transparent hole on the pixels where these objects would have been. This is also what we want because these objects are rendered in full on some other view layer and can then be combined through the “alpha over” node in the compositor.

How to separate a scene with view layers with collections in Blender

Now that you have some theory behind you, let’s look at a practical example of how we can render scenes larger than our memory capacity.

For demonstration purposes we will take a much simpler scene and divide it up. We will start by dividing up a scene using Cycles only. Then we will divide up a scene that uses some Cycles elements together with some Eevee elements.

We will use a simple scene that will easily fit into a computer's memory, but it will show the principles and techniques.

Spectacular! Right?

We have a few objects that are divided up into groups. These groups will represent our foreground and mid-ground objects. The background will be our world skybox with a solid grey color. We also have a plane below that catches shadows and bounce light back on to our objects.

The greater the impact an object has on another, the more we want them on the same view layer.

Here it makes sense to let each group of objects, front, back left and back right be 3 separate groups.

However, we have to take the ground plane into account for two reasons. Shadows, and indirect light. The ground will influence all groups that is significant enough to want to keep its influence available for all groups.

Let’s start by organizing the scene. I create a collection for each group of objects.

Note: For larger scenes, we may already have some kind of organization with our collections based on types of objects instead of position. This is not a problem, since an object can be a member of multiple collections. We can create a new collection and within it, we create additional collections to represent each group of objects based on position. Then we disable all other collections for rendering.

Then I create two additional view layers and name them like this:

  • Front
  • Back left
  • Back right

Next we go to the filter icon and enable the buttons for “holdout” and “indirect only”.

Now we need to make sure we exclude something from each view layer. To save memory the group we remove the least geometry from will be the threshold for how much memory we save.

Now we will configure the view layers. Starting with the “back right” group. Select it from the view layer drop down.

Here I left the plane included together with the “back right” group.

But I want to render the shadow on the plane from the “back left” group, so I keep it included and check “holdout” and “indirect only”. Then I exclude the front group since I don’t need the shadow from that group on the plane.

In the “back left” view layer I excluded the “front” and “back right” groups, but left the “ground” group in there with “holdout" and “indirect only” enabled. This way we keep the bounce light from the plane on the group to light up the underside somewhat.

For the “front” view layer, I excluded the “back left” and “back right” groups since they contributed little to the front group. I again set the plane to “holdout” and “indirect only” so we get the bounce light on the front of the objects.

Before we can render we need to set the background as transparent or it will cover the background elements when we combine them together in the compositor.

Go to the render tab in the properties panel and find the “film” section. Here enable the “Transparent” checkbox.

If you need the background as part of the output, you can go to the view layer tab in the properties panel. Find the “pass” section and in the subsection “light” enable “environment”.

This will render the sky to a separate channel that we can access in the compositor.

Compositing the view layers together

To composite the view layers together, we will need a view layer node for each view layer.

Since we add each layer on top of the previous one we need to start from the back.

Therefore, we start with the “back left” layer and pipe it to the top input socket of an “alpha over” node. Then we plug the “back right” into the lower socket.

The output from the first alpha over node is then piped as input to the top socket in another alpha over node. The bottom socket then gets the “front” group as input.

The last socket can then take the environment pass as input if it is visible in the shot. Here I just input a color that is close enough to the original background color.

Let’s now add some volumetric fog into this scene using Eevee and composite it on top.

Final thoughts

In this article we looked at how to separate a scene into multiple view layers with the goal to render larger scenes that otherwise would fit in our computer's memory. We can use the technique in other scenarios. For instance, when combining elements from different scenes, or when we want to apply different effects to different parts of an image.

This method of separating a scene into view layers may sometimes be the only way to render a scene on lower end hardware. However, as software and hardware evolve this method becomes less and less useful for this use case. But separating and combining view layers will always be useful.

Thanks for your time.

Written by: Erik Selin

Editor & Publisher

Erik Selin
3D artist, writer, and owner of artisticrender.com

Recent posts

Free HDRI images for subscribers!

Subscribers to our newsletter enjoy more value! How about a collection of 40 HDRI skies for free!

Subscribe to our E-Mails

Subscribers to our newsletter enjoy more value! How about a collection of 40 HDRI skies for free!
We don’t spam! Read our privacy policy for more info.
Modal newsletter form (#6)