You are on page 1of 64

Model Swapping

Basics
From the github page you need to download the “For Development” version of
3dmigoto from the “releases” section. You will also need to download the “.py”
files for modding. When you extract 3dmigoto into its own folder, make sure to put
the “genshin_3dmigoto_collect” file into the folder with the 3dmigoto executable
file.

https://github.com/SilentNightSound/GI-Model-Importer
Dumping

Step 1 Frame Analysis


“Dumping” refers to the process of collecting all visual data from the GPU in the
form of textures and 3d models. In order to perform a “Frame Dump” to import
character models to blender we need to have the Dev Mode version of 3dmigoto.

Note that this process does not work on modded characters. This means we
cannot reverse engineer a mod to change it. You will need access to the modder’s
original blender files to edit them or recreate the mod from scratch. Make sure the
character you’re dumping is not modded by deleting their mod folder or by adding
the term “DISABLED” to the beginning of the name of the “.ini” file in the mod’s
folder. And then press F10 to update 3dmigoto while in game.

When you are using the Dev Mode version you will see the green text on the
screen. This text appears because 3Dmigoto is in “hunting mode.” In hunting mode
you can press “/” (slash) and “*”(star) on the number pad to cycle through “vertex
buffers” of all objects on the screen. You can exit hunting mode by pressing 0 on
the numpad if you want to return to normal. The numlock needs to be on for the
number keys to work.

We recommend that when hunting you try to get as few objects on the screen as
possible. So for characters we can visit the character menus and hunt through
18-30 vertex buffers. But in the open world you would have to hunt through at
least 600 vertex buffers to find the character.
When you have selected the vertex buffer it will become invisible. For characters
we need to find the vertex buffer that controls the body. Though you can try this
process on the face, 3dmigoto cannot mod the structure of the character’s face
because the face uses what’s called “morph targets” or “shape keys” . However
there is a method to edit just the texture of the face. Another option is to hide the
face entirely and use a custom head that cannot emote, speak or blink. Refer to the
face editing section to learn about editing face textures.

Refer to the image above to see what the correct vertex buffer looks like when
hunting mode selects it. While on this vertex buffer press “-” (minus) on the
number pad to copy the “Vertex Buffer Hash” to the clipboard. Paste the hash
somewhere like a notepad document. It will be important to reference later.

Step 2 Collecting
While in-game, now you can press “+” (plus) on the number pad to reset hunting
mode to 0. Press F8 once to start the “Frame Analysis Dump.” 3dmigoto will now
document everything being rendered on screen every frame and the game will
freeze for about 20 seconds. If the game freezes for a long time, you may get
disconnected from the server, but the dump should still succeed. The speed can
vary depending on the quality of your GPU. Though it’s okay to keep most
graphics settings low, it’s recommended to keep Render Scale at 1.0.

3dmigoto will create a folder called “FrameAnalysis”. We need to open windows


powershell focused on the 3dmigoto filepath. A quick trick to this is to hold down
shift and Right Click into the window. The menu will give you the option to “Open
a PowerShell window here”.
In order to use the “.py” files you will need to have python installed in windows.
Go to the Microsoft Store or the search bar in the taskbar and type “Python” and
download the latest version.
Now in powershell we can use the “collect” file that we downloaded from github to
collect the 3d model and textures of Kujou Sara based on the hash.

python genshin_3dmigoto_collect.py -vb char_vb_hash -n character_name

This is the structure of what you will type into Windows PowerShell. So for Kujou
Sara in particular, the name could be anything. Ideally you should pick something
easy to spell like “Sara” or just “KujouSara”. No spaces in the name. So for Kujou
Sara it will need to look something like this.

python genshin_3dmigoto_collect.py -vb 4320e589 -n KujouSara

For playable characters introduced during 3.0 or later you will need to add the text
“--has_normalmap” to the end of it, or the collect script will not properly identify
the textures. This means it will wrongly call the diffuse map the lightmap for
example.

python genshin_3dmigoto_collect.py -vb char_vb_hash -n Nilou –_has_normalmap

If the collect script was successful, it will create a folder named after the character
name you used and it should populate that folder with “.txt” files and texture files.
If it failed, there will be nothing in the folder and you may need to check the hash,
or the text you entered into powershell for spelling errors.
Move that folder somewhere else. Ideally, into a folder you’ve made specifically
for modding that character for the sake of organization.

Step 3 Importing
In blender we will need to install the 3dmigoto plugin. In the menu bar go to Edit >
Preferences. Click on the Add-ons tab and at the top click Install. Browse to the .py
file we downloaded earlier called “blender_3dmigoto_gimi”. Click Install Addon,
and in the preferences window make sure the checkbox on the addon is checked.

If you can’t find the addon in the list of addons there, you can search for it in the
search bar. If blender isn’t showing it, hold shift and click the three categories at
the top “Official” “Community” and “Testing” so that they are all highlighted. It
may be the case that the category of the addon was filtered out of the search by
default.
Go to File > Import where you’ll see 4 new options added to the import menu. You
may also need other addons to help you import models from outside of genshin like
the MMD (Miku Miku Dance) addon I’m using in this tutorial to import a “.pmx”
model of Blake Belladonna. You can get the MMD addon and instructions on how
to install it here. The process is ultimately the same as installing the 3dmigoto
plugin.

Click the option called “3DMigoto frame analysis dump”. Now go to the folder we
created with the collect script in Step 2. In that folder there will be a “VB” and
“IB” text file for each object associated with the character. Playable characters will
have between 2 to 4 objects that make up their body. The separation of each object
is related to the way objects are separated by either textures or in-game effects.
Select all text files in the folder so that they are all highlighted and click import. I
recommend that you do not change the operator presets on the side unless you
know what you’re doing. I have never needed to change them.

Now you should have Kujou Sara imported in an A-Pose in 3 separate objects.
Save this file as the base blender file for Kujou Sara. You can name it
“KujouSaraBase” for example. Now save it again by going to File > Save As to
save a copy of it. You can name it “KujouSara1” for example. While it is good
practice to save copies of your 3d model each time you make irreversible changes,
it will be necessary to have a base file ready for future steps.
Custom Model Swapping

Texture Editing
In this tutorial I’m using a MMD model of Blake Belladonna from RWBY made
by SAB64 on Deviantart. For genshin impact models this process can be as simple
as replacing the original texture files with the new model’s texture files. Since we
are working with a MMD file we will need to format its texture files to work in
Genshin.
You will need to download the latest version of Paint.net or have the nvidia plugin
for photoshop. I don’t personally use the photoshop Nvidia tools plugin for
working with DDS files, so this tutorial will only cover Paint.net. Texture files are
dumped in Direct Draw Surface (DDS) format which is an image file type that
most image editing software cannot recognize.

Genshin impact texture files will usually look like an empty space where the parts
of the character that glow are the only parts that are visible. This is because
genshin impact uses the Alpha Channel to define the “emissive” boost which
causes the texture to glow. In order to see the texture we need to go to Adjustments
> Invert Alpha.
If you do not have this option, or you cannot open DDS files with Paint.Net, you
will need to update your Paint.net to 5.0. Most image editing softwares do not
support directly editing the alpha channel except through options like opacity or
masks which is why Paint.net is ideal here. Most image softwares do not keep track
of RGB colors that are stored at 0 Alpha (0% Opacity) when you make global
changes like merging layers or repositioning layers on the canvas so we must be
careful with how we edit this so that the parts at 0 Alpha do not turn black.

Paint.net requires us to merge each layer in order to export the file which can cause
us to lose the data. However, Photoshop does not require us to merge layers in
order to export the file into a PNG.

Before we make changes, make sure to save this as a new PNG file in a different
folder so that we will not be making changes to the original texture file.

Go to Image > Canvas Size. The resolution must always be a power of 2. We’re
going to make the image twice as wide. When introducing a new image into the
canvas Paint.net will automatically place it on the left side, so we want to anchor
the original image to the right side.
The MMD Model is using about 5 different images. So we can try to add these
images to Kujou Sara’s texture file. You can drag and drop them into Paint.net then
click “Add as layer” and it will automatically place the image on the left side of the
canvas where the white space is. If the image is bigger it will scale the canvas to
fit. Simply rescale the image to fit and then use the canvas size window to resize
the canvas again. I would recommend using photoshop for this process since
Paint.net has no grid snapping feature. You could export Sara’s texture as a PNG
and then edit it in any other photo editing software that you prefer.

We want to keep the textures that relate to Kujou Sara’s neck because we don’t
intend to modify the face, and we want to make sure the neck matches when the
face gets attached in game.

Body Hair Cat Ears Zipper Suit


Sara’s vision won’t be on the model, so we don’t really care about what happens to
it here. We merge down the layers so we can export it. Then we will save this as a
PNG file which we will use in blender to fix the UV Map of the MMD file.

UV Map
The UV Map defines how each point correlates to each pixel on the texture file.
Video game models are usually optimized to use one or two texture images, but
MMD files use many images on a single object which presents you with a very
messy UV Map that won’t work at all for genshin.

Firstly, in genshin impact the UV Map is called “TEXCOORD.xy” and we need to


make sure that any new model has its UV Map renamed to the same name. In the
side menu, the triangle with 3 points called the “Object Properties” menu is where
you can find this option.

Go to the workspace at the top of the screen called “UV Editing” to view the UV
Maps and make sure you’re in Edit Mode to see the points on the canvas.
Above we can see how Kujou Sara carefully makes use of all the space on the
image while also making sure not to overlap any pieces. Fortunately, we won’t
need to rebuild the UV Map for our new model, we just need to scale each piece so
that they all fit into the image properly. Keep in mind the smaller we scale each
piece relative to the image, the lower the resolution of the texture will be on the
model. This is why legs and big parts of their dresses tend to take up such a large
portion of the image.

Below we can see how the MMD model is stacking multiple UV Maps on top of
each other because there are so many different texture files being used. Some
pieces are going off the image border, and some pieces are scaled abnormally.
At the top of the UV Editing window we need to go to Image > Open. Now find
the PNG image you created where all of the textures were combined into one
image. If you find you need to make changes to the image afterwards, just go to
Image > Reload to update the image from the same file.
When we import the image, the new aspect ratio will cause the UV Maps to
stretch. We will now scale it to match. Firstly, set the Pivot Point to “2D Cursor”.
Your 2D Cursor should be set to the bottom left corner by default.

Do not change the 2D Cursor’s position. You can change its position by pressing
Shift and Right Clicking, but this is not precise. If the 2D Cursor is not in the
bottom left corner we can precisely set it there by revealing the display options
hidden on the side of the UV Window. Click the arrow next to the zoom button to
open the hidden menus. Set the 2D Cursor’s X and Y location to 0.
Select all of the points on the UV Map and the type in this order: S, X, 0.5, Enter.
When you type S it should temporarily convert your tool to the Scale tool. When
you type X, you will constrain the axis to the X axis. When you type 0.5, you will
specify that you are scaling the x axis to 50% of its original value. The enter key
will confirm the scale.
Now the image should scale itself back to normal and position itself precisely on
the left side of the image. We will do the same process for Kujou Sara, but to the
right side of the image.
Set the pivot point back to “Bounding Box Center”. And now we will reposition
each texture so the UV Maps will not overlap.

Set UV Sync Selection to disabled (gray) so that it will only show the UV Map of
the points we select on the 3d Model. Select the points in the UV Window, scale
and drag them over the texture images that they were using. This can be done
mathematically for more precision, but it’s fine to eyeball it here.

We can easily select each individual texture by going to the Materials Tab. You
should see the option to “Select” the individual points that a material is bound to
while in Edit Mode. We need to repeat this process on every material here. Any
points that relate to the face can be deleted because 3dmigoto cannot be used to
edit the geometry of a character’s face in Genshin Impact.
We can see from the material data that this part of the body is referencing the
image called “Main.tga” which is the image file where I got the “Body” image
from. That image was placed on the left half of the canvas, so we simply need to
move the UV Map down.
Just like the precise method we used to scale the UVs, we will reposition the UVs
in the same way. Press G, Y, 1, - (minus), and then Enter in that order. Pressing G
will temporarily set the tool to the Move tool. Pressing Y will lock the axis to the Y
axis. Typing 1 will indicate that we are moving a distance equal to 100% of the
canvas’s Y value. Typing the minus key will change the number we input to
negative meaning it will move downwards. At the top left of the screen you should
see the conditions you’re writing be set until you press Enter.
You will need to repeat this process for each material. Sometimes using math,
sometimes by eyeballing it, dragging and scaling parts around until they fit into the
sections they were meant for.
Make sure to deselect these points before you move onto the next material.
Remember that since we don’t need the face or eyes, we can delete all the vertices
that the face materials select.
When you press the Delete Key you will be presented with options to limit how
much will be deleted. Since we want to delete everything we’ve selected, we will
choose to delete vertices.

Displaying Textures in Blender


This step is purely cosmetic within blender so you can see how your UV Map
changes will affect your character in game. Once you have finished editing the UV
Map, return to Object Mode and delete all of the materials that were applied to the
character. Next you will create a new material.
You can name the material something like “Sara Body” so you know what it is
because you can also have other objects use this same material. Click on the yellow
circle by “Base Color” and select “Image Texture.”

From Image Texture now select “Open” and find the new texture you created.
At the top right corner of the workspace you should see 4 different viewport
shading options. In order to see the texture, set the viewport shading to either the
3rd or 4th option.

Matching Proportions
Firstly we need to scale the model so that the top of the shoulders and the bottom
of the feet line up.
Both models are in an A pose, but they aren’t quite at the same angle. We need to
move Blake’s arms down to match Sara’s angle. We can do this manually by
pulling the points down, but since this MMD model came with an armature, we
can use the armature to move the arms into position.

When you select the armature, you will get the option to go into Pose Mode.
Using the rotate tool, we can grab the bone on her upper arm to angle the entire
arm correctly.

We won’t get it perfect with just the armature. We will need to move some points
around manually. It is important to get the proportions as close as possible so that
each joint will deform correctly.
If you were to select the model and go into Edit Mode, you will notice that the
armature changes have been reverted. This is because we need to “apply” the
armature modifier to the vertices. Go to the modifiers tab and open the armature’s
settings. I strongly recommend saving this blender file and then going to File >
Save Copy to preserve your progress in case you need to retrace your steps in the
future.
In order to apply a modifier, we need to return to Object Mode. Here we will
select “Apply as Shape Key”. This will remove the modifier so that we will no
longer be able to make changes to the model with the armature. Which is fine
because we don’t need to. Next we need to apply that shape key to the model as
well.
Return to the Object Properties tab (the green triangle) and open the Shape Keys
menu. These shape keys are mostly used for facial expressions. We need to delete
all of these shape keys starting from the top. You just need to make sure that the
armature’s shape key is the last shape key you delete.
Moving Points
Now that we have scaled the mesh and repositioned the arms, we can see that the
arms are not long enough for the hands to overlap. So we’re going to use
Proportional Editing mode to stretch out her arms so they match.

I want to preface this by saying that hands in general can be very time consuming
because each individual finger requires 3 bones to be weighted to them for any
playable character. So in this mod I removed her hands and used Kujou Sara’s
original hands. This works out for me because the character has long sleeves, so
cutting off the hands won’t ruin the aesthetic.

However, if you want to keep the hands you must first remember to reposition the
bones of the fingers to point at the same angle as the character’s fingers. Most
models have the fingers all parallel, but Genshin characters have the fingers
stretched out.

Return to Edit Mode and set the view to Front facing Orthographic mode using the
tool in the Top Right corner of the workspace and clicking on the “Y” axis.
We do not want proportional editing to accidentally stretch the hips and legs too.
So try to select the center of the character without selecting most of the arms. If
you still have the original materials, you can use them to help you select the hair.
Next you will press “H” to hide these points you’ve selected. If you feel you
selected too many points, you can easily unhide them by pressing ALT+H, and
then try again. Now proportional editing will not affect these points.

You will find the proportional editing options at the top of the workspace. Click on
the circle to activate Proportional Editing.

Open the dropdown menu next to it and check the box that says “Project From
View”. This dropdown menu controls the behavior of the fall off, in the future you
may want to experiment with different fall off patterns for different types of
movements.
As you can see we have two options, Connected Only and Project from view.
Connected Only is best when the points we’re moving are all connected. Models
that are generated from MMD or 3DMigoto will often have many points separated
based on the seams of their UV Maps. Keep in mind that if you intend to change
from one to the other, you will need to remember to uncheck the other option.

Select a large portion of the hand without selecting parts of the shirt. Next, press
CTRL + L to “Select Linked”.
As we can see here, if we attempted to use “Connected Only” on this hand, it
would not move the rest of the arm. In circumstances where you need to connect
these pieces, you could try selecting all of them and press “M” to open the merge
menu. Then you can click the option “By Distance” which by default will merge
any points that are overlapping to reverse the arbitrary separation these models
have. But be careful with how much you select at once, for example: if the legs are
overlapping or too close together you might accidentally weld them together.
Now when you move these points of the hands we’ve selected with “Project from
view”, you should see the whole arm move with them in a smooth, stretchy
manner. Scroll your mouse wheel up or down to change the radius of the sphere of
influence. Try to get the radius to affect at least half of the arm, but not any of the
points at the cutoff point where the body got hidden.
Vertex Groups

Renaming Groups
First off you will want to open two Blender windows and organize them on your
screen so that you can see both workspaces at the same time. We’re going to enter
Weight Paint Mode on both objects. In case you made any changes to the original
Kujou Sara, this is the point where you’ll want to use the “Base” file we created in
the beginning for your second Blender window.

We don’t intend to paint waits now so avoid clicking on the character until we do.
We just want to use this mode to see the weights and compare them to Kujou Sara.
We can see that Blake has some weights that seem to match Kujou Sara and some
that don’t. An example of a good match is with the thighs. We need to rename this
vertex group to the same number as the group on Kujou Sara.
The name of the group doesn’t actually matter, all that matters is that the groups
are placed in the same order. Since we’re renaming them to numbers, blender can
sort them into a proper order when we click “Sort by name”.
If we were using a genshin impact model, these vertex groups would also all be
numbers. If we tried to name two different groups as “89” for example, the second
group will automatically be renamed to “89.001” to prevent a conflict. However,
this will only make things more confusing for us. So to prevent this we would
preemptively rename every vertex group to something like “a” and let it
automatically rename them to a.001, a.002, a.003, until the last group. And then we
would start renaming them based on Sara’s weights However, this MMD model
has the vertex groups named after the bones they relate to so we can skip that
step.
Masked Weight Painting
Many of these groups will seem obvious to match. Some will not match anything
and need to be deleted in the end. Some may require manual changes. For example,
most characters in genshin impact have 2 bones in their feet. One bone which we
can see is weighted to the heel and another bone weighted to the toes. However,
Kujou Sara only has 1 bone in her feet because her shoes are meant to be very stiff.

So we need to fill in the weights of the heel bone to cover the toes on the MMD
model. Of course this will be difficult to do without accidentally applying weight
to the other foot which would make the animations very bizarre. We can make this
much easier by first returning to Edit Mode. You can press 3 to use “Face
Selection” mode. Make sure that you are in X Ray mode by pressing Alt+Z to
show the points in the back of the model.
Set the view to Front facing Orthographic mode using the tool in the Top Right
corner of the workspace and clicking on the “Y” axis.

Select just one foot and then return to weight painting mode.
Now you can click on the option to activate a “Paint mask”. This will ensure that
regardless of how big your weight painting brush is, you will only paint the points
we selected beforehand.

As you paint more, you may want to experiment with your brush settings. Here we
need to change one setting before we begin. By default “Front Faces only” will be
set to on. We need to disable this setting or you will find the back of the model left
unpainted when you’re done.
In this circumstance we need to paint the toes red meaning 100% weight. Now we
can delete Blake’s vertex group for her toes.
More Weight Painting

The MMD model seems to have multiple bones that control a single bend in the
forearm. However, genshin characters only have one bone controlling the forearm.
So we need to paint this to create some parity between Kujou Sara’s vertex group.
However, we need to be careful not to make the weights too stiff.

As we click on the weight multiple times we can see its influence grow. We need it
to be red around the stiff part of the arm and green around the elbow. Once we’re
done with this we can just delete the other vertex groups that makeup the forearm.
Normalize Weights
When you finish modifying weights and renaming vertex groups, delete all of the
extra vertex groups that did not get renamed. And next you must always
remember to Normalize Weights before you export the mod if you use weight
paint mode to modify the weights.

If points are not weighted to any vertex group, you will see parts of the character
stretch towards the center in a very ugly and glitchy manner. Make sure every point
is weighted, the easiest way to do this is to look at the points that are broken
in-game and try to find the general area in blender. Keep in mind that the models
get flipped on the X axis when they are imported into blender so the right arm in
blender will be the left arm in game.

Vertex Colors
Vertex colors influence the outlines of the character. If your model was obtained
from Genshin Impact with 3dmigoto, this process will already be done for you. But
this model does not have vertex colors. Firstly, we need to add a Vertex Color to
the object and call it “COLOR” in all caps.

The process of painting colors can be done automatically using a script written by
LeoMods on the AGMG Discord server. It can also be done manually in Vertex
Paint Mode, but we will use the script to do it more precisely.

Vertex Color Guide

Red Complements Lightmap Green value


Green Relates to the vertex ramp width.
Blue Affects the outline offset
Alpha Base outline thickness

Essentially what you need to know is that if the outlines are too big, it’s because
the Alpha channel is too high, or if the outlines aren’t there it’s because the alpha
channel is too low.

Scripting in Blender
Return to object mode and select the MMD model that we need to color. We need
to go to the Scripting workspace and click the “New” button to get started.
Next we can paste the script into the window. For this script there is no need to
change anything about it.

Next you will press the play button to run the script and now vertex paint will be
complete.

This is the script written by LeoMods to paint Vertex Colors


import bpy
#This script will paint your whole object with a single color. Including alpha channel

# all selected objects will be affected

selected_obj = [obj for obj in bpy.context.selected_objects]

for obj in selected_obj:


mesh = obj.data

if not mesh.vertex_colors:
mesh.vertex_colors.new()

color_layer = mesh.vertex_colors["COLOR"]

i=0
for poly in mesh.polygons:
for idx in poly.loop_indices:
#Chose color here
#ALPHA --------------------------------------*
#GREEN ---------------------------------*
#BLUE ----------------------------*
#RED ------------------------*
color_layer.data[i].color = (1, 0.502, 0.502,0.5)
i += 1

Exporting

Basics
Before we are ready to export we need to check off a few basic issues.

● The UV map on the new model needs to be named “TEXCOORD.xy”.


● There needs to be an object in blender named after all of the parts that were
imported in the frame analysis. Sara has a “Body”, “Dress” and “Head” so
we need 3 objects with these names. You cannot have more than one mesh
with these strings of text in its name or the export will fail.
○ KujouSaraHead
○ KujouSaraBody
○ KujouSaraDress
● Since we are using version 6.0 of the 3dmigoto plugin, each object needs to
have some visible mesh in it. In order to export it with empty objects we
would need to use Version 7.0 which has recently been released in Beta. In
version 6.0 you would need to add lines to the script telling 3dmigoto to skip
the objects that you left empty or they will revert back to normal.
● The new model needs a Vertex Color called “COLOR”

Objects
In order to export our mesh we will replace one of Kujou Sara’s objects with the
mesh and it does matter which mesh we choose. Each object uses a separate texture
in-game, so if you wanted to be optimal, you could use this to your advantage to
save space on textures. However it is often the case that the Body and Dress use
the same picture even though they use the same texture file and the Head uses a
different picture. But sometimes the head and dress use the same picture so keep
that in mind when you’re making basic changes to a character.

1 Head Always has a separate texture, usually


refers to the hair and eyes. Models that
only have 1 object will always default to
having a head.
2 Body Sometimes mobs will have their hair and
face in the “Body” object and their body
in the “Head” object so don’t consider the
names to be accurate.
3 Dress Often this object seems to use a two sided
material so it can be useful if you want to
create draping clothing without the
underside having strange rendering. The
object may have a second UV Map to
define the textures on the underside of the
dress.
4 Extra Some characters like Yelan may have a
fourth object on them.

Do not delete the object because there is some hidden data in them that we want to
keep. I did not mention earlier that you will need to fill in the missing vertex
groups between numbers meaning if you had a weighted vertex group for 7 and 9
you would need to add an empty group and name it “8” but we can get blender to
do this automatically for us by merging our modified body into the genshin object.

Since we are using 6.0, we want to make use of every object, so the plan is to keep
the Head and body, and then merge the new body into the dress object.

First go to the dress object, enter Edit mode and delete all of the vertices. Return
to Object Mode and select the new body first. And then hold CTRL and select the
Dress Object. The last object you select this way will be the target. So when you
press CTRL+J the mesh you selected first will merge into the mesh you selected
last. If nothing happens, your mouse needs to be hovering over the workspace area
for the button combination to work.

Return to Object Mode and edit the KujouSaraBody Object. Here we’re going to
delete all of the vertices except the neck, jaw and ears. We need to be sure that we
do not edit the position of any of the points that will be connected to the face or
you will see a seam open up in game. But we do want to pull the bottom of the
neck down to fit into the shirt of our new body.

So now our mesh should look like the image below, and we’re going to do
something similar to the head object.
When you’re ready to export you need to go to File > Export > Exports Genshin
Mod Folder. This will open a file explorer where you will need to search for the
folder that we created when we dumped Kujou Sara from the game.
Open the folder and check the box that says “Use Foldername” on the right sidebar.
The folder needs to be named after the character that we’re exporting. By default
the folder will be named correctly. Once exported, a new folder named
“KujouSaraMod” will appear next to it with the mod files, textures, and scripts all
ready to be placed into a 3dmigoto mods folder. The only issue is that this folder
always takes the default textures, so we’ll just need to replace those textures with
our new ones.
Lightmap Painting
Each object will use 2-3 textures: A Lightmap, a Diffuse Texture, and 3.0+
characters will use a Normalmap. The lightmap controls the behavior of light on
the object, and the color of the outlines. The diffuse texture is the texture we’ll see
in game. The normalmap is unnecessary, but it adds properties to the surface of the
object.

Red Increases specular value and metallic mask. Often the shadows of hair are painted as just
128 Red. Metallic surfaces will also use between 100-255 Red.
Green Controls general light behavior. If the green value is 50 or lower (<20%), the texture will
be permanently in shadow. Greater than 200 green is used to separate the eye from the
hair. In general skin tone is painted as just 128 green.
Blue Represents specular value. Blue is often only used for metallic or reflective surfaces, and
the highlights of the hair.
Alpha Each character and object has predefined outline colors based on certain alpha levels.
(Opacity) Most objects produce black outlines when alpha is less than 20%. At 100% alpha we get
the red-orange outlines that look best for skin tone.

Color Guide
Artistically, it’s not necessary to paint shadow areas as permanently in shadow, but
I’ll list them here just so you know. The alpha value necessary to achieve the right
outlines on the head object varies, so I won’t specify the alpha value for hair. Some
3.0 Characters like Nilou work best with skin tone using 128 alpha, but most other
characters need 255 alpha on their skin tones.

Red Green Blue Alpha


Skin 0 128 0 255
Skin Shadow 0 0 0 255
Clothes 0 128 0 0
Clothes Shadows 0 0 0 0
Hair 128 128 0
Hair Shadows 128 0 0
Hair Highlights 154 128 180
Reflective 204 128 76
Metals 255 128 255

So in simple terms, this Kujou Sara mod has no skin showing, so we can just use
Paint Bucket to cover the entire lightmap as the “Clothes” color. We’re going to set
our colors in Paint.net to the clothes value I’ve specified but we’re going to keep
the alpha at 255.
Next we will set the Paint Bucket tool’s tolerance value to 100%, so it will cover
the entire image.
Now we can go to Adjustments > Invert Alpha and now the alpha will be 0 across
the entire image. Because this is just a flat color, we don’t need to worry about the
aspect ratio or how it will match the UV Map. If you were doing a type of a model
combination, you would need to combine both of their Lightmaps in a way that
matches the UV Map. However, lightmap texturing is purely cosmetic, and if you
aren’t interested in the work, a basic lightmap like this is sufficient.
When we save the file we need to save it as a Direct Draw Surface File (DDS)
which should be selected by default. DDS is a “Lossy” image format which means
that each time we save the file, the quality of the image will go down. Fortunately
that doesn’t matter in this case because it’s just a big 128 green image, but keep
this in mind when you find yourself making lots of small updates to a diffuse
texture.

When we save, Paint.net will ask us for parameters on how it should “compress”
the image. We want to choose the highest quality compression “BC7” for the least
quality loss and compression speed “slow”. For a Lightmap texture we need to
specify BC7 Linear. For Lightmap and Normalmap textures we should always
choose Linear and for Diffuse textures we must always choose sRGB.

BC7
Lightmap Linear
Diffuse sRGB
Normalmap Linear
Icons Linear

For whatever reason the nvidia plugin developers don’t know how to differentiate
Linear and sRGB, so if you are using photoshop with that plugin, I would
recommend exporting the file as a PNG (or DDS to maintain the alpha channel),
open it in Paint.net and then save it as a DDS file through Paint.net.
Diffuse Texture
Diffuse textures are very straightforward. Here we want to use the same texture we
created for blender. We just need to save it as a DDS File. However, there is one
important thing to know about diffuse textures. The alpha channel on the diffuse
channel represents an “Emissive boost” which causes the color to glow. In general
we want the alpha channel to be 0, but certain glowing parts like visions need 255
alpha.
Our texture doesn’t need any glowing parts, so we’re going to take the image we
originally created and invert the alpha of the entire image.

Troubleshooting / Advanced

Normal Map for 3.0 Characters


When the normal map is overlapping the wrong sections of the UV Map because of
aspect ratio or mesh changes, you will see strange shadows appearing on the
character. An easy solution is to do a Canvas Size change to match the aspect ratio
and paint the new square as 128 Red, 128 Green, 0 Blue, 255 Alpha. And then save
the Normal Map as a Linear. Or paint the entire square that color.

You might also like