Multiply Color/Screen Color

[Last update: 05/19/2022]

This section explains how to blend and draw colors on a model using Multiply Color and Screen Color.
The features introduced here are those of the SDK for Unity 4 R5 beta1 or later.

Models created before Cubism Editor 4.2, for example, can be used without any additional coding, even if the Multiply Color and Screen Color are not set on the model.
For detailed specifications and usage in SDK for Unity, please refer to “Multiply Color/Screen Color” in the SDK Manual.

As a preliminary preparation, please refer to “Importing SDK” to import model data and place prefabrication.

By default, it is set to always refer to the Multiply Color and Screen Color previously set for the model. If the Multiply Color and Screen Color are not set for the model, the following values are used.

  • In Multiply Color (1.0, 1.0, 1.0, 1.0)
  • In Screen Color (0.0, 0.0, 0.0, 1.0)

 

Use on inspector

To enable manipulation of Multiply Color and Screen Color from the SDK side, enable the following flags.

Multiply Color:

OverwriteFlagForModelMultiplyColors or OverwriteFlagForMultiplyColors

Screen Color:

OverwriteFlagForModelScreenColors or OverwriteFlagForScreenColors

OverwriteFlagForModelMultiplyColors and OverwriteFlagForModelScreenColors are flags that determine whether the SDK can manipulate Multiply Color and Screen Color for all Drawables.
These flags can also be manipulated in the Inspector of the [CubismRenderController], which is attached to the model prefab root object in UnityEditor.

 

OverwriteFlagForMultiplyColors and OverwriteFlagForScreenColors are flags that determine whether each individual Drawable can manipulate Multiply Color and Screen Color from the SDK side.
It can also be manipulated in the inspector of the [CubismRenderer] attached to each Drawable object in the model.

If the Multiply Color and Screen Color flags that [CubismRenderController] has as described above are enabled, they will take precedence.

Multiply Color and Screen Color settings can be controlled not only from scripts, but also from the [CubismRenderer] inspector.

 

 

Use on scripts

The following code is useful for use in applications and other cases where control is needed on scripts.

The following code is designed to change the Screen Color of all Drawable objects at the same time in a certain period of time.

You can create a C# script that rewrites the contents as follows and attach it to the root object of the model prefab.

 

 

Receive notification of Multiply Color and Screen Color updates from the model side

If a model parameter is associated with a change in Multiply Color/Screen Color, the model may change the Multiply Color/Screen Color when the model is animated, rather than from the SDK side.

The property IsBlendColorDirty is implemented in [CubismDynamicDrawableData] to indicate that the Multiply Color and Screen Color have been changed.

This property is true when either the Multiply Color or Screen Color is changed on the model side, and does not determine whether the Multiply Color or Screen Color is changed.

For details, please refer to “Multiply Color/Screen Color” in the SDK Manual.

© 2010 - 2022 Live2D Inc.