← All ideas
  • Published 15 Feb 2019

Reduce object redundancy with modifier references, mutliple node material outputs

When doing more complicated work, I often have to create redundant copies of objects for various techniques. I need one copy of an object for one render pass, one copy of an object with only some modifiers to be used as the target of modifiers by other objects, etc. These redundant objects have to differ in important and sometimes subtle respects, so linking can't always be used to keep them in sync. Dealing with these slightly modified objects can be a pain, and the difficulty involved limits what I try to do with Blender-- many things are possible to imagine, but too complicated to implement in a reasonable way.

A lot of this could be streamlined for the Blender user with three techniques:

  1. Rendering objects once for each material output node present
  2. Creating a reference modifier that allows a copy of the mesh to be referenced by other modifiers, which can be placed anywhere in the modifier stack.
  3. Adding dropdowns to material output nodes that allow them to specify the render layers in which this node path will be used, and modifier reference to use as the mesh (from 2 above).

Multiply rendered objects

For a good example of where this would be useful, consider fast edge lining techniques used in rasterizers, where the mesh is displaced along normal a fixed amount and only the backface is drawn, creating an edge around the object. In Blender, this requires the creation of two different objects so that they can have different materials: your basic render, then the additional, displaced mesh (using experimental true bump, in this example.) This is a good example, because this is essentially a material characteristic, even though Blender requires multiple meshes to pull it off.

However, if Blender were to render the object once for every material output node present, this would only require the user create and manage a single object.

Reference modifiers that can be organized in the modifier stack:

I think this can be most easily understood by comparing to physics modifiers, which can be organized in the stack in such a way that physics doesn't have to take all of an objects modifiers into account. But this can be extended to other, non-physics features.

A good example of this is a surface deform modifier, which for its bind requires that its target maintains a fixed number of vertices. One of the things that means is that if you want to surface bind to a subdivided mesh, you cannot use Simplify features to limit subdivision, or the bind will break. Your workaround currently is duplicating the surface deform for multiple binds, or duplicating the object driving the surface deform, so that you have a rendering copy and a non-rendering copy.

But if you could create a reference to a mesh at a certain point in the modifier stack, you could place this reference above any subdivision modifiers, then target this reference rather than the object directly. At this point, you could add additional generate modifiers below the reference without worrying about breaking the bind.

There are tons of possibilities here. You could boolean with an object before or after it was displaced, without duplicating the object. You could vertex weight proximity from a mesh before it was deformed by an armature. Etc. As it stands, all of this requires the creation of additional, non-rendering object copies.

Reference and Render Layer parameters for material output nodes

I think that people who use multiple render layers are well acquainted with having to use multiple copies of objects. Often, additional render layers are used to render additional information about objects to be used in compositing. This often means creating linked copies of objects, with their own materials, each of which have to be managed independently.

If you allow a single material to specify different behavior for different render layers, these objects no longer need to be managed independently. You can have a main render in one layer, while you map ray length in an alternate render layer.

If the reference modifiers I advocate are added, these can also be used as parameters for a material output node. This would allow an object to have modifiers that only applied to its use as a target for other modifiers, but not to its rendered appearance, without making multiple copies of the object.

Implementation

All of this could be implemented in an add-on. What needs to happen for this to work is not so complex.

In order to manage renders, a script can be run that can make duplicate copies of any objects, one for every material output node, and assign each the nodes leading to each material output node. Objects can be hidden from render layers on the basis of specified render layers in the material output.

References can be done similarly, by creating hidden objects whenever a reference modifier is created. All this reference modifier has to do is tell the hidden object to update whenever the main object has any changes. The only difference between the main object and the hidden reference object is that the hidden reference mutes all modifiers after the reference modifier.

Likewise, at render time, main objects or hidden reference objects can be hidden from the render as specified in material output nodes.

66.7%

Development Status: Open

Upvote 2 Downvote 1
vasiln
15 Feb 2019

3 Comments

Vyach

Just asking: did you tried cryptomat and instancing?

vasiln Author

* @ Vyacheslav *

I haven't used cryptomatte-- just Googled, looks like a 2.8 feature? It sounds like it could be helpful for some things, and I'll look into it more.

Linked data is nice (as are some other techniques that might be called instancing) but I often need meshes that are the exact same, except in some specific way. The number of specific ways that they can be different is unfortunately infinite, and various bits of linked data can't handle that. The suggestions I made are aimed at expanding the ways that a single object can be used in a more flexible way than instancing allows.

Vyach

* @vasiln * usually in blender studios use custom scripts for such specific purposes. Or, may be, dupliface or particles.