Jump to content

PS-T# Replacement when using Skin on Clothing hash


Recommended Posts

Posted (edited)

It appears that for some costumes their skin meshes do not have all the vertex groups/bones of a whole body(14x for normal bodies, but some have way less vgs). And it seems like these vgs/bones only exist on the other clothing mesh.

Therefore, to make the costumes nude, it seems like the only possible way would be to replace the clothing mesh which has the bones that the original body mesh is missing with a new body mesh(only the part where the missing vg covers). 

 

However, it seems like im not getting the PS-T# replacement part correct, as the clothing mesh that got replaced with body mesh doesn't match the color of the actual body mesh.
Here is what it looks like.
image.png.d268573d95e8095771a8faff5b235724.png

As the picture shown, you can clearly see where the clothing mesh(that got replaced with body mesh) ended.
This is an example of where the arm VG doesn't seem to exist on body mesh, therefore I tried to replace it with a clothing mesh that has the missing arm VG
The costume in question is image.png.07cee503b543690fd38dece329f468bb.png
星彩のベスト from Misaki
Though it is not just this costume that has the problem, a lot of other costumes such as those full body swimsuits also have the problem of missing huge chunk of vgs.

Would be appreciated if some experienced modder could tell me what Im missing.
Or would it actually be possible to find out all the missing vgs on the body mesh?

 

Edited by Honoka012
Posted

supplement:

Other than the VGs below the socks part, there are a total of 4 more VGs that are missing on the body mesh for this costume.

Two of those, one for each arm.

The other two are for the right side boob.

The current patching is just a test on Clothing-Body mesh replacement.

Posted

The solution takes a couple steps. To summaraize, you switch the body's pose buffer (vs-cb2) to the clothe's pose buffer, and use a body mesh or portion of the body with weights transferred from the clothes.

 

I'd reccomend splitting the body into two or more meshes; one with the usual body's weights, and one where the weights for clothes will be used. Split the body at a place easy to fix seams. You will want to make sure the vertexes and normals at the seams match.

 

In the ini code you will copy the "clothe's pose buffer" into a custom resource, and use it as a replacement when drawing the body mesh.

for example:

 

[TextureOverride Body]
hash = ?
match_first_index = ?
; 1.
Resource-Bak-Pose = vs-cb2
vb0 = Resource-Body-1-VB
ib  = Resource-Body-1-IB
; 2.
drawindexed = auto
; 3.
vs-cb2 = ref Resource-Clothes-Pose
vb0 = Resource-Body-2-VB
ib  = Resource-Body-2-IB
; 4.
drawindexed = auto
; 5.
vs-cb2 = ref Resource-Bak-Pose

[TextureOverride Clothes]
hash = ?
match_first_index = ?
; 6.
Resource-Clothes-Pose = vs-cb2

[Resource-Bak-Pose]
[Resource-Clothes-Pose]
  1. Copy the body's original pose to a custom resource so you can re-apply the original pose for nails or any other mesh that may use the pose after the body.
  2. Draw the body parts with ordinary body weights
  3. Switch to the clothe's pose
  4. Draw the body parts with clothe's weights
  5. Switch back to the original body pose
  6. Copy the clothe's pose to a custom resource
Posted
46 minutes ago, krunkDunk said:

The solution takes a couple steps. To summaraize, you switch the body's pose buffer (vs-cb2) to the clothe's pose buffer, and use a body mesh or portion of the body with weights transferred from the clothes.

 

I'd reccomend splitting the body into two or more meshes; one with the usual body's weights, and one where the weights for clothes will be used. Split the body at a place easy to fix seams. You will want to make sure the vertexes and normals at the seams match.

 

In the ini code you will copy the "clothe's pose buffer" into a custom resource, and use it as a replacement when drawing the body mesh.

for example:

Thanks a lot for the detailed explanation, can't wait to try this when the DMM server goes up.
Though I still have a few questions. 

 

1. Where do we find the full documentation on the various keywords/commands to use for the .ini file? Cause as far as this wiki(https://github.com/bo3b/3Dmigoto/wiki) says, I can't seem to find what the `ref` keyword means when you are copying resources. Or is digging through the entire directx11 section of the github the only way?

 

2. What caused the texture mismatch with my original method?

This is what im assuming. By drawing the body mesh(the mesh that contains the missing vg) under clothing section in [TextureOverride], Ive essentially messed up the pairing of the actual textures/normals/varios maps etc to the vertex indices, even though the vs-cb2 part is correct? However, if I draw it(the mesh that contains missing vg) under the body section in [TextureOverride], the texture stuff will match perfectly, and all I need to do is to change the vs-cb2 part to the clothing so that the bone matches the vg. 
Is this assumption correct?

 

btw Im not really knowledgable in all these 3D modeling terminology, so please do correct me if Im wrong.

Posted (edited)

1. That's the link I used.

- "ref" is short for "reference", as opposed to "copy"; vs-cb2 = ref Resource-Clothes-Pose, is like using a pointer. In different situations "ref" or "copy" will be used by default. It was in the link you posted, but I don't remember where.

 

 

2. There may or may not be different shaders applied at different times to different render targets. Some of the game's shaders are either very difficult to mod or impossible. If it is possible I don't know how.

So the clothes are using some different shader(s) than the body. They can treat alpha channel in the diffuse map differently, or anything they are programmed to do. For example on skin textures, the alpha channel is used as the specular map... In some clothes the alpha isn't used it all, and some it's actually used like you'd expect. The skin also uses a blue / magenta texture map for tans, and a black and white texture map for water droplets.

 

I'm nearly talking out my ass here - I'm just self-taught with javascript, so take it with a grain of salt.

 

Anyway, to draw body parts use the body render target ( TextureOverride with the body's hash ); as a bonus if you were to share the mod, each user will have their preferred skin texture.

 

Also, to fix seams when meshes are in multiple parts look at this tutorial. It's an older version of blender but the idea still works.

https://www.loverslab.com/topic/109195-costume-customizer-mod-v252-added-yukino-support-plus-skinshadow-fixes-and-additional-menuini-fixes/page/17/#comment-3070976

Edited by krunkDunk
Posted (edited)
13 hours ago, krunkDunk said:

1. That's the link I used.

- "ref" is short for "reference", as opposed to "copy"; vs-cb2 = ref Resource-Clothes-Pose, is like using a pointer. In different situations "ref" or "copy" will be used by default. It was in the link you posted, but I don't remember where.

 

 

2. There may or may not be different shaders applied at different times to different render targets. Some of the game's shaders are either very difficult to mod or impossible. If it is possible I don't know how.

So the clothes are using some different shader(s) than the body. They can treat alpha channel in the diffuse map differently, or anything they are programmed to do. For example on skin textures, the alpha channel is used as the specular map... In some clothes the alpha isn't used it all, and some it's actually used like you'd expect. The skin also uses a blue / magenta texture map for tans, and a black and white texture map for water droplets.

Thanks a bunch for the help, the misaki costume is now perfect.
image.thumb.png.a12deebce9418772a7189bad6eadf69b.png

The entire upper body including the chest is replaced by the mesh that uses the shirt bones
 

1. Ya I didn't read through the entire thing, just found the whole copy and reference keyword definitions in the resource copy section

 

2. I have no idea how the texture/map stuff gets paired to the mesh, but I have seen other mods that used this technique before and that is the reason I tried my original method in the first place. However, the mod was doing the reverse. Instead of using clothing bones on body mesh, it was using body bones on clothing mesh. 
This is the example mod. It added new clothing to the body bones (by this I mean in the [TextureOverride] section with the same body hash, it added the clothes) and also used ps-t0,  ps-t1 to change the clothing texture in the body's [TextureOverride] section. Maid_Common.rar

Edited by Honoka012
Posted (edited)

Nice. One last thing. When you copy the pose from a different render target, it can cause visual glitches if there are duplicate outfits in the same scene.

 

Consider a TextureOverride section with a specified hash as a render target. If two girls are on screen wearing the same outfit, the TextureOverride section will match both render targets, both outfits, and if you copy the pose in that section it will be copied to the custom resource twice - the last time it's copied is the pose that is saved ( every frame ). And which render target is matched last - the last pose saved - may change frame to frame.

 

If there was another girl with Misaki's outfit and they were on screen together only one of them would have the body parts with the clothes weights; the other would have missing body parts... Both the body parts with clothes weights for both girls would be drawn in the same place - where the last pose buffer was copied from. I don't know an example off the top of my head, but I think Teddy has made a few outfit mods that copy clothes poses.

Edited by krunkDunk
Posted (edited)
4 hours ago, krunkDunk said:

If there was another girl with Misaki's outfit and they were on screen together only one of them would have the body parts with the clothes weights; the other would have missing body parts... Both the body parts with clothes weights for both girls would be drawn in the same place - where the last pose buffer was copied from. I don't know an example off the top of my head, but I think Teddy has made a few outfit mods that copy clothes poses.

ya, seems like this is another example. Just wondering though, is it currently not possible to make the targeting of [TextureOverride] be more specific? So instead of just targetting the hash of the vb/ib, it also makes sure that mesh is paired to certain PS-T0 hash? Cause it seems like different girls even if with the same body type will have different PS-T0 associated to the same clothing.

At least in this case, we can map the PS-T0 hash from the girl clothing to the girl body(since the body also has PS-T0 that differs on an individual case instead of body type) to avoid this problem?
Of course this is at the cost of more work, since we have to do this for however many girls that have the costume.

Edited by Honoka012
Posted

Tried to use hash = (hash from PS-T0 instead of VB/IB) under [TextureOverride] resulted in this:

image.thumb.png.afe99d7988e28a1a8fd7c03d51eddf38.png

not quite sure what went wrong but my guess is something related to PS-T# part?

Posted (edited)

It's getting a little too complicated for me to confidently give advice...

 

There is no way to guarantee you pair the correct clothes pose with correct body when duplicate clothes/bodies are on screen.

 

The best you can do is what CostumeCustomizer does...

In this situation Takao and Dewa are duplicates except for texture maps.

The body meshes have the same vb hash, same weights. The clothes meshes have the same vb hash and same weights.

With user input, you can mark which girl is wearing which suit, then the texture map hash can be used to discriminate.

 

There are two possible customization profiles. One for Takao and one for Dewa.

Girl A can wear Takao and get Profile 1.

Girl B can wear Dewa and get Profile 2.

Girl C can wear Takao and get Profile 1.

etc...

And there is no way to automatically detect which girl is wearing which suit, except with user input.

 

I'm not sure what caused the problem in your screenshot. Maybe I can tell you if you share the code.

Edited by krunkDunk
Posted
39 minutes ago, krunkDunk said:

I'm not sure what caused the problem in your screenshot. Maybe I can tell you if you share the code.

My apologies, here is the file Cygnus_BodyPink copy.rar.

image.png.93b0f11d9fbc27fb5ec4bb9dc6728a73.png

Swimsuit name is シグナス for kokoro only, since Im using the ps-t0 hash for kokoro.

It seems like it leads back to the problem of texture/maps not being applied correctly.

Also doing so would just mess up all the other swimsuit's pose since the ps-t0 for skin is all the same for each costume of kokoro.

What im trying to achieve is to make it so that only when vb/ib = x, and ps-t0 = y, where x, y are certain values then let 3dmigoto do its work.

 

Posted (edited)

It's kind of possible in a convoluted way, but it's not useful if you are copying a pose from a suit - and duplicate suits are on screen. You can try to decipher the CostumeCustomizer code; that's the niche situation where it's somewhat possible. Limited by 2 variations on the texture map ( 2 distinct hashes ).

 

In your code, in the TextureOverride section where you match to a suit's texture map hash, I think it skips the rendering during the pixel shader phase, but not the vertex shader. So the shadows calculated from the vertex shader (vb0 & ib) persist.

 

In CostumeCustomizer I think the code does some convoluted shit with shadows / poses to overcome the problem.

Edited by krunkDunk

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...