EyeBlink

[Last update: 01/30/2020]

Summary

EyeBlink is a function that applies an open/close state value to the current value of the parameter for blinking.
Learn more about how to set blink parameters for your model here.

The parameters for blinking can be set in the model itself or specified arbitrarily by the user on Unity.

EyeBlink in Cubism SDK for Unity is composed of three types of elements.

  1. Components for specifying parameters
  2. Components that apply values to each parameter
  3. Manipulation of values to be applied in 2

 

1. Components for specifying parameters

Use CubismEyeBlinkParameter to specify the parameters to be used for EyeBlink.

CubismEyeBlinkParameter is a component that inherits from MonoBehaviour and
attaches to GameObjects placed under [Prefab root]/Parameters/.
The parameter with the same ID as the GameObject to which it is attached is treated as the parameter for blinking.

If the model itself has a parameter for blinking, the CubismEyeBlinkParameter will be attached to the GameObject for that parameter during import.

The CubismEyeBlinkParameter is used as a marker to get a reference, so nothing is processed internally and no data is held.

 

2. Components that apply values to each parameter

Use CubismEyeBlinkController to apply opening and closing values to each parameter.
This is a component that inherits from MonoBehaviour and attaches to the root of Cubism's Prefab when used.

Gets a reference to all CubismEyeBlinkParameters attached to the Prefab at initialization.
If you add/remove parameters for blinking during execution, call CubismEyeBlinkController.Refresh() to get the reference again.

 

CubismEyeBlinkController applies the value of CubismEyeBlinkController.EyeOpening to the parameters marked by CubismEyeBlinkParameter at the timing of LateUpdate() in every frame.

 

The value set for EyeOpening ranges from 0.0f to 1.0f.
CubismEyeBlinkController applies this value to the target parameter using the calculation method set in CubismEyeBlinkController.BlendMode.

By manipulating this EyeOpening value from the outside, the model's eyes can be opened and closed.

 

 

3. Manipulation of values to be applied in 2

As described in “2. Components to apply values to each parameter,” values can be applied to the parameters for blinking by manipulating the values of CubismEyeBlinkController.EyeOpening.
The Cubism SDK for Unity provides two ways to manipulate this value.

  • Manipulate values by motion
  • Manipulate values by component

Users can also customize their own blink speed and timing by implementing a process to manipulate this value.

Tips
EyeOpening is executed after CubismEyeBlinkController.EyeOpening, the intended behavior may not be achieved.
If a problem arises, it is possible to work around it by explicitly controlling the order in which components are executed on the user side.
Cubism SDK for Unity controls the execution order of each component with CubismUpdateController, which can also be used.

In addition, since the above two setting methods manipulate the same value at different times, it is difficult for both to coexist in a single model without any innovations.

 

Manipulate values by motion

When creating motion in Cubism's Animator using a model with parameters set for blinking, it is possible to set a curve for blinking.

If a .motion3.json with a curve set for blinking is imported into a Unity project, the AnimationClip will have that curve generated for the value of CubismEyeBlinkController.EyeOpening.
Therefore, the value of CubismEyeBlinkController.EyeOpening is manipulated by playing that AnimationClip in the Animator component, etc.

 

Manipulate values by component

In the Cubism SDK for Unity, the CubismAutoEyeBlinkInput component can also manipulate values for blinking.

CubismAutoEyeBlinkInput calculates and sets the value for blinking from the speed, interval, and random fluctuation width added to the interval set from Inspector.

 

CubismAutoEyeBlinkInput has three settings.

  • Mean
  • MaximumDeviation
  • Timescale

 

  • Mean

Sets the time until blinking is performed.
The unit is seconds.
In practice, the time is calculated by adding the error due to Maximum Deviation to this value.

  • MaximumDeviation

Sets the width of the random fluctuation to be added to the time set for Mean.
These are calculated as follows.

 

  • Timescale

This is the speed at which you blink.
It is multiplied by the elapsed time from the previous frame.

© 2010 - 2022 Live2D Inc.