Home‎ > ‎Notes‎ > ‎


How TP Organizes Materials

3ds Max has an interesting architecture that technically requires each object to have just one base material.  That base material can be one of many different types, e.g. Standard, Multi-Sub/Object (aka MultiSO), Raytrace, VRay, fR-Advanced, etc. 

TP uses a special class of the Multi-SubObject (MultiSO) material called a "TP Multi/SubObject Material" (aka TP MultiSO) which allows TP to import and arrange many objects containing different types of materials, including regular MultiSO materials.  

When TP imports many different objects, either via Obj2Particle, LayerToParticle, GeomInstance, or other methods, TP needs to arrange those incoming objects materials into its material tree.  Material IDs must be offset for each incoming object based on the current number of imported objects.  See the "TP Material Tree Example" below.

If you open the 3ds Max Material Editor and pick TP, you will see it appears as a "TP Multi/SubObject" type material.  If you query the class of the material via Maxscript, it will appear as "TP_Multi_Sub_Object"    (type this in Maxscript Listener with TP selected:    classof $.material    )

The first material in TP's "TP MultiSO" material is reserved for the TP object itself, and appears in the Material Editor as "Particle (Standard)".

For each operator that brings in an object & material to TP, a new entry will be created in the material tree, and the IDs offset based on where in the hierarchy that object is brought into TP.

As imported objects become particles and are involved in TP simulations, including Fragment and VolumeBreak which create new faces, TP manages those face assignments and stores them in its complex material tree.

At render time, TP determines the material ID of each face and returns the proper material.

TP Material Tree Example

If we have two Obj2Particle operators in TP and the first one brings in one object who has a MultiSO material with 3 IDs, and the second Obj2Particle imports two objects who have their own MultiSO materials with 2 and 4 IDs, here is how TP arranges it's material tree:
ID 1 will be reserved for the TP object itself
ID 2 will be used by the object coming into Obj2Particle #1, where the first ID of it's MultiSO is assigned as TP's ID 2
ID 3 will be assigned to Obj2Particle #1 first object's MultiSO ID number 2
ID 4 will be assigned to Obj2Particle #1 first object's MultiSO ID number 3
ID 5 will be assigned to Obj2Particle #2's Object #1 MultiSO ID number 1
ID 6 will be assigned to Obj2Particle #2's Object #1 MultiSO ID number 2
ID 7 will be assigned to Obj2Particle #2's Object #2 MultiSO ID number 1
ID 8 will be assigned to Obj2Particle #2's Object #2 MultiSO ID number 2
ID 9 will be assigned to Obj2Particle #2's Object #2 MultiSO ID number 3
ID 10 will be assigned to Obj2Particle #2's Object #2 MultiSO ID number 4

How to Reset the TP Material

Artists sometimes apply materials directly onto the TP node. This is a big problem and should never be done. TP material overrides will no longer work properly.

To resolve this and reset TP's material, follow these steps:

1. Select the TP node (not the TP-Mesher, but the actual TP object) 
2. Open Max's Command Panel and go to the Utilities panel 
3. Run “UVW Remove” and click on the “Remove: Materials” button 
4. Step forward in time one frame 
5. Step backward in time one frame 
6. Render 
7. TP's material is now reset back to its default and material override rules should render as expected.

TP Materials & Pipeline Considerations
If an object only gets PRS info from the simulation we can export and link it in order to update the model or materials

If an object is going to fragment then we must follow the rules below:

• all objects must have a material before simulation (every material is stored when the cache is recorded) 
• every object that we might want to change materials for after simulation must have a unique material before simulation

In order to allow for proper updating of materials we should keep the original TP scene and cache available in case we need to update a material on one of the objects using the built-in “Update Materials” function in TP (which correctly updates the .mat)

Alternatively we could also do one of the following:
1.  Open and edit the .mat and edit it directly (and save back over that existing .mat (make a backup first, too)) 
2.  Create a script which searches the .mat for the object name and replaces instances of that material with the new material (hopefully with same object name)