This page is currently available only in English


Cinema 4D MoGraph

Table Of Contents


MoGraph

Redshift provides extensive integration with Cinema 4D's MoGraph tools. Generic object attributes as well as MoGraph clone attributes can be accessed in the Shader Graph through User Data nodes. When combined with Redshift's powerful shading nodes, unique shading effects,as well as per-object shading variations can be implemented in a simple, logical way. Furthemore, Cinema 4D's Render Instances, are converted to Redshift's native instances, which permit rendering a large number of clones with minimal rendering overhead.



Basic Workflow

Let's take a look at how to set up some random colors for a MoGraph Cloner object, using a Random effector to drive clone attributes. After that we'll use Redshift's User Data nodes to access this information in the Shader Graph through.

First of all let's create a basic cloner object with a sphere to demonstrate the basic workflow between MoGraph and Redshift.


Cloner Object


Next we want to apply a Random Effector to our Cloner enable the color mode. We also disable the position parameter, because we only want to effect our colors. We now have a random color value assigned to each of the spheres from our cloner object, as seen in the viewport. We also want to make sure the Min/Max values of our random effector is set to 0 - 100%, so that we don't have any negative color values.


Random Effector


Lastly we want to apply a default RS Material to our cloner and set up a User Data node to read our clone data. Let's open up the Shader Graph Edtior and Renderview, drag in a Color User Data node and connect it to our diffuse channel of our material. We want to set our Attribute name, to one of the predefined options under the MoGraph sub-menu, to Color. Which in turn is RSMGColor, used specifically to retrieve the color of a clone. Our clones are now taking on the color driven by the Random effector.


To find out more about the supported User Data attributes, please consult the User Data Reference section.


Color User Data


We can also change the seed of our random effector to produce various colors. We can combine that with Redshift's Color Correct node, to shift the Hue of our colors as well.


Random Effector


Material Variations and Per-Object Shading

Typically a single material produces identical visual results when applied to distinct objects. In these cases we can achieve per-object shading through the use of alternative UVs, Weight-Maps, Vertex Colors or other per-vertex data. While Redshift supports such workflows, it also offers a number special User Data nodes which can access built-in or custom,per-object attributes and parameters in the Shader Graph, as well as Switch nodes which can be used to divert the shading of an object. We can combine these two types of nodes to create multiple shading variations from a single, common material graph.This is especially useful with MoGraph clones, and so Redshift offers all of the clone attributes through User Data. This allows us to recreate most of the Cinema 4D's Multi-Shader or Variation-Shader workflows right in the Shader Graph.


To find out more about the supported User Data attributes, please consult the User Data Reference section.


Using Object Attributes

Let's take a look at how we can use a RS Color UserData node to drive the color of individual parts of our model from a single shader.

First, let's apply a new Redshift material to our model and open up the RenderView and the ShaderGraph Editor. We want to drive our diffuse color from the Display color of each object. So we bring in a RS Color UserData node and connect it into the Diffuse Color input of the RSMaterial node.


Color UserData


Next we need to set the attribute name in the Color User Data node. We can use the attribute preset menu by selecting the Objects category and then Display Color option. Now the color we have assigned to each object will be coming through our RS material. There are a few other options such as Object Color and Layer Color in the Objects category. For more details see the User Data Reference section.


Display Color


Using MoGraph Attributes

Let's take a look at how to use Mograph UserData to add randomization to our Cloner setup.

Here we have a basic collider setup of some objects and a floor, and a basic material setup with the Redshift logo applied to our object in the Layer 1 channel of the RS Color Layer node. First we want to add a Random Effector to our Cloner setup to apply a random color our clones. We can disable any other randomization options, but we also need to set our Min/Max to 0-100% because we don't want any negative colors. Lastly we want to enable the Color Mode.


Mograph Setup


Now we want to relay the MoGraph clone information to Redshift through UserData. So let's open up our Shader Graph and bring in a Color User Data node and connect this to our Base color of our Color Layer node. In the UserData node's Attribute Name parameter we open the preset menu and choose te Color (RSMGColor) option under the MoGraph category. We are getting random per-clone colors. We can go back to our random effector and change the seed to get different colors.


Color UserData


For further customization options we can insert a Color Correct node between the Color User Data and the Color Layer node. Now we can use the Color Correct node's Contrast and Hue Shift parameters to tint the incoming clone color.


Color Correct


Now let'ss take a look at how we can take advantage of some of the other attributes. Let's use a Scalar User Data node to add some variation to our RS Material's roughness. We drag in a Scalar User Data node and use Geometry ID Normalized attribute from the Object category. This User Data generates a pseudo-random floating point number from zero to one. Let's connect this to Roughness material input, and take a closer look through a Specular Lighting AOV to see the effect clearly.


Note

While the Geometry ID UserData varies per object, the underlying geometry is shared when Render Instances are used, and so all instances will share the same Geometry ID value


Scalar UserData


Let's take a look at how we can work around this using a Mograph Attribute. First let's enable Render Instances on our Cloner object and go back to the Shader Graph. Instead of Geometry ID we will repurpose the MoGraph Weight attribute.


Scalar UserData


So we need to adjust the MoGraph attribute that corresponds to this User Data. In our Random Effector we want to set our Weight Transform to a value above zero. Now we are getting different roughness values for our objects even though they are Render Instances.


Random Effector


Multi-Shader

Let's take a look at how we can use a Shader Switch node to apply multiple material or textures to our clones.

In the following scene we have some falling keys, set up as Render Instances through a Cloner object. We'd like to apply a different alternating materials to them. To do this, first add Shader Switch node to our material's Shader Graph.


Shader Switch


Next we are going to set up the different sub-materials that we will use in our setup. We are going to add four RSMaterial nodes, set up with diffrerent presets (Plastic, Copper, Gold, and Lead). Then we connect these to the Shader Switch node inputs Shader 0 through 3. We also want to connect our Shader Switch to the output. At this point we see only the blue plastic material coming through because, we have not setup the Shader Switch Selector input, and so by default it always uses the first input  (Shader 0).


Shader Switch


Now let's take a look at how to distribute these materials randomly throughout our cloned objects. First we bring in an Integer UserData and select the Object ID (RSMGID) preset under the MoGraph category. We also need to add an RS Mod node. This will be used to limit the range and wrap-around the MoGraph IDs from our user data. We want to set the Divisor parameter to the number of shaders we are going to switch between, which in this case is 4, that is shader inputs 0, 1, 2 and 3). Then connect we connect the output of the RS Mod node to Selector input of the RS Shader Switch node.


Shader Switch


User Data Reference

Common UserData

RSObjectColor

RSDisplayColor

RSLayerColor

RSGeomIDColor

RSGeomIDColorAlpha

RSGeomIDNorm

RSObjectID

RSGeomID

RSGeomIDAbs


MoGraph UserData

RSMGColor

RSMGIDRatioColor

RSMGIDNorm

RSMGIDRatio

RSMGWeight

RSMGCloneOffset

RSMGTimeOffset

RSMGFalloffWeight

RSMGID

RSMGAltID

RSMGSize

RSMGUVW