Character Rendering System
Estimated reading time: 4 minutesThe Character module is responsible for PC (Player Character) rendering enhancement, including layer extension, facial styles, hair colour gradients, and mask generation.
Layer System
The framework intercepts the game's Renderer.CanvasModels.main model and deep-merges custom layers with the original layers.
Built-in Layers
The framework provides the following layer overrides:
Custom Layers
Mod developers can add or override layers via the use() method:
Layer configuration supports the following properties:
Preprocessing and Postprocessing
Character supports registering pre- and post-processing functions that run in the rendering pipeline:
The framework's built-in preprocessing functions will:
- Inject mask value into
options.maplebirch.char.mask - Process hair colour gradient filters
Facial Styles
The framework extends the game's facial style system, allowing Mods to add custom facial styles and variants.
Facial Style Image Path Resolution
Facial style images are resolved in the following priority order:
img/face/{facestyle}/{facevariant}/{image}.pngimg/face/{facestyle}/{image}.pngimg/face/default/{facevariant}/{image}.pngimg/face/default/{image}.pngimg/face/default/default/{image}.png
Auto-discovery
The framework scans all loaded Mod zip files to auto-discover facial styles and variants under the img/face/ directory, and updates setup.faceStyleOptions and setup.faceVariantOptions.
Mask Generator
The mask() function is used to generate canvas mask images:
Mask values are configured via V.options.maplebirch.character.mask and V.options.maplebirch.character.rotation. For NPC sidebar, use V.options.maplebirch.npcsidebar.mask and V.options.maplebirch.npcsidebar.rotation.
Hair Colour Gradients
The framework supports Hair Colour Gradients, providing multi-colour gradient effects for side hair and fringe.
Gradients are enabled via hair_colour_style: 'gradient' and hair_colour_gradient options, supporting:
- Custom position for multiple colour nodes (stored in
V.options.maplebirch.character) - Brightness adjustment
- Blend mode (hard-light)
- Adaptive by hairstyle and hair length
Transformation System
The Transformation system allows mod authors to add custom form changes (e.g. beast, divine, demon). See Transformation for full API and configuration.
Z-Index Reference
Access Z-Index constants for character rendering via maplebirch.char.ZIndices:
