RenolY2 / SuperBMD

A library to import and export various 3D model formats into the Binary Model (BMD) format. (Nintendo GC/Wii)
37 stars 10 forks source link

SuperBMD doesn't export objects that have second UV Layer. #32

Open Lilothestitch16 opened 2 years ago

Lilothestitch16 commented 2 years ago

When I extract models from Super Mario Sunshine, it doesn't export the 2nd UV Layer. Can this be fixed?

First UV Layer image

No Second UV Layer image

SuperHackio commented 2 years ago

Can you send us the BMD?

Lilothestitch16 commented 2 years ago

map.zip

SuperHackio commented 2 years ago

Thanks, We'll see what we can do.

SuperHackio commented 2 years ago

Okay, please take a look here:

image

I believe that the "Second UV Map" that you're looking for, is actually this separate mesh (which gets layered with the other one)

Something like this: image

The mesh that you had posted in your original post had shown that there was only one UV Map. That is actually correct.

This water mesh here has a total of 3 meshes (Blender 2.79, but should work in newer versions) image

Trying to switch to the other UV Maps reveals that there is no texture assigned to the second UV Maps. The correct texture assignments are as follows: image

Lilothestitch16 commented 2 years ago

I imported it into 3ds Max and it didn't show the second UV Layer.

SuperHackio commented 2 years ago

Okay, after some further investigation, I have noticed that the library that SuperBMD uses for exporting doesn't properly support this. Thankfully, SuperBMD outputs the actual UV Coordinates, so all you need to do is assign the textures to the UV map manually. (I believe they're called Map Channels in 3DS max)

Lilothestitch16 commented 2 years ago

How does SuperBMD output the UV Coordinates?

RenolY2 commented 2 years ago

If you want a technical answer, I believe it adds the UV coordinates to the assimp mesh here and the remaining part of writing the uv coords to the file is up to assimp: https://github.com/RenolY2/SuperBMD/blob/a2960ca1c11542a104000dc2a3a77d71728e048e/SuperBMDLib/source/BMD/SHP1.cs#L353

The textures for the additional UV layers aren't assigned in the resulting .dae because of the complexity of BMD materials (I suppose somebody could make it so that instead of assigning the first texture it finds in a material it tries to check the tevorders/texcoordgens for the layer and texture used but that's complexity and additional points of failure) so atm it just uses the first texture of a material, if I remember correctly

I can also confirm the additional UV layers are visible in Blender 2.93. I don't have 3DS Max anymore so I don't know where in 3DS Max you can see the additional UV layers.

Lilothestitch16 commented 2 years ago

I have 3ds Max 2015 and I can confirm that it doesn't import the additional layers.