FlailingFog / KK-Blender-Porter-Pack

Plugin pack for exporting Koikatsu characters to Blender.
308 stars 29 forks source link

Miscellaneous issues with KKBSP v5 #65

Closed ilcane87 closed 2 years ago

ilcane87 commented 2 years ago

This picture was taken after the "Convert and Apply colors " step, and shows two small problems:

image

  1. The right eyewhite is assigned a hair material, which is easily fixed by merging it with the Eyewhites (sirome) material.

  2. One vertex of the lower lip was merged with one of the upper lip; I verified that this doesn't happen when importing with CATS using an increased scale, so I'm assuming the "Finalize PMX" step performs a Merge By Distance on all vertices, which is a risky operation because almost-overlapping vertices may get joined together too, especially on small scaled high poly models.

The problem with the increased scale workaround is that some bones get weird resizing results like these:

image

Either removing the merge operation or fixing the bone resizing would solve the issue.

Here's the reference character, I used the default outfit:

https://db.bepis.io/koikatsu/view/17005

On a side note, is there a way to revert the permanent Wireframe looks (X-Ray looks in edit mode) of bones in the imported armature from CATS? I tried all of the typical functions and overlay options, but none of them seem to affect them:

image image

FlailingFog commented 2 years ago
  1. The right eyewhite is assigned a hair material, which is easily fixed by merging it with the Eyewhites (sirome) material.

I added a fix for this yesterday, does that one work or is it still doing it?

  1. so I'm assuming the "Finalize PMX" step performs a Merge By Distance on all vertices,

It only does this for the body materials to prevent seams from appearing on the neck / down the torso. The merge distance can be set (in separatebody.py line 147) so I can check the card and set it lower to a value that works.

On a side note, is there a way to revert the permanent Wireframe looks (X-Ray looks in edit mode) of bones in the imported armature from CATS?

It looks like CATS sets the viewport display options in this tab to Wire image

MediaMoots commented 2 years ago

@ilcane87

importing with CATS using an increased scale

How did you import? With this button: image

Or this button? image

ilcane87 commented 2 years ago

@MediaMoots

I tried both. The Import Model button results in a small scaled character (less than 1.5m of height, which I assume is the original height), and presents the merged vertices issue after the "Finalize PMX" step. Then I tried using the MMD button and choosing the default scale of 0.08 in the custom settings, which resulted in a character of roughly the same height of the previous try, which still presents the issue after the following step. Then I tried using the MMD button with an increased scale of 0.4, which resulted in a character taller than 6m, and that one was safe after the following step.

Note that even in the small scaled cases the mouth shape-keys work correctly (without the merged vertices) before performing the "Finalize PMX" step, so the issue isn't with CATS or KKBP_Exporter:

image

ilcane87 commented 2 years ago

@FlailingFog

I added a fix for this yesterday, does that one work or is it still doing it?

Just cloned the repository again and it's fixed, well done.

It only does this for the body materials to prevent seams from appearing on the neck / down the torso. The merge distance can be set (in separatebody.py line 147) so I can check the card and set it lower to a value that works.

I tried adding one 0 and the issue didn't appear:

_bpy.ops.mesh.removedoubles(threshold=0.00001)

It looks like CATS sets the viewport display options in this tab to Wire

Completely forgot about that tab, thanks a lot!

Random question: I noticed that aside from the Template Face material, all the materials belonging to face components are set to use the Template Body Outline material rather than the Face one for the solidify modifier, is that intended?

image

There's slightly different results when switching between the two, not that I would've normally noticed if I didn't check the setup.

MediaMoots commented 2 years ago

@MediaMoots

I tried both. The Import Model button results in a small scaled character (less than 1.5m of height, which I assume is the original height), and presents the merged vertices issue after the "Finalize PMX" step. Then I tried using the MMD button and choosing the default scale of 0.08 in the custom settings, which resulted in a character of roughly the same height of the previous try, which still presents the issue after the following step. Then I tried using the MMD button with an increased scale of 0.4, which resulted in a character taller than 6m, and that one was safe after the following step.

Note that even in the small scaled cases the mouth shape-keys work correctly (without the merged vertices) before performing the "Finalize PMX" step, so the issue isn't with CATS or KKBP_Exporter:

Nice, thanks!

FlailingFog commented 2 years ago

Random question:

The index should start at zero, so that's why it's set to 11. I also added the extra zero to the threshold value, thanks for checking it

ilcane87 commented 2 years ago

The index should start at zero, so that's why it's set to 11. I also added the extra zero to the threshold value, thanks for checking it

The resulting index is calculated individually for each material, starting from its current index, so:

In other words, all of the face elements are set to use the wrong (I assume) outline. This is what the correct order would be when using an offset of 11, so that every material except Template Body is mapped to the Template Face Outline:

image

On that note, when separating objects (such as underwear) as indicated in the instructions, the 'Import KK Shader and Textures' step will usually mess up the materials order in contrast to the material offset of the solidify modifier, which gives odd visual results (like using non-outline materials as outline). Here is an example:

image

And this is the fixed version using the same material offset:

image

FlailingFog commented 2 years ago

Sorry I misread your point. I guess you can call it intended... I've known about this but I personally use freestyle instead of the outline modifier so I was kind of just going to leave it like that until someone said something. I'll reorder the materials in the scripts

The outline index for the clothes objects used to work, I just haven't looked into it yet.

ilcane87 commented 2 years ago

freestyle

I'd been considering using that, does it give you as much control as the modifier for outlines? For instance, can you make the lines more or less pronounced based on vertex groups?

FlailingFog commented 2 years ago

I only use it as an outline on/off type thing so I don't know if you can finetune it like that

FlailingFog commented 2 years ago

~I don't know what happened but the automatic clothes material offset is now working for me in both 2.93.4 and 3.0.0 so I'm going to close this. Let me know if it's still happening.~ Oops, I wasn't reproducing it correctly. Just fixed it

MediaMoots commented 2 years ago

@FlailingFog Does the automatic color import system still work on Blender 3.0?

FlailingFog commented 2 years ago

Does the automatic color import system still work on Blender 3.0?

Yep, I didn't see a difference between 2.93 and 3.0