Skip to content

Commit

Permalink
GUIDE2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
leotorrez committed Sep 21, 2023
1 parent a19b11e commit 70ae002
Show file tree
Hide file tree
Showing 2 changed files with 162 additions and 73 deletions.
235 changes: 162 additions & 73 deletions ChangeSizeGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ This is a guide for the tool that allows you to offset characters position and c
- [Modifying face](#modifying-face)
- [Hiding face](#hiding-face)
- [Resizing face](#resizing-face)
- [Quick summary](#quick-summary)
- [Tips](#tips)
- [Known Issues](#known-issues)

- [INI samples](#ini-samples)

## Requirements

Expand All @@ -36,7 +37,7 @@ I also recommend that you read the [restrictions](#restrictions) section first.
- The game camera is going to remain where it was originally. For example, if you size a character up, their head is gonna be above the focal point of the camera. Alternatively, if you scale a character down, they are gonna be below the focal point of the camera. The same restriction applies to cutscenes.
- Even though your character looks bigger/smaller, their skeleton remains the same. So your character's attacks are not going to reach further than they do originally. The same applies to climbing, swimming, etc. In other words, it does not alter gameplay in any way; it is purely a visual change.

## Blender setup {#blender-setup}
## Blender setup

For the purposes of this guide, we are going to go through the process of creating a mod for Nahida that drastically changes her proportions and requires her to have a fake face model.

Expand All @@ -46,15 +47,22 @@ There are a few key points to prepare your model for resizing.

Scale your character model as close as possible to the original model.
This is an example of adult Nahida body next to her default body.
![Side-to-side comparison](images/sts_comparison.png)
![Side-to-side comparison](images/sts_comparison.png)
This is needed for proper weights transfer (if you haven't done this up to this point), and for proper deformations as well.
You can use a character armature to check deformations in blender.

Here is an example of misalignement of the sized down hair and the character's armature.
![Distance to bones](images/distance_to_bones.png)
![Distance to bones](images/distance_to_bones.png)

In this case the misalignement is not big enough to cause a severe distortion in animations, in other words, it works for this model, but your mileage may vary.

The eyes, on the other hand, are very sensitive to even the slightest difference to their position.
![Eyes difference](images/eyes_diff.png)
The bigger eyes are the default ones, and the smaller eyes are the modded ones.

Something like shown on this picture is way too much difference in the eyes position, they are gonna move weird.
**It is better to assign them to the head vertex group.**

When you are done with all this, you can export your model.

### Export
Expand Down Expand Up @@ -92,7 +100,7 @@ To fix this issue, we need to offset the character.

global $offset = *offset_value*
```
5. Calculate the offset when the character is on screen by adding `$offset = $\global\offset\offset` line in your [TextureOverrideCharacterPosition] section:
5. Calculate the offset when the character is on screen by adding `$\global\offset\offset = $offset` line in your [TextureOverrideCharacterPosition] section:
``` INI
[TextureOverrideCharacterPosition]
;initiall overrides
Expand All @@ -108,13 +116,17 @@ To do that, you need to add `run = CommandList\global\offset\Offset` line to the
run = CommandList\global\offset\Offset
```

## Modifying face {#modifying-face}
## Modifying face

Modifying faces in any way creates all sorts of different issues (see [known issues](#known-issues) for more details), but it is still doable and, in our case, has to be done.

### Hiding face {#hiding-face}
It is very important that **all the modifications to the face parts are done by their IB hash**, NOT VB!

### Hiding face

To hide the original face, you need to prevent all the face parts from rendering. You can do that by placing the line `handling = skip` in their overrides.

To hide the original face, you need to prevent all the face parts from rendering. You can do that by placing the line `handling = skip` in their overrides. It is recommended to use the `if $active == 1` check because we don't want this to take effect when there is another character on screen that uses the same face parts.
It is recommended that you use the `if $active == 1` check because we don't want this to take effect when our character is not on screen and another character uses the same face parts.
``` INI
[Constants]
global $active = 0
Expand All @@ -127,76 +139,52 @@ post $active = 0
$active = 1

[TextureOverrideFace1]
;hash =
;hash = Face Part IB Hash
handling = skip
```

For example, hiding Nahida's face looks like this. In our case, it is done in a separate INI file placed in the mod folder alongside the main INI file:

``` INI
[Constants]
global $active = 0
[Present]
post $active = 0

[TextureOverridePosition]
hash = 37ef15ec
$active = 1
match_priority = 1 ;Needed to eliminate the conflict with the main ini file because of the same hash override in there
[TextureOverrideFace1]
hash = 46343c52
if $active == 1
handling = skip
endif

[TextureOverrideFace2]
hash = 17b3e07a
if $active == 1
handling = skip
endif

[TextureOverrideFace3]
hash = 7fc58760
if $active == 1
handling = skip
endif
```

### Resizing face {#resizing-face}
### Resizing face

You don't need to resize the face if you hide it. But in case you don't - resizing is an option, although not recommended.

To resize the face, you need to add the `$faceScale` variable in your [Constants] section , and `run = CommandList\global\offset\Offset` line in each part of the face.

It is recommended to use the `if $active == 1` check because we don't want this to take effect when our resized character is not on screen and there is another character on screen that uses the same face parts.
To resize the face, you need:
- `$faceScale` value in your [Constants] section
- `$global\offset\faceScale = $faceScale` line in your [Position] section
- `run = CommandList\global\offset\Offset` line in each part of the face.

It is recommended that you use the `if $active == 1` check because we don't want this to take effect when our character is not on screen and another character uses the same face parts.
``` INI
[Constants]
$faceScale = *face_scale_value*
global $active = 0
$faceScale = *face_scale_value* ;the number you want to scale the face by

[Present]
post $active = 0

[TextureOverrideCharacterPosition]
;initial overrides

$active = 1
$\global\offset\faceScale = $faceScale
$global\offset\faceScale = $faceScale

[TextureOverrideCharacterFaceIB1]
; hash =

$\global\offset\faceActive = 1
if $active == 1
run = CommandList\global\offset\Offset
endif
```

### Offsetting face {#offsetting-face}
### Offsetting face

You don't need to offset the face if you hide it. But in case you don't - it is possible. Works perfectly if nothing was resized.

To offset the face, you need to add the `$faceOffset` variable in your [Constants] section (or you can use the `$offset` variable you already have for the body), and `run = CommandList\global\offset\Offset` line in each part of the face.

It is recommended to use the `if $active == 1` check because we don't want this to take effect when our resized character is not on screen and there is another character on screen that uses the same face parts.
To offset the face, you need:
- `$faceOffset` variable in your [Constants] section (or you can use the `$offset` variable you already have for the body),
- `$global\offset\faceScale = $faceScale` line in your [Position] section
- `run = CommandList\global\offset\Offset` line in each part of the face.

It is recommended that you use the `if $active == 1` check because we don't want this to take effect when our character is not on screen and another character uses the same face parts.
``` INI
[Constants]
$faceOffset = *face_offset_value*
Expand All @@ -216,12 +204,61 @@ if $active == 1
endif
```

A real life example for offsetting Shenhe face looks like this:
## Quick Summary

- Get your blender model ready.
- Export it as any other mod.
- Run **multiplybyweight.py** in the character mod folder you just created. It is gonna modify your CharacterBlend.buf file.
- Add [offset](#offset) for the character's body.
- [Hide](#hiding-face) (recommended) or [offset](#offsetting-face) the face. **Use their IB Hash for it!**

## Tips

- A good advice would be to download and import a character's skeleton/armature into blender for reference.
- Try to keep the position of body parts of your model as close as possible to the character's default body parts. A skeleton/armature might help you to check the deformations.
For example, if you decide to age character up, you will have to make their head smaller. And that implies making their hair smaller as well. Make sure not to overdo it, because the smaller the hair is, the more distance there is between the hair vertecies and the armature, and that means more distortion during animations.
- You can remove offset when the character is swimming so that they don't do it above or below the water. See [tracking](https://github.com/whocares8128/GI-Status-Tracker).
- If you use a fake face for the character, it is recommended that you use one of many normals manipulation tricks to force the game to draw anime-ish shadow on the face.

## Known issues

- F6 is not gonna work anymore. All the modded characters are gonna look like spiky abominations in the F6 'mods off' mode, no matter if their size was changed or not.
**Solution**: Use Hold F9 + Num 0 instead. F6 has always been a questionable feature. It will be completely removed in the next version of GIMI.
- *Outlines and reflections fix* for 3.0+ characters uses the same shader the resize and offset tool does.
**Solution**: mod texture by hash instead of ps-t values for 3.0+ characters.
- We have to modify the face one way or another, either hide it or resize and offset it. The problem is that genshin charactres share their face parts between different characters. So when there are other characters on screen with a character that uses this tool, they can randomly have their face parts hidden/resized/offset. You are usually gonna see this in party screen, in the teapot and in coop.
**Solution**: There is no solution for this.
- You are supposed to use IB hash for manipulations on the face parts, otherwise your game is gonna behave weird - it can freeze, UI elements can pop in and out of existence, you can see weird flashy artifacs here and there, etc.
**Solution**: don't use VB hashes for the face parts. Use their IB hashes instead.

## INI samples

### Offsetting Shenhe's body and face positions

An example of face offset in Leo's Shenhe mod.

You can place all the offset calculations in their own CommandList and call it from the [CharacterPosition] override section.

``` INI
[Constants]
global $active = 0
global $offset=-0.45

[Present]
post $active = 0

[CommandListOffset]
$\global\offset\offset = $offset
$\global\offset\faceOffset = $offset

[TextureOverrideShenhePosition]
hash = e44b58b5
vb0 = ResourceShenhePosition
$active = 1
run = CommandListOffset

[TextureOverrideShenheFaceIB1]
hash = 7b61f273
$\global\offset\faceActive = 1
if $active == 1
run = CommandList\global\offset\Offset
endif
Expand All @@ -231,36 +268,88 @@ hash = dc710a44
if $active == 1
run = CommandList\global\offset\Offset
endif

[TextureOverrideShenheFaceIB3]
hash = f931161a
if $active == 1
run = CommandList\global\offset\Offset
endif

[TextureOverrideShenhePosition]
hash = e44b58b5
vb0 = ResourceShenhePosition
$active = 1
$\global\offset\faceOffset = $offset
[TextureOverrideShenheBlend]
hash = 541cf273
vb1 = ResourceShenheBlend
handling = skip
draw = 28844,0

[TextureOverrideShenheTexcoord]
hash = 86c4f5ec
vb1 = ResourceShenheTexcoord

[TextureOverrideShenheVertexLimitRaise]
hash = fde191d7

[TextureOverrideShenheIB]
hash = 0b7d4e4d
handling = skip
drawindexed = auto

[TextureOverrideShenheHead]
hash = 0b7d4e4d
match_first_index = 0
ib = ResourceShenheHeadIB
ps-t0 = ResourceShenheHeadDiffuse
ps-t1 = ResourceShenheHeadLightMap
run = CommandList\global\offset\Offset

[TextureOverrideShenheBody]
hash = 0b7d4e4d
match_first_index = 14385
ib = ResourceShenheBodyIB
ps-t0 = ResourceShenheBodyDiffuse
ps-t1 = ResourceShenheBodyLightMap
run = CommandList\global\offset\Offset

[TextureOverrideShenheDress]
hash = 0b7d4e4d
match_first_index = 48753
ib = ResourceShenheDressIB
ps-t0 = ResourceShenheDressDiffuse
ps-t1 = ResourceShenheDressLightMap
run = CommandList\global\offset\Offset

; Resources -------------------------
```

## Tips
### Hiding Nahida's face

- A good advice would be to download and import a character's skeleton/armature into blender for reference.
- Try to keep the position of body parts of your model as close as possible to the character's default body parts. A skeleton/armature might help you to check the deformations.
For example, if you decide to age character up, you will have to make their head smaller. And that implies making their hair smaller as well. Make sure not to overdo it, because the smaller the hair is, the more distance there is between the hair vertecies and the armature, and that means more distortion during animations.
- You can remove offset when the character is swimming so that they don't do it above or below the water. See [tracking](http://127.0.0.1). **(LEO!!! PUT A TRACKING LINK IN HERE CAUSE I HAVE NO IDEA WHERE TO FIND IT I NEVER NEEDED IT)**
- If you use a fake face for the character, it is recommended that you use one of many normals manipulation tricks to force the game to draw anime-ish shadow on the face.
You can place all the face modifications in their own ini file if you want. Remember to set the `match_priority` value to get rid of the 'duplicate hash override' error.

## Known issues {#known-issues}
This is a separate INI file to hide Nahida's face in Leo's 'Rukkhadevata over Nahida' mod.

- F6 is not gonna work anymore. All the modded characters are gonna look like spiky abominations in the F6 'mods off' mode, no matter if their size was changed or not.
**Solution**: Use Hold F9 + Num 0 instead. F6 has always been a questionable feature. It will be completely removed in the next version of GIMI.
- *Outlines and reflections fix* for 3.0+ characters uses the same shader the resize and offset tool does.
**Solution**: mod texture by hash instead of ps-t values for 3.0+ characters.
- We have to modify the face one way or another, either hide it or resize and offset it. The problem is that genshin charactres share their face parts between different characters. So when there are other characters on screen with a character that uses this tool, they can randomly have their face parts hidden/resized/offset. You are usually gonna see this in party screen, in the teapot and in coop.
**Solution**: There is no solution for this.
``` INI
[Constants]
global $active = 0
[Present]
post $active = 0

[TextureOverridePosition]
hash = 37ef15ec
$active = 1
match_priority = 1 ;Needed to eliminate the conflict with the main ini file because of the same hash override in there
[TextureOverrideFace1]
hash = 46343c52
if $active == 1
handling = skip
endif

[TextureOverrideFace2]
hash = 17b3e07a
if $active == 1
handling = skip
endif

**Guide by the awesome: Zlevir <3**
[TextureOverrideFace3]
hash = 7fc58760
if $active == 1
handling = skip
endif
```
Binary file added images/eyes_diff.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 70ae002

Please sign in to comment.