UuuNyaa / blender_mmd_tools

MMD Tools is a blender addon for importing/exporting Models and Motions of MikuMikuDance.
GNU General Public License v3.0
1.94k stars 92 forks source link

Exporting vertex colours as AddUV 2 not supported #92

Open mienaiKnife opened 1 year ago

mienaiKnife commented 1 year ago

I was trying to use Blender with MMD Tools to convert ripped game models to PMX, but then I realized that the shaders made for ripped game models take for granted that there should be vertex colour values in the AddUV 2 display. I think this must be because that's how minmode's Noesis script exports vertex colours. Would it be possible for vertex colour export support to be added? image image

UuuNyaa commented 1 year ago

As discussed in the following Issue, Additional texture UV is represented as UV maps in Blender.

So, storing data in UV maps could help you achieve your goal.

mienaiKnife commented 1 year ago

I still haven't been able to figure this out because the only solution I could think of was to bake the vertex colours to an image texture in Blender so that I could manually restore the vertex colour pattern in PMXE them using the UV editor plugin, but I ran into a dead end with that plan because I had to redo the UV map to prevent vertices from overlapping with each other and then couldn't figure out how to import more than one UV map per material into PMX. If there's a different approach that's supposed to be suggested in the linked issue, I haven't been able to figure it out, sorry

mienaiKnife commented 11 months ago

Updating this issue now that I better understand what's going on and can better articulate the feature that I want to request:

I am not aware of any way that I can use Blender to convert vertex colours into AddUV so that the colours will be interpreted by the AddUV display in PMX Editor the same way that Blender displayed the vertex colours. As I previously described on the Discord server, I tried using the Convert Attribute button to convert the vertex colours attribute into a UV map, but the colours were not accurate. I then tried flipping the UV map upside down because of how the colours appeared to have been inverted, but they still didn't match.

I would appreciate the addition of a button in this plugin that can convert vertex colour data into a UV map that can be read correctly by PMXE. Maybe some other users would appreciate a button that can also do the reverse operation. Also, I think it would help if naming the extra UV map to "UV2" before exporting to PMX would result in that UV map going into the AddUV2 slot, regardless of how many UV maps there are and what order they were created in.

I am unable to write the script to do this operation myself, so I hope that someone else can add this feature to MMD Tools.

mienaiKnife commented 1 month ago

Should've posted this here months ago, but better late than never:

I made this video in part to demonstrate a workaround for exporting vertex colours into the ADD UV2 map: https://youtu.be/6x86okXV0lQ&t=1084

I hope that sharing my process for doing it manually will help make it easier for someone to program the functionality into MMD Tools.