Merging Geometry Data¶
Guerilla is able to merge geometry information from different archive files. Primitive variables (called primvars) such as P (position), N (normal), st (texture coordinates) can be freely overloaded from another file. Here are some example where this is useful:
- Merging st texture coordinates from a static mesh into the animated mesh, so the animation department is not required to export them, or the lighting department can upgrade them independently from the animation.
- Merging vertices position and normal from a simulated mesh into the animated mesh, so the lighting departement can work using the animated data, and upgrade to the simulation when it is delivered.
- Combining both previous strategies.
This example diagram shows how one can organize the data flow so animated positions and normals are coming from the animation stage, while st coordinates is coming from the UVs stage, both UVs and animation being decorelated. Additionally, simulation can be integrated on a selection of objects (typically clothes, skin.)
Guerilla indexes data and meshes in geometry archive using the archive file name and an identifier inside that archive. You can find these indices in the Geometry > Geometry Filename and Geometry Path attribute of each Primitive. You have to provide those 2 pieces of information (file path and identifier) to Guerilla for each primvar to merge.
For example, let's consider the left hand mesh of the hero character. The Asset.abc contains T-pose modelling and texture coordinates:
It is animated in Anim.abc, along with other animated characters and props, without texture coordinates:
Notice that the mesh has a different identifier in both abc files. The mesh eventually breaks down as:
- topology: file Anim.abc, id /characters/hero/lefthand/lefthandShape
- P: file Anim.abc, id /characters/hero/lefthand/lefthandShape
- N: file Anim.abc, id /characters/hero/lefthand/lefthandShape
- st: file Asset.abc, id /hero/lefthand/lefthandShape
To proceed with rendering the animation with updated st coordinates, we'll simply merge the st coordinates from the Asset.abc file.
Use the PrimVarOverride RenderGraph node to setup the primvars to override. Each node can specify several primvars to override within same archive file. Each variable will then have a dedicated identifier in that file.
lefthandShape of hero has a PrimVarOverride
The PrimVarOverride overrides st1 coordinates to Asset.abc, /hero/lefthand/lefthandShape
In the case all archives have identical hierarchies, it is possible to replace the PrimVarOVerride identifier with $(GeometryPath) (or simply an empty string.) This is a shortcut for the object's own GeometryPath value.
This also allows to override multiple objects at the same time.
The primvar identifier accepts $(VAR) expressions, where VAR can be:
- GeometryPath which expands to the object's Geometry Path attribute
- Any MaterialOverride value
- Any Dynamic Attributes value
- Any environment variable.
In case the hierarchies cannot be properly matched, it is still possible to add Dynamic Attributes before export and retrieve this piece of information while merging primvars.
lefthandShape has a Dynamic Attribute assetPath, which is the reference shape identifier in the Asset.abc
The PrimVarOverride node is set so the st1 override expands $(assetPath) with the corresponding Dynamic Attribute, that is /hero/lefthand/lefthandShape in our example.