Class ZivaRTPlayer
A ZivaRT runtime component that can be attached to a GameObject. When configured properly this will allow for Ziva to be used to deform skin a mesh.
Implements
Inherited Members
Namespace: Global Namespace
Assembly: Unity.ZivaRTPlayer.dll
Syntax
[RequireComponent(typeof(Animator))]
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
[ExecuteInEditMode]
public class ZivaRTPlayer : MonoBehaviour, IAnimationWindowPreview
Fields
DrawDebugVertices
Draw the vertices of the imported ZivaRT asset's rest shape in the Scene view. Can be useful to diagnose vertex mapping issues.
Declaration
[Tooltip("Draw the vertices of the imported ZivaRT asset's rest shape in the Scene view.")]
public bool DrawDebugVertices
Field Value
Type | Description |
---|---|
bool |
SuppressGeometryWarningMessages
Don't print out warnings about issues discovered with the mesh, eg: degenerate face UVs.
Declaration
[Tooltip("Silence warnings caused by issues found in the Source Mesh' geometry, e.g. degenerate UVs.")]
public bool SuppressGeometryWarningMessages
Field Value
Type | Description |
---|---|
bool |
Properties
AnimationRoot
The animation root for which the animation should be applied from
Declaration
public Transform AnimationRoot { get; set; }
Property Value
Type | Description |
---|---|
Transform |
AutoBounds
Automatically generated bounds used for visibility culling.
Declaration
public Bounds AutoBounds { get; }
Property Value
Type | Description |
---|---|
Bounds |
CalculateMotionVectors
Should motion vectors for deformed positions be calculated?
Declaration
public bool CalculateMotionVectors { get; set; }
Property Value
Type | Description |
---|---|
bool |
CustomBounds
The custom bounds used for visibility culling.
Declaration
public Bounds CustomBounds { get; set; }
Property Value
Type | Description |
---|---|
Bounds |
EnableCorrectives
Whether to apply pre-skinning correctives from the ZivaRT solver (generally used for debugging).
Declaration
public bool EnableCorrectives { get; set; }
Property Value
Type | Description |
---|---|
bool |
EnableSkinning
Whether to apply skinning to the mesh using the ZivaRT solver (used for debugging).
Declaration
public bool EnableSkinning { get; set; }
Property Value
Type | Description |
---|---|
bool |
ExecutionSchedule
Should deformation calculations be started manually, in the LateUpdate phase or normal Update phase?
Declaration
public ZivaRTPlayer.ExecutionScheduleType ExecutionSchedule { get; set; }
Property Value
Type | Description |
---|---|
Ziva |
GameObjectRoot
The GameObject root for which the animation should be applied from
Declaration
public Transform GameObjectRoot { get; set; }
Property Value
Type | Description |
---|---|
Transform |
Implementation
Select which internal implementation is used to perform the deformation. Different implementations have different properties (CPU vs GPU).
Declaration
public ZivaRTPlayer.ImplementationType Implementation { get; set; }
Property Value
Type | Description |
---|---|
Ziva |
MeshRescale
Scale factor that should be applied to the Ziva RT vertices to match the mesh scaling applied on the imported mesh file
Declaration
public float MeshRescale { get; set; }
Property Value
Type | Description |
---|---|
float |
MultithreadedJointUpdates
Should joint transform updates execute on multiple threads? This delays solver execution to LateUpdate
Declaration
public bool MultithreadedJointUpdates { get; set; }
Property Value
Type | Description |
---|---|
bool |
RecalculateTangentFrames
Should the solver recompute target mesh normals and tangents each frame?
Declaration
public RecomputeTangentFrames RecalculateTangentFrames { get; set; }
Property Value
Type | Description |
---|---|
Recompute |
Rig
The ZivaRT rig asset used to deform the target character mesh.
Declaration
public ZivaRTRig Rig { get; set; }
Property Value
Type | Description |
---|---|
Ziva |
SourceMesh
Source Mesh that will be deformed by the Ziva Rig. A copy will be created for the deformation which means this source mesh will not be modified directly.
Declaration
public Mesh SourceMesh { get; set; }
Property Value
Type | Description |
---|---|
Mesh |
UseCustomBounds
If this is true then custom bounds are used for mesh visibility culling. If this is false then bounds are computed automatically.
Declaration
public bool UseCustomBounds { get; set; }
Property Value
Type | Description |
---|---|
bool |
UseMeshTransformForRegistration
Apply the local transform of the Skinned Mesh during vertex correspondence registration step.
Declaration
public bool UseMeshTransformForRegistration { get; set; }
Property Value
Type | Description |
---|---|
bool |
Methods
AddExtraParameterOverride(string, ExtraParameterOverrideValue)
Adds an override for an extra parameter identified by 'extraParameterName' this function is slow and should only be called once on initialization.
Declaration
public void AddExtraParameterOverride(string extraParameterName, ZivaRTPlayer.ExtraParameterOverrideValue extraParameterOverrideValue)
Parameters
Type | Name | Description |
---|---|---|
string | extraParameterName | The name of the extra parameter to override. |
Ziva |
extraParameterOverrideValue | The reference to the extra parameter value. Changes to this value will take effect without having to call this function again. |
BuildPlayer(byte[], GameObject, float, ZivaRTBuildOptions)
Builds ZivaRTPlayer component and adds it to a GameObject
Declaration
public static void BuildPlayer(byte[] buffer, GameObject zivaObject, float meshRescale = 1, ZivaRTBuildOptions options = ZivaRTBuildOptions.Default)
Parameters
Type | Name | Description |
---|---|---|
byte[] | buffer | The byte array containing raw .zrt asset data. |
Game |
zivaObject | The GameObject to which ZivaRTPlayer will be attached to. |
float | meshRescale | The default scale. |
Ziva |
options | Available options when building the player. |
GetExtraParameterNames(List<string>)
Adds the names of all of the extra parameters in this ZivaRT asset to the list.
Declaration
public void GetExtraParameterNames(List<string> extraParameterNames)
Parameters
GetMotionVectors(Vector3[])
Motion vectors. Not available if Compute Shader or Mono implementation is selected.
Declaration
public void GetMotionVectors(Vector3[] motionVectors)
Parameters
Type | Name | Description |
---|---|---|
Vector3[] | motionVectors | The differences between current and previous frame vertex positions. |
GetNormals(Vector3[])
Final vertex normals after ZivaRT correctives and skinning have been applied. Not available if Compute Shader implementation is selected.
Declaration
public void GetNormals(Vector3[] normals)
Parameters
Type | Name | Description |
---|---|---|
Vector3[] | normals | The vertex normals with correctives and skinning applied. |
GetPositions(Vector3[])
Final vertex positions after ZivaRT correctives and skinning have been applied. Not available if Compute Shader implementation is selected.
Declaration
public void GetPositions(Vector3[] positions)
Parameters
Type | Name | Description |
---|---|---|
Vector3[] | positions | The vertex positions with correctives and skinning applied. |
GetTangents(Vector4[])
Final vertex tangents after ZivaRT correctives and skinning have been applied. Not available if Compute Shader implementation is selected.
Declaration
public void GetTangents(Vector4[] tangents)
Parameters
Type | Name | Description |
---|---|---|
Vector4[] | tangents | The vertex tangents with correctives and skinning applied. |
RemoveExtraParameterOverride(string)
Removes an override for an extra parameter identified by 'extraParameterName'
Declaration
public void RemoveExtraParameterOverride(string extraParameterName)
Parameters
Type | Name | Description |
---|---|---|
string | extraParameterName | The name of the extra parameter to stop overriding. |
RunSolver()
Runs the ZivaRT solver in it's current configuration. Note that by default the solver is already run if the object containing the ZivaRT component is visible. This method should only be used in advanced scenarios where there is a requirement to explicitely invoke the solver.
Declaration
public void RunSolver()
ScalarName(int)
Returns the name of the scalar at 'index'.
Declaration
public string ScalarName(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the scalar. |
Returns
Type | Description |
---|---|
string | The name of the scalar at 'index'. |
ScalarValue(int)
Returns the value of the scalar at 'index'.
Declaration
public float ScalarValue(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the scalar. |
Returns
Type | Description |
---|---|
float | The value of the scalar at 'index'. |
ScalarsLength()
Returns the number of scalars in this ZivaRTPlayer component.
Declaration
public int ScalarsLength()
Returns
Type | Description |
---|---|
int | The number of scalars in the Ziva |