Working with Xref Assets
Overview
Xref objects in 3dsmax provide a flexible way of referencing external scenes within other scenes. This allows for creation of 3dsmax scenes which act as assets that can be included into other production scenes and updated separately by multiple departments.
Ornatrix provides a workflow to use Xref scenes containing hair assets inside other scenes with the ability of separating the distribution surface of the hair from the Xref scene. This means that only the hair groom itself can be Xref'ed, while the object to which it applies can be located inside another scene.
Applying Xref grooms
Working with Xref hair assets |
First step to using this workflow is to create a scene where you save some hair placed onto an object. This hair can be a modifier stack starting with your base mesh, followed by the Guides from Surface modifier, or a Guides from Surface object which references some object within the scene. On top of this modifier/object you can have any normal Ornatrix hair stack. The scene needs to be saved as a *.max file.
Then, inside another scene, you need to use the Reference->Xref Objects menu and select the other .max file containing your hair asset.
The Xref hair asset will be placed inside your scene. At this point the base object will be brought in along with the Xref'ed object and there is no way of changing its distribution surface to be one of the objects inside the current scene using default 3dsmax UI.
There are two ways to change the distribution surface of the Xref'ed hair object to an object within the scene:
- Recommeneded way: Select the Xref hair object and use the MaxScript listener to execute the following command:
OxOverrideDistributionSurface $ $DistributionMeshObject
DistributionMeshObject is the name of the node which you want to assign as the distribution mesh. - Another way to do this is to right click on the Xref object, select Properties, and then in User Defined tab add the following text:
OxSurfaceOverride = $DistributionMeshObject
After doing this you need to save and reload the scene.
Once you set the distribution object override it will be automatically applied to the Xref objects and persist after you reopen the scene. To remove this override simply clear the OxSurfaceOverride
user property from the scene node and reload the scene.
What happens internally
To perform the distribution surface override Ornatrix goes through all of the Xref nodes within the scene and finds the ones that contain Ornatrix modifiers and objects. It then manually replaces the base objects within an Ornatrix modifier stack, or set the distribution surface in Ornatrix object if it is used as the base object. This step is performed right after a scene is loaded and after OxOverrideDistributionSurface
MaxScript command is executed. Therefore, the functionality outlined in this document will not happen if Ornatrix plugin is absent from 3dsmax installation.
OxSurfaceOverride
user property is assigned to the target node to which the distribution object will be assigned. The value of this property needs to be a MaxScript string which will evaluate the object within the scene at runtime. For example, this is also a valid way of setting this property:
OxSurfaceOverride = maxOps.getNodeByHandle 5
MaxScript reference
The following MaxScript function sets and clears the distribution surface override:
OxOverrideDistributionSurface [targetNode] [distributionNode]