Pose (UE)

Updated: 09/05/2024

This page contains statements regarding the alpha version.

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 to display 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.

How to handle the component

Pose in the Cubism SDK for Unreal Engine can be used by adding a CubismPoseComponent to child components of a CubismModel actor.

If the .pose3.json path is set in .model3.json, CubismPoseComponent is automatically added to the CubismModel actor as a child component during importing, so no configuration on the user side is required.

Behavior

CubismPoseComponent references (or creates if none exists) the value of CubismParameterComponent with the same Id as CubismPartComponent corresponding to the part set as the pose target, and selects a part with a non-zero value as the part to display.

float VisiblePartOpacity = 1.0f;

// find the visible part in a group
for (const FCubismPosePartParameter& PartParam : PartGroup.Parts)
{
	const TObjectPtr<UCubismPartComponent>& Part = PartParam.Part;
	const TObjectPtr<UCubismParameterComponent>& Parameter = PartParam.Parameter;

	if (!Part || !Parameter)
	{
		continue;
	}

	if (Parameter->Value > 0.0f)
	{
		VisiblePart = Part;
		VisiblePartOpacity = Part->Opacity;

		break;
	}
}

If the opacity (VisiblePartOpacity) of the selected display part is less than 1, it is increased according to the specified FadeInTime value.

VisiblePartOpacity = FMath::Min(VisiblePartOpacity + DeltaTime / FadeInTime, 1.0f);

On the other hand, the opacity of the hidden parts (OtherPartOpacity) is decreased in accordance with the change in opacity of the displayed part according to the following formula.

float OtherPartOpacity;
// decrease opacity of the other parts aligned with the visible part
{
	if (VisiblePartOpacity < Phi)
	{
		OtherPartOpacity = VisiblePartOpacity * (Phi - 1.0f) / Phi + 1.0f; // a line through (0, 1) and (phi, phi)
	}
	else
	{
		OtherPartOpacity = (1.0f - VisiblePartOpacity) * Phi / (1.0f - Phi); // a line through (1, 0) and (phi, phi)
	}
	
	const float backOpacity = (1.0f - OtherPartOpacity ) * (1.0f - VisiblePartOpacity);

	if (backOpacity > BackOpacityThreshold)
	{
		OtherPartOpacity = 1.0f - BackOpacityThreshold / (1.0f - VisiblePartOpacity);
	}
}

Was this article helpful?
YesNo
Please let us know what you think about this article.