1
$\begingroup$

Goal

My goal is to keep a single source of truth while allowing instances to modify a few expected parameters (a material for example).

This way I can create a small object in a separate file, and create instances of it in many different files. Each instance would allow me to override a param from its default value for the material.

If I ever need to change all objects of that type, I'd just modify the main one.

It's a bit similar to Object-Oriented Programming, but using Blender objects instead.

Unreal Engine 4 has exactly this concept that I'm looking for when it comes to materials: https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/MaterialInstances/

Does Blender Cycles have this concept of params for materials? Does it also have the concept of instances?

Example

File: Ball.blend

  1. Created a Sphere called Ball.
  2. Apply a simple diffuse material. By default the color is red. Instances of Ball should be able to choose a different color, so I want to create a param called 'color' for the material.

File: Beach.blend

  1. Shift+F1 to Link Ball into this file. Any changes made in the original Ball will be reflected here.
  2. I want to change the color of the ball to green, so I override the param 'color' to 'green'.

I could decide later that all balls should be glossy, so I could apply this shader to the main material and all balls are now glossy while maintaining the green color for my instance since I'm expecting a parameter in the material called 'color'.

$\endgroup$
  • $\begingroup$ There are instances, and you can link them from other files, what we currently lack is a clean way to provide material overrides; for groups in an easy way at least; using scripting it may be doable. For individual objects libraries you can easily override materials using built-in tools. Improvements in that area are planned for the upcoming new version 2.8 $\endgroup$ – Duarte Farrajota Ramos Dec 1 '16 at 3:09
  • 1
    $\begingroup$ You are looking for drivers. As I just saw it in another question have a look at the CGCookie flexrig - the ui part of the rig lets you change colours in the materials. $\endgroup$ – sambler Dec 1 '16 at 5:07
3
$\begingroup$

This can be accomplished with Node Groups.

Grouping nodes can simplify a node tree by allowing instancing and hiding parts of the tree. Both material and composite nodes can be grouped.

Also nested node groups are supported. I.e. a node group can be inserted or created inside another node group.

For example, creating a 'GlossyMaterial' shader group with an input for color. Node Groups can be linked/appended across files and shared between many material instances.

Further resources:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.