100% found this document useful (1 vote)
3K views19 pages

Genshin Impact Shader Setup Guide

This document provides a guide for setting up Manashiku's Genshin Impact replica shader for MMD models. It explains how to port Genshin Impact FBX models to MMD, set up the MMDGenshin shader, add vertex colors to official Genshin Impact model ports, and make custom lightmaps for the shader. The guide walks through applying required texture materials to models using PMXE, configuring settings in the shader file like specifying texture names and material ramp values, and loading the shader in MMD. It recommends duplicating the shader file for different materials and provides resources for obtaining character textures from the game.

Uploaded by

Paleta verrde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
3K views19 pages

Genshin Impact Shader Setup Guide

This document provides a guide for setting up Manashiku's Genshin Impact replica shader for MMD models. It explains how to port Genshin Impact FBX models to MMD, set up the MMDGenshin shader, add vertex colors to official Genshin Impact model ports, and make custom lightmaps for the shader. The guide walks through applying required texture materials to models using PMXE, configuring settings in the shader file like specifying texture names and material ramp values, and loading the shader in MMD. It recommends duplicating the shader file for different materials and provides resources for obtaining character textures from the game.

Uploaded by

Paleta verrde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

GUIDE TO SETTING UP MANASHIKU’S GENSHIN IMPACT REPLICA SHADER

GUIDE DIRECTORY

1) PORTING (GENSHIN) FBX MODELS TO MMD

2) SETTING UP MANASHIKU’S MMDGENSHIN SHADER

3) ADDING VERTEX COLOURS / 2ND ADDUV TO OFFICIAL GENSHIN IMPACT

MODEL PORTS (AND OTHER MODELS)

4) MAKING CUSTOM LIGHTMAPS FOR MANASHIKU’S GENSHIN SHADER

Link to the shader:


https://github.com/Manashiku/MMDGenshin

There’s a lot of MMD users sending me DMs inquiring me on how to use the shader and
to save my breath for next time, I have decided to make yet another guide for it!
Big thanks to my friend Momo_MMD for reference (and also for the initial setup of the
shader hehe)
***NOTE: THIS GUIDE IS BASED ON VERSION 0.1.4 AND ABOVE OF THE
SHADER.
IF YOU’RE USING THE OFFICIAL PORTS (APLAYBOX/BILIBLI) OF THE GENSHIN
CHARACTER MODELS PROVIDED BY HOYOVERSE, PLEASE USE VERSION 0.1.3
OF THE SHADER INSTEAD.
ALTERNATIVELY, YOU CAN ADD THE VERTEX COLOURS AKA 2ND ADDUV TO
THE OFFICIAL PORTS TO BE COMPATIBLE WITH VERSION 0.1.4 AND LATER.***

THIS IS MAINLY BECAUSE THE OFFICIAL PORTS (AND MAYBE SOME


FAN-RIPPED PORTS THAT AREN’T CONVERTED THROUGH NOESIS) LACK THE
VERTEX COLOURS AKA 2ND ADDUV FOR THEM TO BE COMPATIBLE TO BE
USED WITH VERSION 0.1.4 AND LATER.

***WARNING: THIS SHADER REQUIRES THE USE OF ACTUAL IN-GAME


RESOURCES. IF YOU’RE NOT COMFORTABLE IN USING DATAMINED
RESOURCES, I SUGGEST TO NOT USE THIS SHADER.***

***At this point I am BEGGING all of you to use the latest version of the shader
instead, using version 0.1.3 is just hassling and it’s very much outdated
compared to the latest version of the shader.
To use the latest version, you just need to add AddUV2 (aka vertex colours)
manually to the official ports. I’ve covered the basics on how to do that!***

Some basics are already covered in my previous guide relating to making custom
lightmaps.
I’ll be using datamined Lumine’s model for this guide.
This guide should also work for the APlaybox/BiliBili models provided you have the
previous versions of the shader (apparently the latest version is incompatible with them
but I’m not sure about that).

PART 1 - APPLYING MATERIALS TO YOUR GENSHIN MODEL

Firstly, you need to have the appropriate resources for the models, aka 1) lightmaps, 2)
shadowramps, and 3) face shadowmap.

You can get them from here (courtesy to CherryPieWithPoison).


https://www.deviantart.com/cherrypiewithpoison/art/Genshin-Impact-Avatar-Lightmaps-a
nd-Ramps-DL-908335635

Here’s what they supposed to look like:


1) Lightmaps

2) Shadowramps

3) Face shadowmap

If you get the resources from in-game, chances are you’re getting them with alpha mask
on. MMD (for some unknown reason) can’t properly register textures with alpha,
therefore it’s necessary for you to remove the alpha mask first.
(I won’t cover how to remove them since you can easily search for guides about it. You
can use either Photoshop or GIMP for that function.)
***NOTE: DO NOT REMOVE THE ALPHA MASK FOR THE FACE SHADOWMAP!***

Once you have the required resources, it’s time to apply them to your model with PMXE
***24 / 9 / 2022: I failed to mention this (that’s because I was very late to realise
this LMAO my bad) but if you want to get better and accurate shadow ramps
appearance on the model’s mesh, DO NOT REMOVE THE ALPHA MASK IN THE
LIGHTMAPS! (But only if you want to actually edit them!)

Here’s a comparison of the lightmaps without and with alpha mask removed.

When applied on a model:


Thus when the shader is applied, the shadow ramps on a model with lightmaps (that
have no alpha mask removed) are registered properly and accurately!

(Note that the feet and the clothing part are in one single mesh, because the clothing
part are textured together with the feet! //if that makes sense)
Open your model in PMXE. Make sure there aren’t any spa/sph files and toons applied
on the model (basically in a blank state), like this:

Input the materials into the respective slots.


1) Face shadowmap - SPH slot (set as either Multisphere or Addsphere)
2) Hair and body lightmaps - SPH slot (set as Subtex)
3) Shadowramps - Toon slot

Examples for my Lumine model (I renamed the materials for simplicity):

(Face shadowmap + body shadowramp)

(Hair lightmap + hair shadowramp) (Same process for the body + outfit)
Once applied, your model should look like this:
(Please refer to 24 / 9 / 2022 note update in case your model doesn’t look like this)

Save it over with a simple name, like “Lumine.pmx”.


Since your model will come pre-loaded with the shader, be sure to save a backup in
case you want to use a different shader with your model.

Onto the next step!


PART 2 - SETTING UP THE SHADER

For the shader setup, I recommend duplicating the main shader file to a few
copies, mainly for face + body + outfit, and hair. Always keep the original
(material_default) in case you accidentally mess up a copy.

Firstly, make sure that the shader you’ve acquired contains 2 materials - face lightmap
and metal matcap in the tex folder within sub . They look like these:

(Face lightmap)

(Metal matcap)

Open the shader file (named default_material.fx) with any text editing software (basic
Notepad can work as well but it’s better to get the ones that are fit for coding).
OPTIONAL - If you’re using this shader for the Aplaybox/BiliBili models, you must
disable the #define exported_from_noesis command line. ***Please use version
0.1.3 if you want to use the shader with the mentioned models.***
I beg you to use version 0.1.5 from now on!!

Head over to #define face_tex_name in “Face” options and make sure the string name
matches with the face lightmap’s name. (E.g “Avatar_Girl_Tex_FaceLightmap.png”)
I renamed mine to just “Face.png” for simplicity purpose (lol).
**DO NOT FORGET TO INCLUDE THE EXTENSION (.PNG)**

(This section is updated on 26 / 2 / 2022)


(ASSUMING YOU DON’T REMOVE THE ALPHA MASK IN THE LIGHTMAPS)
Next is the material_ramp section in “Shadow” options. I haven’t fully worked with
them yet, but what you’re gonna adjust are two slots, which are #define
material_ramp_0 (*) and #define material_ramp_4 (*).

Upon testing more of the material ramps, it’s safe to say that you’re gonna need to edit
most, if not, ALL of the material ramps. There’s no set way to do this because not all
models shader the same application, so I can only say that you need to take a look at
the ramp textures and play with the outline slots to guess which parts use which ramp
slot.

Command lines #define material_ramp_0 - 3 (*) usually sets the shadow ramps on the
clothing parts of the model, and #define material_ramp_4 (*) for skin / hair.

The default is set to 1 which is the slot for skin. The values determine which shadow
ramps will be used for the materials:

0 - for clothes / hair

1 - for skin

2 - for clothes that use darker shadow ramps

*For recent character models (especially from Inazuma), they use 2 for skin
instead.

(Sometimes 3 or 4 can also be used, typically for the recent Genshin character
models.)
Thought honestly just take a look at the shadow ramps first and play around with
the values a little bit, and you can already guess that the first ramp starts as ‘0’.
There’s also a debug menu located at the bottom of the shader file. It should help
you with the ramp slots.

There are few settings that you change in the shadow section, such as the speed and
the shadow scale. I won’t go over the details for these as you’ll need to play with them
yourself.

Next section would be the “Specular” options. Again, there are settings that you can
play with yourself. There’s not much you’ll need to change except for one - #define
use_toon_specular. You’ll need to enable this for the hair (by removing double slashes
// in front of the command line). Command line #define specular_color float4 sets the
colour of the toon specular (using RGB values). Additionally, you’ll also need to change
the values for #define specular_power_(*) and #define specular_rate_(*) if you’re
looking for a more intense and shiny looking specular.
I didn’t change the “Blush” and “Glow” options so you can ignore them, but feel free to
change the settings.

If you want your model to have edgeline, enable #define use_outline in “Edgeline”
options. You can also change the thickness accordingly in #define outline_thickness.
To have a better outline appearance, disable #define use_diffuse_texture (removes
gradient-like apperance on the outline).
There are settings that you can play with for the “Rim” options. Again, you’ll need to
experiment with them yourself. #define rim_thickness determines how much coverage
the rim will be applied on the model, and #define rim_softness determines whether
the rimlight will have a soft or harder outer edge. Example:

For the “Metal” options, you can change the light, the shadow, the specular, etc for the
metal parts of the model. Use an in-game screenshot of a Genshin character model for
reference if you want better accuracy of the metallic look.
In “Metal” options, you’ll need to input the string name of your metal matcap as well
(It’s the same process as putting the stringname of the face lightmap), and then DON’T
FORGET TO ENABLE THE COMMAND LINE.

***Here is the link to get the actual character materials extracted from
the actual game if you’re looking to use the real values for the shader.
This was provided by a good friend of mine!***

https://mega.nz/file/6VRkWbQC#RDT7HWSH4amqkf_6XMLFRo2bJYO
10PxqsfkQAgeC2do

.JSON files can be read with a normal Notepad.

Once you’re done, you should end up with few copies of the shader set according to the
materials of your model, though having just 2 copies are enough per model:

Now you’re ready to load the shader in MMD!


PART 3 - LOADING THE SHADER

When you open your model, don’t be shocked to see that it has the bright, weird-looking
colours on the model. It’s totally normal!

To be frank, I don’t really need to thoroughly explain this part lmao. Just load the shader
files according to the materials of the model through the MME tab. Even better if you
separate the materials beforehand as it’ll make loading the shader much easier.

This is how it looks like for my Lumine model:


(I purposely didn’t put the shader on the eye parts as I wanted them to be compatible
with PostAlphaEye.)

Once you’ve loaded up the necessary shader files, click OK and you’ll see your result!
To make your life easier, you’ll need the emd file so that your model will load together
with the shader the next time you open your model. Open the MME tab and save the
emd file for the model through File -> Save by Model, and name it the same as the PMX
file (e.g “Lumine.pmx” = “Lumine.emd”). Next, open the emd file with any Notepad, and
change the Version number from 3 to 2 (optional, because MMD can still load the
emd file). Save it, and your model will come loaded together with the shader!

SOME FAQS

1) WHY DOES THE SHADER APPEAR BLACK ON SOME TEXTURES?

As of now, the shader DOES NOT support transparency on textures. The official ports
utilize transparent textures to separate some parts of the materials (usually to put
different toons on them). To fix this, just remove the materials that use transparent
textures, or follow this guide made by BowlOfSpicyRamen for more in-depth
explanation:

https://www.deviantart.com/bowlofspicyramen/art/Black-Parts-Problem-with-Manashiku-
Shader-910983271

(Note that some parts may need separation and merging first before removing the
whole material that uses transparent texture, especially when there’s overlapping.)

Example:
DO NOT PUT THE SHADER ON THE FACIAL MORPHS MATERIAL, THEY DON’T
NEED IT.

2) WHY DO THE SHADOWS LOOK “METALLIC” ON MY MODEL?

…The in-game shadowramps are designed like that, don’t worry. 😭


3) MY MODEL LOOKS VERY DARK!

Are you using version 0.1.3 (I hope not, please…), then disable the Noesis export
command line.

Version 0.1.5? DON’T FORGET TO ADD ADDUV2 (GUIDE CAN BE FOUND IN MY


DIRECTORY AT THE TOP OF THIS GUIDE).

4) I’M HAVING PROBLEMS SAVING/LOADING THE .EMD FILE!

MAKE SURE the characters in the names of your model, the emd file, and folders CAN
BE READ BY MMD to load the shader. If your MMD reads English names, use English.
If Chinese, use Chinese, and etc. Always make sure that NONE of the characters
appear gibberish!

(Thank you @telleistrash for reaching out to me about this!)

5) THE FACE SHADOW DOESN’T MOVE ALONG WITH THE LIGHTING!

I noticed that this issue occurs to the recent update of version 0.1.5. I’m assuming
there’s an encoding error happened to one of two files in the ‘sub’ folder. If you want to
revert back to the old release of version 0.1.5, please DM me for the encoding files (I
won’t post the link to respect Manashiku’s wish of not re-distributing the original files
publicly).
And that’s all for this guide! I hope this is comprehensible enough since I’m only
covering the basics on using Manashiku’s shader… T T

If you have any further inquiries, feel free to DM me!

This guide is written by Moyonote @ MonoCereal.

You might also like