Pose
Updated: 09/03/2019
Summary
Pose is a function that manages the display state of a group of parts described in the Pose configuration format .pose3.json.
Using Pose, you can manage parts that you do not want displayed on the screen at the same time, such as “arms in a lowered position” and “arms in a crossed position.”
Pose can also be used to support models with different Part IDs (e.g., costume changes).
The .pose3.json can be configured in Cubism Viewer for OW.
Click here for more information on how to set up parts.
When comparing a model imported using the OW method with a model imported using the conventional method, the following three points change depending on Pose.
- CubismPosePart is attached to the GameObject under [Prefab root]/Parts/.
- If the curve of PartOpacity in the AnimationClip matches Stepped, it is processed into a Linear curve.
- Opacity curves not described in pose3.json are removed from AnimationClip.
Pose performs the following processes.
- Process the Opacity curve of the Parts set in Stepped in the Pose motion
- Identify parts for Pose
- Save Opacity of the Part to Determine Which Pose Part to Display
- Calculate and apply Poses
- Interlock Opacity
Process the Opacity curve of the Parts set in Stepped in the Pose motion
As described in Pose Settings section of the Editor manual, the curve for PartOpacity handled by Pose assumes that the curve type is Stepped.
The Cubism SDK for Unity processes this curve to linear and exports it to AnimationClip.
If you set a curve of a type other than Stepped, the curve will not be processed and will be exported directly to AnimationClip.
if(shouldImportAsOriginalWorkflow && poseJson ! = null && poseJson.FadeInTime ! = 0.0f) { animationCurve = ConvertSteppedCurveToLinerCurver(curve, poseJson.FadeInTime); }
The processing of this Opacity curve is done by CubismMotion3Json.ToAnimationClip().
Identify parts for Pose
CubismPosePart is attached when a model is imported using the OW method.
The GameObject to be attached will be the one with the same name as the ID described in .pose3.json, placed under [Prefab root]/Parts/.
// Obtain parts for Pose var part = parts.FindById(group[partIndex].Id); // Attach CubismPosePart posePart = part.gameObject.AddComponent<CubismPosePart>(); // Set Pose information to CubismPosePart posePart.GroupIndex = groupIndex; posePart.PartIndex = partIndex; posePart.Link = group[partIndex].Link;
This is done by CubismPoseMotionImporter.InitializePosePart().
Save Opacity of the part to determine which Pose part to display
The current CubismPart.Opacity value is compared with the value cached in the previous frame to determine the parts displayed in the group described in .pose3.json.
Values are cached by CubismPoseController.SavePartOpacities().
Calculate and apply Poses
Display parts are applied by AnimationClip.
Apply hidden parts with CubismPoseController.DoFade ().
CubismPoseController.DoFade() looks for a display part and then sets the hidden part Opacity.
The Opacity of the hidden part reduces the opacity to a level that does not allow the background to show through in relation to the opacity of the part to be displayed.
Interlock opacity
Opacity is set to the Opacity in CubismPoseController.CopyPartOpacities for interlocking parts written in CubismPosePart.Link after Pose is applied.