Page MenuHome

Blender ignores linked meshes when rendering in Cycles
Open, ConfirmedPublic

Description

System Information
Operating system: Windows 10
Graphics card: NVIDIA GeForce GTX 1080

Blender Version
Broken: 2.80 beta (2018-11-29 15:57, 26d5a3625ed, blender2.8)
Worked: 2.79 (5bd8ac9)

Short description of error
When using duplicate linked objects, the total amount of memory used to render an image in Cycles is the same as if the linked meshes were single-user copies.

Exact steps for others to reproduce the error
Load the default start-up file.
Set the render engine to Cycles.
Delete the default cube.
Add in a suitably vertex-dense object, such as an icosphere subdivision 6.
Render the file and take note of the memory statistic in the image viewer.
"Duplicate linked" (alt-d) the icosphere 2 or 3 times.
Re-render the file and note that the memory used has increased substantially.
Make each icosphere a single-user copy
Re-render the file and note that the memory used is the same as it was in the second render.


Details

Type
Bug

Event Timeline

The problem is the new dependency graph is duplicating these meshes before they get to Cycles.

We could still try to detect if they are duplicates, but ideally the dependency graph should have this kind of instancing as well. It was always a bit of a hack on the Cycles side to try to figure out when the object has any modifier that could make the result different.

@Brecht Van Lommel (brecht), not sure what you mean by "the new dependency graph is duplicating these meshes". There is a single Mesh datablock, and several Object datablocks in such example.

The way it works internally is:

  • Single copy of the original mesh is created
  • For every object in the dependency graph the new evaluated mesh is created, but it is shares custom data pointers.
  • Modifiers will modify some data in the evaluated mesh, and set those layers as no-referenced.

What we can do is to add some special flag for evaluated mesh, which will indicate that any modifier was run (or we can deliver this from CustomData data ownership flags).

Alternatively, we detect this case in mesh_build_data() and don't create new pointer for an evaluated mesh.