Material Inheritance

Path: Click the title bar of any non-global event in Particle View > Event ## rollout

Particle Flow imposes a specific limitation on material usage in events. In particular, a material assigned to an event-either via any standard Material operator or as a parameter of the standard Shape Instance operator-does not travel along with the particles from one event to the next. This diminishes the overall flexibility of a Particle Flow system, and necessitates using some workarounds: Either assign a Material operator to the global event, or assign a Material operator to all affected events.

Box#2 enhances event functionality to improve the overall handling of the materials in a PFlow system. It still does not allow particles to carry a material between events, but it provides an assortment of tools that simplify material assignment and inheritance.

In the context of material assignment to Particle Flow events, a material can be categorized as either parametric or synthetic.

A material is parametric when you use any of the standard Material operators. The operator has a button to define a material from the Material Editor. This material as passed as a reference to the event containing the Material operator to be used by the particles while they reside in this event. Again, this is a parametric material; it's assigned as a parameter in a Material operator.

A material is synthetic when you use, for example, the standard Shape Instance operator. When the operator's Acquire Material is on, it takes the material assigned to the reference geometry and assigns it to the current event. Furthermore, if the operator refers to a group of objects as a Particle Geometry Object, the operator gathers all materials from the group, and creates a new Multi/Sub-Object material to be assigned to the event. In this situation, a new material is synthesized from other materials.

If you click the title area of a global event, you can see the parameters relevant to the whole PFlow particle system. Now, with Box#2, you can also click the title area of a local event and see a few tools related to material handling, and also the material assigned to the event.

Open the included simple example file MaterialInheritance01.max to see how the new Material tools work. The scene has a simple Particle Flow system with four events. It contains no Material operators; the colors of the particles in the viewport are defined by a different Display operator in each event, so that when you play the animation you can tell by their color change when the particles switch events.

Now, add a Material Static operator to Event 01, select it, and assign the "multi-sub" material from the Material Editor (the first slot) as an instance (the default mode), and adjust the Material Static parameters to cycle through the sub-materials. Your event map will look like this:

If you play the animation now, you see that in the beginning, particles all have different colors, but then they switch, as a block, to a different color. This is due to the fact that the next three events have no Material operator, and thus use the Display color in the viewports.

Click the title bar of Event 01 to show the parameters of Event 01, and then click the Downstream Materials button. Particle Flow reports that it has updated three events with a material. Play the animation again; the particle colors are now consistent in all events. Also, if you select the other events, you can observe that now the Current Material button indicates the same material as in the first event.

Next, look at the more complex example MaterialInheritance02.max, also included with Box#2. It has two streams of particles converging to a common stream. The start events have different materials defined by Material Static operators. Once the particles come to the second event (Event 02), they lose their materials. Let's see what we can do in this situation.

Select Event 01 and click the Downstream Materials button. You can examine the material assigned to events Event 02, Event 03, and Event 04, simply play the animation; the result is that all events downstream from the Event 01 inherited the Green material. That does not work well because particles from Event 05 got the Green material as well. We need to fix this situation somehow. The goal here is to allow the particles that originate in the two birth events to keep their original respective materials.

First, try the following: select Event 05 (the start event with the Blue material), and click Downstream Materials button. You might remember that when you clicked the button in Event 01, the software reported "Materials in 3 Events were updated." Now, with Event 05, the report is different: "All Events have valid materials." That tells you that the materials in the downstream events were not changed. If you play the animation or examine the downstream events, you can see that they still hold the Green material from Event 01. Why?

When you click the Downstream Materials button, the plug-in finds all events downstream from the current event, and for each downstream event it triggers Material Update. A material in an event is updated according to its Material Inheritance parameters. If the Inherit type is None, or the event has its own operator that holds a material (any Material operator, or a Shape Instance operator with material acquisition), then the event does not update its material because the material in the event is already defined. If Inherit type is set to Highest Priority then the event looks for its upstream events (Event 02's upstream events are Event 01 and Event 05), checks their Material Priority values, and inherits a material from the event with the highest priority. In this case, both Event 01 and Event 05 have the same Material Priority: 0 (zero). So the result is ambiguous: Event 02 can choose the first upstream event that it finds. To enforce the material inheritance from Event 05, change Material Priority value in Event 05 to 1, and click Downstream Materials button again. Now you can see that the downstream events have the Blue material.

The stated goal remains elusive: The particles from Event 01 change their material from Green to Blue once they come to Event 02. So we need to do something else.

The last option for the Inherit type is Combine Materials. That's the type to use in order to propagate materials properly downstream. Select Event 02 and set Inherit to Combine Materials. Now, click the Current Event Material button to pull a combined material from upstream. Now, if you look at the Current Material in Event 02, it's not the Green or Blue material, but a new material labeled something like Material #10. If you drag the material to the Material Editor, you can see that it's a Multi/Sub-Object material with a single sub-material named "Blue."

Why? Both events Event 01 and Event 05 have a standard material, with Event 05 having a higher priority according to the event settings. Since both these materials are standard materials (as opposed to multi/sub materials), both these materials try to allocate the first slot in the synthetic multi-sub material for Event 02. But Event 05 prevails because of the higher priority value.

To resolve the material collision, it's necessary to adjust either of the materials in Event 01 and Event 05. Here's how: Select the Material Static operator in Event 05, and change the Sub-Mtl ID Offset value to 1 (from the default value 0). Observe that Assign Material ID option is turned on automatically (for a reason to be explained later), but you also need to turn on Show In Viewport in order to see the material effect in the viewport. Also note that the dynamic name of the operator has changed from Material Static 02 (Blue) to Material Static 02 (Blue >> 1), which indicates that the ID offset has been applied.

Select Event 05 and examine the material in the Current Material button (drag to the Material Editor). The material is a true Multi/Sub-Object material with two sub-materials: The first slot is empty, and the second slot occupied by the Blue material. It's now possible to combine materials from Event 01 and Event 05 without a collision.

Select Event 02 and click the Update Current Material button. Examine the material in the Current Material button: The combined material has two sub-materials, Green and Blue. Click the Downstream Materials button to propagate this material to events Event 03 and Event 04.

If you play the animation now, you still can see a discrepancy with the particles originated from Event 01: They turn blue once they leave Event 01. To fix that, you need to turn On Assign Material ID and Show In Viewport in Material Static 01 (Green). Even though the Green material does not have sub-materials, the sub-material indices are needed because later on particles leave the event and become governed by the Multi/Sub-Object materials.

Interface

This section describes the material-inheritance controls that you access by clicking an event title bar as well as an additional parameter, Sub-Mtl ID Offset, that has been added (as of Box#2) to operators that use materials.

Material Inheritance - Defines how a material is assigned to a current event on the basis of the upstream events, and how the current event can influence the materials downstream.

Inherit:

  • None - Does not inherit materials from the upstream events.

  • Highest Priority - From all immediate upstream events, chooses the one with the highest priority, and gets materials from this event.

  • Combine Materials - Creates a synthetic Multi/Sub-Object material from the materials in the upstream events. If there is a collision between different materials and sub-materials, the entity with the highest priority prevails.

Material Priority - Sets the priority value used by the Highest Priority and Combine Materials options for Inherit (see preceding).

Note: if an event contains a Material-type operator, then the event does not inherit materials from the upstream events; the Inherit type option does not matter.

Update Materials group

This group contains tools to set materials in Particle Flow events.

Current Event Material - Updates the current event material by pulling materials from the upstream events.

Downstream Materials - Updates the materials in all downstream events.

Materials In All Events - Updates materials in all events in all PFlow systems in the scene.

Current Material - Shows the material used by the event. This is a read-only property; you can drag a material from this button to the Material Editor for examination, but you cannot drop a material from Material Editor to this button.

Additional Parameter: Material/Birth Group/Shape Instance operators

Sub-Mtl ID Offset - When using material inheritance with a Multi/Sub-Object material, the Material operators, Birth Group operator, and Shape Instance operator add this value to the Material ID value to create a sub-material ID used by Particle Flow to determine which of the material's sub-materials to inherit and thus apply to the particles in its event, based on the sub-material ID in the material.