Skip to content

Using the Genshin Shader

Manashiku edited this page Aug 30, 2023 · 8 revisions

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 GI 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.

HoyoToon_GeneratingMaterials

Modifying Material Properties

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

Choosing Material Types

For Genshin there are 3 types of material types: Base, Face, and Weapon.
Base is for materials that use the basic sets of properties. These normally have Body, Dress, or Hair in their material names.
Face is for materials that use the face shadow textures. These use a special type of lightmap and shadow map.
Weapon is for materials that use the dissolve components of the shader. Typically only for weapons.

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. Usually denoted by the _Diffuse suffix attatched to it.
Light Map Texture: This is the Light Map texture which a rgba texture that contains 4 masks. Red: Specular & Metallic mask. Green: Hand-Painted Shadow mask. Blue: Specular threshold mask. Alpha: Material ID mask.
Backface UV: Drop down menu that controls which uv map the back facing polygons will use.
Enable Linear Vertex Colors: Due to the fact that some model formats store a models vertex colors in linear space which messes up certain calculations that use them. This will fix these issues by forcing them back to sRGB
Enable Nighttime: This will toggle the night time shadow ramp colors.

Color Options

There are 5 tint colors. Each of these are linked to either the material mask texture channels or the sub materials controlled by the light map alpha channel. You can find another foldout menu which contains the toggle for the material mask and assigning the texture.
Enable Material Color Mask: This will enable the material mask texture and reveal the texture slot (Material Color Mask) for it. Turning it on will force the color tints to be blended on to the model using the various rgba channels instead of based on the material IDs.
Tint Color: RGB Color picker. If the Material Color Mask is enabled this will be treated as the base tint color and will be multiplied over the diffuse texture first. Otherwise its linked to the first region of the material ID mask (#000000).
Tint Color 2: RGB Color picker. If the Material Color Mask is enabled this will use the alpha channel of the Material Mask texture to blend itself over the previous Tint Color. Otherwise its linked to the first region of the material ID mask (#FFFFFF)
Tint Color 3: RGB Color picker. If the Material Color Mask is enabled this will use the red channel of the Material Mask texture to blend itself over the previous Tint Color Otherwise its linked to the first region of the material ID mask (#7E7E7E)
Tint Color 4: RGB Color picker. If the Material Color Mask is enabled this will use the green channel of the Material Mask texture to blend itself over the previous Tint Color. Otherwise its linked to the first region of the material ID mask (#4E4E4E)
Tint Color 5: RGB Color picker. If the Material Color Mask is enabled this will use the blue channel of the Material Mask texture to blend itself over the previous Tint Color. Otherwise its linked to the first region of the material ID mask (#B1B1B1)

HoyoToon_Genshin_ColorTints.mp4

Alpha Options


Diffuse Alpha Channel: Within the drop down menu there are 3 options: None. Transparency, & Glow. None will remove any transparency and set the material to be opaque. Transparency will use the alpha channel as regular transparency. Glow is linked to the Emission calculation which is located in the Special Effects category.


Ghosting

See-through effect. The alpha of the color tint controls the transparency of the material.
Enable Ghost Mode: Toggles on and off the see-through mode, this will automatically set the blend mode and render queue for you so it works properly.

image

Details

The blue channel of the normal map texture contains a detail line texture. This helps enhance certain lines by making them thicker or thinner depending on the models distance from the camera.
Texture Line: This toggles the use of the detail lines on and off.
Texture Line Smoothness: This slider controls the smoothness of the enhanced lines. A lower value, the smoother it gets.
Texture Line Thickness: This slider controls the overall thickness of the lines. A lower value, the thicker it gets.
Texture Line Distance Control: These are XYZ values that correspond to the scale of the lines across certain distances. X = far, Y = mid, Z = near.
Texture Line Color: HDR Color Picker, this is the color tint for the detail lines.

HoyoToon_Genshin_DetailLine.mp4

Material IDs

Here you will find the options for turning on or off the different sub materials within in one material. There are at most 5 being used at once, with 4 being toggleable. The very first material region uses a color value of #000000 in the lightmap alpha channel.
Enable Material 2: Turn on or off the 2nd sub material. Corresponding color region in lightmap alpha = #FFFFFF
Enable Material 3: Turn on or off the 3rd sub material. Corresponding color region in lightmap alpha = #7E7E7E
Enable Material 4: Turn on or off the 4th sub material. Corresponding color region in lightmap alpha = #4E4E4E
Enable Material 5: Turn on or off the 5th sub material. Corresponding color region in lightmap alpha = #B1B1B1

Normal Map

Where the normal mapping options are. This will affect the shadows, specular, and metallics of the model.
Normal Map: Toggling the check box will enable the normal mapping as well as reveal the texture slot where you can load your normal map. If you see somethig pop up under the texture slot when you load the texture saying that it is not marked as a normal map, ignore this.
Normal Map Scale: This slider controls the influence the normal map has on the model.

image

Weapon

This menu will only appear if your material type is set to Weapon. This continas the necessary options to control the weapon dissolve effect.
Enable Weapon Pattern: Turns on or off the animated weapon pattern.
Disable UV1: Disables the use of the secondary uv map as the dissolve direction.
Weapon Dissolve: Texture slot for the dissolve texture. Eff_WeaponsTotem_Dissolve_00.
Weapon Pattern: Texture slot for the pattern texture. Eff_WeaponsTotem_Grain_00.
Scan Pattern: Texture slot for the pattern texture. Eff_Gradient_Repeat_01.
Dissolve Clipping Threshold: The clip value for to test against the dissolve value.
Weapon Dissolve Value: The general dissolve threshold for that material. The lower the value the more the material has dissolved.
Dissolve Direction Toggle: Change the direction the model dissolves in.
Weapon Pattern Color: HDR Color picker, This is the color of the animated weapon pattern.
Pattern Speed: Animated weapon pattern speed value.

Scan


Scan Color Scalar: controls the intensity of the scan pattern color.
Scan Color: RGB Color picker, the color of the scan pattern.
Scan Direction Switch: Changes the direction the scan pattern is going in.
Scan Speed: Controls the speed of the scan pattern.

Face

This menu will only appear if your material type is set to Face. This contains the necessary options to control the face shading.

image


`Flip Face Lighting:` Flips the face shadow direction.
`Face Shadow Texture:` This texture slot is where the `Avatar_Tex_Face_Shadow` texture goes.
`Face Lighting Softness:` This controls the softness of the shadows edges of the face shadow.
`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. ### Blush The diffuse face texture of a genshin model usually comes with a blush mask stored in the alpha channel.
`Nose Blush Strength:` After a certain 3.0 update, some models have the blue channel of their face lightmaps used as a nose blush mask. This slider will control the strenght of the color blend.
`Face Blush Strength:` This slider will control the face blush color blend strength.
`Nose Blush Color:` Color picker for the nose blush color to be blended
`Face Blush Color:` Color picker for the face blush color to be blended

Lighting Options

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

Shadow

This is the section where all the regular shadow related properties are located.
Shadow Ramp: This is where a materials shadow ramp is loaded if it uses one.
Enable Shadow Ramp Texture: Enabling this will turn on the usage of the shadow ramp. Turning it off will make the material use DayTime Colors or NightTime Colors depending on the Enable nighttime toggle located in the Main section.
Enable Lightmap Ambient Occlusion: Enabling this will make the shader use the lightmap's green channel in the shadow calculation.
Enable Vertex Color Ambient Occlusion: Enabling this will make the shader use the vertex colors red channel in the shadow calculation.
Environmental Lighting Strength: This slider controls the influence the Main directional light and 4 closest point lights have on the material.
Shadow Position: This slider controls the overall shadow area. The higher a value the more the model will be covered in shadows.
Ramp Width: This slider controls the size of the ramp. A higher a value the wider the ramp is.

Shadow Transitions

If your model uses the base or weapon material type with the shadow ramps turned off, the shader will use the Shadow Transition Range and Shadow Transition Softness properties to create shadows for you.
Shadow Transition Range 1-5: These 5 sliders control the width the of the shadow.
Shadow Transition Softness 1-5: These 5 sliders control the softness of the shadow edge.

DayTime Colors

These are the warm/day time colors used as the shadow color if you turn off the shadow ramps.

NightTime Colors


These are the cool/night time colors used as the shadow color if you turn off the shadow ramps and enable night time mode.

Rim Light

Genshin Impact uses a screenspace effect for its main set of rim lights.
Rim Light Blend Mode: This drop down menu lets you select one of two color blending modes for the rim lights. Add & Color Dodge.
Rim Light Intensity: This value controls the over all intesnity of the rim light.
Rim Light Thickness: This slider controls the overall thickness of the rim light.

HoyoToon_Genshin_RimLight.mp4

Reflections

There are two kinds of reflections on genshin impact models: Metallic & Specular.

Metallics

Metal reflections in genshin are achieved using a sphere map, often referred to as a matcap as well as its own specular highlight which is separate from the regular/general specular highlight.
Enable Metallic: Toggle on or off the metal shading.
Metallic Matcap: The texture slot to load your grey scale spheremap/matcap in.
Enable Metal Specular Ramp: Introduced in version 3.0, this will toggle on or off the use a specular color ramp.
Specular Ramp: The texture slot to load your greyscale specular ramp in.
Metallic Matcap Brightness: This adjusts the overall brightness of the matcap.
Metallic Specular Shininess: This adjusts the metal's specular highlights shininess.
Metallic Specular Scale: This adjusts the overall intensity of the metal specular highlight.
Metallic Matcap Tile Scale: This slider adjusts the matcaps scaling on the X axis.
Metallic Specular Power in Shadow: This slider adjusts the relative specular intensity when its in a shaded area.
Metallic Sharp Layer Offset: This slider adjusts the value used to determine what is a sharp specular area.

Metallic Colors

Genshin uses a greyscale matcap sphere map specifically so they can adjust the color by hand in the materials. This allows them to make sure the colors fit with the textures properly.
Metallic Matcap Dark Color: RGB Color picker, this is the color to be blended at the darker parts of the metal matcap texture.
Metallic Matcap Light Color: RGB Color picker, this is the color to be blended at the lighter parts of the metal matcap texture.
Metallic Matcap Shadow Multiply Color: RGB Color picker, this color is what is multiplied over the metal when its in a shadow.
Metallic Specular Color: RGB Color picker, this is the color of the specular highlight.
Metallic Sharp Layer Color: RGB Color picker, this is the color of the sharp specular highlight.
HoyoToon_Genshin_Metalics.mp4

Specular Reflections

Genshin's other form of reflection. Specular Highlights. These work like your standard non-realistic specular highlights with the added feature of being sharp at the edges.
Enable Specular: Turns on or off the use of the specular highlights.
Shininess 1-5: The shininess exponent of the specular highlights for each of the sub materials.
Specular Multiplier 1-5: The intensity of the specular highlights for each of the sub materials.
Specular Color: RGB Color picker, this is the specular color for the entire material.

HoyoToon_Genshin_Specular.mp4

Outlines

Outline settings
Outline Type: A drop down menu containing a list what set of data to use in the outline calculation. None, Normal & Tangent. None will turn the outlines off completely. Normal will force the shader to use the models regular normal vectors. Tangent will force the shader to use the data stored in the tangent data block. Using the HoyoToon Set Tangents script will generate a secondary set of normals which will be stored as tangents. Recommended to only use Tangent if you use the script along side it.
Enable Fallback Outlines: Turns on or off the fallback outlines. Depending on the platform, the scaling system used normally may not have good results so this setting is there in case.
Outline Width: This controls the width of the outlines.
Outline Scale: This controls the general scale of the outlines.

Outline Colors


Outline Color 1-5: RGB Color picker, the outline colors for each of the sub materials.

Outline Offset & Adjustments


Outline Width Adjust Scales: This property controls the width scale of the outlines at certain distances. X = near, Y = mid, Z = far.
Outline Width Adjust Zs: These are the distance values that are used for determining which width scales to use. X = near, Y = mid, Z = far.
HoyoToon_Genshin_Outlines.mp4

Special Effects

There are a few special effects to use on your materials.

Emission/Archon Glow

Adds an emissive (glow) effect to the material depending on the values inputted.
Emission Type: Whether or not it uses the default in game logic or uses a custom emission mask and color texture.
Emission Tint: RGB Color picker, the color tint of the emissive areas.
Emission Strength: The overall intensity of the emission.

Eye & Archon Glow


Enable Eye & Archon Glow: Turns on or off the eye/archon glow. This effect is commonly used on archons since their hair generally glows.
Eye & Archon Glow Strength: This controls the Strength of the Archon glow effect.

Pulsing Emission


Enable Pulse: Turns on or off the automatic pulsing animation.
Enable Eye & Archon Pulse: Turns on or off the automatic pulsing animation for the archon glow.
Pulse Speed: Controls the speed of the pulsing effect.
Minimum Pulse Strength: Controls the minimum value emission strength in the pulse animation.
Maximum Pulse Strength: Controls the maximum value emission strength in the pulse animation.
HoyoToon_Genshin_Emission.mp4

Outline Glow


Makes the outlines emissive
Enable Outline Emission: Toggles emissive outlines on or off.
Outline Emission Intensity: A slider that controls the intensity of the emissiveness of the outlines.

Outline Emission Colors

If you want to turn off the emission for certain material IDs, simply set the color to black. This will return it to its original outline color without the emissiveness.
Outline Emission Color 1-5: RGB Color picker, color tints for the emissive color.

image

Texture Animation

Standard UV scrolling animation options
Enable UV Scrolling: Turns on or off the uv scrolling effect.

UV X Scroll Speed: Controls speed of the uv scrolling for the X axis
UV Y Scroll Speed: Controls speed of the uv scrolling for the X axis
UV X Scroll Swing: Turns on or off the swing effect on the X axis.
UV Y Scroll Swing: Turns on or off the swing effect on the Y axis.

HoyoToon_Genshin_UVScroll.mp4

Star Cloak


This is the parallax effect that both Paimon and Dainsleif use on their cloaks.

Enable Star Cloak: Turns on or off the star cloak effect.
Star Cloak Shading Only: Turns on or off the override on the shading so that only the star cloak shading is rendered.
Star Cloak Blend Rate: The blending rate of the star cloak effect.
Star Texture 1: The star layers texture.
Star Texture 2: The star layers texture.
Star 1 Scroll Speed: The scroll speed for both star layers.
Star Brightess: The general brightness of both star layers.
Star Texture Height: The first star layer offset. This moves the position of the first layer of stars.
Star Texture 2 Height: The second star layer offset. This moves the position of the second layer of stars.

Noise

A noise effect used to give the parallax an almost wet look. Can be used for a variety of things.
Noise Texture 1: First noise layer texture slot.
Noise Texture 2: Second noise layer texture slot.
Noise 1 Scroll Speed: Speed of first noise layer.
Noise 2 Scroll Speed: Speed of second noise layer.
Noise 3 Brightness: Overall brightness of the noise textures.

Color Palette

In order to give the stars and clouds varying colors, genshin uses a color ramp to do this. Depending on the character, the color ramp will be different.
Color Palette Texture: Texture slot for the color ramp.
Color Palette Scroll Speed: Scroll speed of the color ramp.

Constellation


Constellation Texture: Texture slot for the main Constellation texture.
Constellation Texture Height: UV position offset for the constellation texture.
Constellation Brightness: The overall brightness of the constellation.

Cloud


Cloud Texture: Texture slot for the background cloud texture.
Cloud Texture Brightness: The brightness of the background clouds texture.
Cloud Texture Height: The UV position offset of the cloud texture.
HoyoToon_Genshin_StarCloak.mp4

Fresnel

This is another rim light effect.
Enable Fresnel: Turns on or off the fresnel rim light effect on the material.
Fresnel Color: This is general fresnel effect color.
Fresnel Color Scalar: The intensity of the fresnel color.
Fresnel Power: The fresnel exponent, this controls the width of the fresnel.

Render Options:


Cull: Culling mode.
Zwrite: Zwrite mode, Off disables the depth buffer from updating for that material.
ZTest: Depth buffer pass/fail setting
Source Blend: Source blending factor
Destination Blend: Destination blending factor