Using the Star Rail Shader - Melioli/HoyoToon GitHub Wiki

Creating New Materials

If your model comes with a material JSON ripped using Asset Studio, you can use the material generation script that comes with the shaders. You can do this by selecting all the jsons, right clicking, and choosing the Generate HSR Materials script. This will generate a new material with all the properties and variants set properly. The only thing that wont be set are the textures, you will need to do that yourself.

6pS3pzRa5s

Modifying Material Properties

The shader comes with a lot of properties for you to modify and play around with yourself.

Choosing Material Types

For Star Rail there are 4 types of material types: Base, Face, EyeShadow, & Hair. Selecting certain material types will automatically set the rendering options for you. This is to ensure that the stencils are correctly set up.

Main

This section is where you will find the properties of the shader that control the overall appearance of the material colors.
Diffuse Texture: This is the main color texture for the material.
Light Map Texture: This is the Light Map texture which a rgba texture that contains 4 masks: Red: Rim Light Mask, Green: Hand-Painted Shadow mask, Blue: Specular threshold,Alpha: Material ID mask.
Enable Material LUT: Turns on or off the usage of the material LUTs. These are textures that encode certain material properties into a texture.
Environmental Lighting Strength: This slider controls the influence the Main directional light and 4 closest point lights have on the material.

Alpha Options


Enable Transparency: Turns on or off using the alpha channel of the diffuse as standard transparency.
Enable Alpha Cutoff: Turns on or off alpha clipping.
Alpha Cutoff value: Slider that controls the value to test the alpha channel against.

Color Options


Front Face Color: RGB Color picker, color tint for the front facing polygons.
Back Face Color: RGB Color picker, color tint for the back facing polygons.

HoyoToon_StarRail_ColorTints.mp4

Face

This menu will only appear if your material type is set to Face. This contains the necessary options to control the face shading.
Face Map Texture: Texture slot for the Face Map Texture. Red: unused, Green: Stencil Face mask, Blue: Nose Line mask, Alpha: Face SDF.
Face Expression map: Texture slot for the face expression map. Red: Cheek Blush, Green: Shyness, Blue: Shadow.
Nose Line Color: RGB Color picker, controls the tint of the nose line
Nose Line Power: Nose line blend rate.

Face Expression


Expression Cheek Color: RGB Color picker, cheek blush color tint.
Expression Map Threshold: Slider that controls the amount of the blush mask that is used.
Expression Specular Intensity: Slider that controls the amount of the brightest part of the blush mask that is used.
Expression Cheek Intensity: Slider that controls the overall blend rate of the blush expression.
Expression Shy Color: RGB Color picker, shy expression color tint.
Expression Shy Intensity: Slider that controls the overall blend rate of the shyness expression.
Expression Shadow Color: RGB Color picker, shadow expression color tint.
Expression Shadow Intensity: Slider that controls the overall blend rate of the shadow expression.
Up Vector | XYZ: This controls the upward facing vector direction for the face. It will be different depending on how you exported your model.
Forward Vector | XYZ: This controls the forward facing vector direction for the face. It will be different depending on how you exported your model.
Right Vector | XYZ: This controls the right facing vector direction for the face. It will be different depending on how you exported your model.

image

Hair

This category will only show up if you have the material type set to Hair.
Solid At Sides: Turns on or off fading effect of the hair.
Hair Blend Silhouette: Overall silhouette blend rate for the hair.

Lighting Options

These are where the general shading options are, Shadow & Rim Light.

Shadow


Warm Shadow Ramp | 8 ramps: Texture slot for the warm shadow ramps.
Cool Shadow Ramp | 8 ramps: Texture slot for the cool shadow ramps.
Shadow Ramp: Slider that controls the overall shadow area width.
Shadow Color: RGB Color picker, the shadow color for the face.

Rim Light

Star Rail uses a screenspace effect for its main set of rim lights.
Rim Light Use LightMap.r: Slider that controls the influence the rim light mask has.
Rim Intensity: Controls the rim light intensity.
Global Rim Intensity: Another way to control the rim light intensity.
Rim Width: Controls the overall rim light width for the material.
Rim Offset: Offsets the uv position for the rim light calculation.
Global Rim Light Offset | XY: Another way to offset the uv position for the rim light calculation.
Rim Light Color 0-7: RGB Color picker, controls the color tint of the rim light.
Rim Edge Softness 0-7: Slider that controls edge softness of the rim light.
Rim Type 0-7: Slider that controls the blend mode of the rim light.
Rim Dark 0-7: Slider that controls the Rim Light Shininess exponent.

HoyoToon_StarRail_RimLight.mp4

Specular


Global Specular Color: RGB Color picker , controls the overall color of the specular.
Global Specular Intensity: Controls the overall specular intensity.
Specular Color 0-7: RGB Color picker,
Specular Shininess 0-7: Slider that controls the specular highlight exponent per sub material.
Specular Roughness 0-7: Slider that controls the edge softness per sub material.
Specular Intensity 0-7: Slider that controls the specular intensity per sub material.

HoyoToon_StarRail_Specular.mp4

Stockings


Enable Stockings: Turns on or off the stocking shading.
Stocking Range Texture: The texture slot for the stocking texture.
Stocking Color: RGB Color picker, main stocking color tint
Stocking Darkened Color: RGB Color picker, darker stocking tint
Stockings Power: Slider that controls the darkened stocking rim exponent
Stockings Rim Width: Slider that controls the darkened stocking rim width.
Stockings Lighted Intensity: Slider that controls the intesnity of the dark color.
Stockings Texture Intensity: Slider that controls the intensity of the tiled roughness texture
Stockings Lighted Width: Slider that controls the width of the lightened stocking area

Uploading HoyoToon_StarRail_Stockings.mp4…

Special Effects

Emission


Enable Emission: Drop down menu with three options: Off, Ingame, & Custom. Off disables the emission completely. Ingame forces the shader to use the ingames emission logic. Custom enables the shader to use a custom emission texture.
Emission Texture: This option only shows up if you have the emission type set to Custom.
Emission Color Tint: RGB Color picker, controls the tint of the emission color.
Emission Threshold: Slider that controls the amount of the emission mask to use.
Emission Intensity: Controls the overall intensity of the emission.

HoyoToon_StarRail_Emission.mp4

Outlines


Enable FOV Scaling: Turns on or off use of FOV scaling on the outlines.
Outline Width: Slider that controls the oultine width.
Outline Scale: Slider that controls the outline scale.

Outline Color


Face Outline Color: RGB Color picker, the color of the faces outline.
Outline Color 0-7: RGB Color picker, controls the color of the outlines per sub material.

Lip Outlines


Lip _Outline Show Start: Slider that controls the scale of the face lip line.
Lip _Outline Show Max: Slider that controls the scale of the face lip line.
Lip _Outline Show Start: Slider that controls the scale of the face lip line.
Lip _Outline Show Max: Slider that controls the scale of the face lip line.
Outline Fix Star Side: Slider that controls the scale of the face outline from the side.
Outline Fix Star Front: Slider that controls the scale of the face outline from the front.
TurnOn Temp Lip Outline: Slider that whether or not ot use the temporary lip outline.

Render Options:


Cull Mode: Culling mode
Source Blend: Source blending factor
Destination Blend: Destination blending factor
Stencil Pass OP A: Stencil pass OP for first stencil layer
Stencil Pass OP B: Stencil pass OP for second stencil layer
Stencil Compare Function A: Stencil pass compare function for first stencil layer
Stencil Compare Function B: Stencil pass compare function for second layer
Stencil Reference Value: Stencil reference compare value.

⚠️ **GitHub.com Fallback** ⚠️