Node and skeleton coordinate system
Under NW4C, the world coordinate system (WORLD_COORDINATE) and model coordinate system both exist in the matrix coordinate system.
Usually, calculations are made using WORLD_COORDINATE. However, MODEL_COORDINATE can be used when sharing animations among more than one model.
To set MODEL_COORDINATE, specify ResSkeleton::FLAG_MODEL_COORDINATE using
SetFlags.
Node Coordinate System
Calculations for TransformNode and its sub-classes are all performed using WORLD_COORDINATE.
With Model, WorldMatrix is input to UnivReg of the vertex shader and applied to vertices. Meanwhile, with SkeletalModel, vertex shader processing differs depending on the coordinate system.
Skeleton Coordinate System
WORLD_COORDINATE
In the case of WORLD_COORDINATE, SkeletalModel's WorldMatrix is applied to the bone's WorldMatrix using UpdateWorld of SkeletonUpdater.
As such, WORLD_COORDINATE is used for the WorldMatrix of all bones that can be obtained using WorldMatrixPose.
Because WORLD_COORDINATE is used as the WorldMatrix of bones, the WorldMatrix of bones input to UnivReg by the vertex shader are used as-is.
MODEL_COORDINATE
In the case of MODEL_COORDINATE< the model coordinate system is used for the WorldMatrix of bones when calculating using UpdateWorld.
The model coordinate system is used for transforms from the root bone.
Because the WorldMatrix of bones uses MODEL_COORDINATE, the WorldMatrix of SkeletalModel is applied to the WorldMatrix of bones input to UnivReg by the vertex shader.
Sharing Skeletons
To share skeletons, they must be calculated using MODEL_COORDINATE.
To set MODEL_COORDINATE, specify ResSkeleton::FLAG_MODEL_COORDINATE using
SetFlags. After creating
SkeletalModel, to be used as the base, get the skeleton to be shared using
GetSkeleton, and then pass it to
SharedSkeleton of the
SkeletalModel::Builder class. By creating SkeletalModel in this way, a new SkeletalModel can be created while the base SkeletalModel maintains ownership rights.
A SkeletalModel that shares skeletons can be rendered by performing updating and rendering as usual after creation.
For details on implementation, see
MultiInstanceDemo.
Overwriting the World Matrix of Nodes or Bones
Handling Scaling
Accumulated scaling, including one's own nodes and bones is calculated when the world matrix is updated by SkeletonUpdater. The scale given by
Transform and
LocalTransformPose is for one's own nodes and bones, while the scale given by
WorldTransform and
WorldTransformPose is an accumulation of scaling factors from the root node to one's own node.
CONFIDENTIAL