1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[]> 2<html xml:lang="en-US" lang="en-US"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <meta http-equiv="Content-Style-Type" content="text/css" /> 6 <link rel="stylesheet" href="../../css/document.css" type="text/css" /> 7 <title>Node and skeleton coordinate system</title> 8 </head> 9 <body> 10 <h1>Node and skeleton coordinate system</h1> 11 <div class="section"> 12 Under NW4C, the world coordinate system (WORLD_COORDINATE) and model coordinate system both exist in the matrix coordinate system.<br /> Usually, calculations are made using WORLD_COORDINATE. However, MODEL_COORDINATE can be used when sharing animations among more than one model. <br /> To set MODEL_COORDINATE, specify ResSkeleton::FLAG_MODEL_COORDINATE using <a href="../../nw/gfx/res/ResSkeleton/SetFlags.html">SetFlags</a>. 13 </div> 14 <h2>Node Coordinate System</h2> 15 <img src="images/node_to_model.png" border="0" alt="node_to_model.png(78913 byte)" width="397" height="516" /> 16 <p class="info"> 17 Calculations for <a href="../../nw/gfx/TransformNode/Overview.html">TransformNode</a> and its sub-classes are all performed using WORLD_COORDINATE.<br /> With <a href="../../nw/gfx/Model/Overview.html">Model</a>, <a href="../../nw/gfx/Model/Overview.html">WorldMatrix<a href="../../nw/gfx/TransformNode/WorldMatrix.html"> is input to UnivReg of the vertex shader and applied to vertices.</a> Meanwhile, with <a href="../../nw/gfx/SkeletalModel/Overview.html">SkeletalModel</a>, vertex shader processing differs depending on the coordinate system.<br /> 18 </p> 19 <h2>Skeleton Coordinate System</h2> 20 <h3>WORLD_COORDINATE</h3> 21 <img src="images/world_coordinate.png" border="0" alt="world_coordinate.png(64514 byte)" width="398" height="439" /> 22 <p class="info"> 23 In the case of WORLD_COORDINATE, <a href="../../nw/gfx/SkeletalModel/Overview.html">SkeletalModel</a>'s <a href="../../nw/gfx/TransformNode/WorldMatrix.html">WorldMatrix</a> is applied to the bone's WorldMatrix using <a href="../../nw/gfx/SkeletonUpdater/UpdateWorld.html">UpdateWorld</a> of <a href="../../nw/gfx/SkeletonUpdater/Overview.html">SkeletonUpdater</a>.<br /> As such, WORLD_COORDINATE is used for the WorldMatrix of all bones that can be obtained using <a href="../../nw/gfx/Skeleton/WorldMatrixPose.html">WorldMatrixPose</a>.<br /> 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. 24 </p> 25 <h3>MODEL_COORDINATE</h3> 26 <img src="images/model_coordinate.png" border="0" alt="model_coordinate.png(72987 byte)" width="398" height="439" /> 27 <p class="info"> 28 In the case of MODEL_COORDINATE< the model coordinate system is used for the WorldMatrix of bones when calculating using <a href="../../nw/gfx/SkeletonUpdater/UpdateWorld.html">UpdateWorld</a>.<br /> The model coordinate system is used for transforms from the root bone.<br /> Because the WorldMatrix of bones uses MODEL_COORDINATE, the <a href="../../nw/gfx/TransformNode/WorldMatrix.html">WorldMatrix</a> of <a href="../../nw/gfx/SkeletalModel/Overview.html">SkeletalModel</a> is applied to the WorldMatrix of bones input to UnivReg by the vertex shader.<br /> 29 </p> 30 <h2 id="shared_skeleton">Sharing Skeletons</h2> 31 <div class="section"> 32 To share skeletons, they must be calculated using MODEL_COORDINATE.<br /> To set MODEL_COORDINATE, specify ResSkeleton::FLAG_MODEL_COORDINATE using <a href="../../nw/gfx/res/ResSkeleton/SetFlags.html">SetFlags</a>. After creating <a href="../../nw/gfx/SkeletalModel/Overview.html">SkeletalModel</a>, to be used as the base, get the skeleton to be shared using <a href="../../nw/gfx/SkeletalModel/GetSkeleton.html">GetSkeleton</a>, and then pass it to <a href="../../nw/gfx/SkeletalModel/Builder/SharedSkeleton.html">SharedSkeleton</a> of the <a href="../../nw/gfx/SkeletalModel/Builder/Overview.html">SkeletalModel::Builder</a> class. By creating SkeletalModel in this way, a new SkeletalModel can be created while the base SkeletalModel maintains ownership rights.<br /> A SkeletalModel that shares skeletons can be rendered by performing updating and rendering as usual after creation.<br /> For details on implementation, see <a href="demo/MultiInstanceDemo.html">MultiInstanceDemo</a>.<br /> 33 </div> 34 <h2 id="world_matrix">Overwriting the World Matrix of Nodes or Bones</h2> 35 <div class="section"> 36 For details on how to re-write a node bone world matrix, see <a href="demo/ConstraintDemo.html">ConstraintDemo</a>. Usually, the scene must be updated first before overwriting the world matrix of a node or bone.<br /> However, calculation of the world matrix can be skipped by setting FLAG_IS_WORLDMATRIX_CALCULATION_ENABLED using <a href="../../nw/gfx/CalculatedTransform/DisableFlags.html">DisableFlags</a> on <a href="../../nw/gfx/CalculatedTransform/Overview.html">CalculatedTransform</a> obtained using either <a href="../../nw/gfx/TransformNode/WorldTransform.html">WorldTransform</a> or <a href="../../nw/gfx/Skeleton/WorldTransformPose.html">WorldTransformPose</a>.<br /> To overwrite the world matrix of <a href="../../nw/gfx/TransformNode/Overview.html">TransformNode</a>, set a WORLD_COORDINATE matrix for <a href="../../nw/gfx/TransformNode/WorldMatrix.html">TransformNode::WorldMatrix</a>. Note that the method used to overwrite the world matrix of a bone differs depending on the coordinate system. <br /> When using WORLD_COORDINATE, get the matrix using <a href="../../nw/gfx/Skeleton/WorldMatrixPose.html">WorldMatrixPose</a>::<a href="../../nw/gfx/Skeleton/MatrixPose/GetMatrix.html">GetMatrix</a> and configure a WORLD_COORDINATE matrix.<br /> When using WORLD_COORDINATE, get the matrix using <a href="../../nw/gfx/Skeleton/WorldMatrixPose.html">WorldMatrixPose</a>::<a href="../../nw/gfx/Skeleton/MatrixPose/GetMatrix.html">GetMatrix</a> and configure a WORLD_COORDINATE matrix.<br /> In addition, <a href="../../nw/gfx/TransformNode/WorldTransform.html">WorldTransform</a> of <a href="../../nw/gfx/SkeletalModel/Overview.html">SkeletalModel</a> must similarly be overwritten when using MODEL_COORDINATE.<br /> 37 </div> 38 <h2 id="node_bone_scale">Handling Scaling</h2> 39 <div class="section"> 40 Accumulated scaling, including one's own nodes and bones is calculated when the world matrix is updated by SkeletonUpdater. The scale given by <a href="../../nw/gfx/TransformNode/Transform.html">Transform</a> and <a href="../../nw/gfx/Skeleton/LocalTransformPose.html">LocalTransformPose</a> is for one's own nodes and bones, while the scale given by <a href="../../nw/gfx/TransformNode/WorldTransform.html">WorldTransform</a> and <a href="../../nw/gfx/TransformNode/WorldTransform.html">WorldTransformPose</a> is an accumulation of scaling factors from the root node to one's own node. 41 </div> 42 <hr><p>CONFIDENTIAL</p></body> 43</html> 44