Jump to content

Color Modulation: Difference between revisions

From Mii Technical Wiki
No edit summary
No edit summary
Line 1: Line 1:
Color modulation is the process in which a texture is modified to add color. There are various strategies used by face libraries.
Color modulation is the process in which a texture is modified to add color. There are various strategies used by face libraries. In general, textures are split into color channels, and each channel is filled with a respective color.


{{Colortable-Navbox}}
== Modes ==
There are 6 modes
 
=== Constant ===
For textures where only one color replacement is needed. The red channel is colorized.
 
Used by: ShapeBeard, ShapeNose, ShapeForehead, ShapeHair, Fill
 
<syntaxhighlight lang="c">
rgb = ColorR
a = 1.0
</syntaxhighlight>
 
=== Texture Direct ===
For textures where no color modulation is required. The texture is “passed through” the shader with no modifications.
 
 
Used by: FaceMake, ShapeFaceline, ShapeMask
 
<syntaxhighlight lang="c">
rgb = TextureRGB
a = TextureA
</syntaxhighlight>
 
=== Rgb Layered ===
For textures where multiple colors need to be filled.
 
Used By: Mouth, Eye
 
<syntaxhighlight lang="c">
rgb = ColorR * TextureR + ColorG * TextureG + ColorB * TextureB
a = TextureA
</syntaxhighlight>
 
=== Alpha ===
For textures where there is a single color that needs to be filled, and an alpha channel.
 
Used by: Mustache, Eyebrow, Mole, FaceLine, FaceBeard, ShapeNoseline
 
<syntaxhighlight lang="c">
rgb = ColorR * TextureR
a = TextureR
</syntaxhighlight>
 
=== Luminance Alpha ===
For textures that need to fill two colours, and alpha
    FFL_MODULATE_MODE_LUMINANCE_ALPHA = 4, // Has Texture
 
                                           // Has Color (R)
 
                                           // FragmentR = ColorR * TextureG
 
                                           // FragmentA = TextureR
 
                                           // Used by: ShapeGlass
 
    FFL_MODULATE_MODE_ALPHA_OPA       = 5  // Has Texture
 
                                           // Has Color (R)
 
                                           // FragmentRGB = ColorR * TextureR
 
                                           // FragmentA = 1.0f
 
                                           // Used by: ShapeCap
 
}{{Colortable-Navbox}}

Revision as of 23:29, 23 September 2025

Color modulation is the process in which a texture is modified to add color. There are various strategies used by face libraries. In general, textures are split into color channels, and each channel is filled with a respective color.

Modes

There are 6 modes

Constant

For textures where only one color replacement is needed. The red channel is colorized.

Used by: ShapeBeard, ShapeNose, ShapeForehead, ShapeHair, Fill

rgb = ColorR
a = 1.0

Texture Direct

For textures where no color modulation is required. The texture is “passed through” the shader with no modifications.


Used by: FaceMake, ShapeFaceline, ShapeMask

rgb = TextureRGB
a = TextureA

Rgb Layered

For textures where multiple colors need to be filled.

Used By: Mouth, Eye

rgb = ColorR * TextureR + ColorG * TextureG + ColorB * TextureB
a = TextureA

Alpha

For textures where there is a single color that needs to be filled, and an alpha channel.

Used by: Mustache, Eyebrow, Mole, FaceLine, FaceBeard, ShapeNoseline

rgb = ColorR * TextureR
a = TextureR

Luminance Alpha

For textures that need to fill two colours, and alpha     FFL_MODULATE_MODE_LUMINANCE_ALPHA = 4, // Has Texture

                                           // Has Color (R)

                                           // FragmentR = ColorR * TextureG

                                           // FragmentA = TextureR

                                           // Used by: ShapeGlass

    FFL_MODULATE_MODE_ALPHA_OPA       = 5  // Has Texture

                                           // Has Color (R)

                                           // FragmentRGB = ColorR * TextureR

                                           // FragmentA = 1.0f

                                           // Used by: ShapeCap

}