scurest / apicula

Convert Nintendo DS .nsbmd models
BSD Zero Clause License
160 stars 19 forks source link

Can't export fbx with the UV mirrored #26

Closed Safraann closed 4 years ago

Safraann commented 4 years ago

Hi scurest, Good job for your tool and thanks for the sharing. But I'm encountering a problem when it comes to solving the UV with the mirror feature, as it is mentioned here: https://github.com/scurest/apicula/wiki/IMPORT:-Maya

In 3ds max, I've found the same feature than in maya: http://image.noelshack.com/fichiers/2020/16/4/1587053644-rotated.png

After that, I export the correct 3d model, but it seems the fbx format doesn't save that parameter I just changed, because when I re-open it in 3ds max, all the uv's are misplaced, while the .max format doesn't suffer of that. I was thinking about directly editing the texture, but I don't know what transformation I have to do, I mean horizontal flip doesn't solve the problem in 3ds max. I need to change the texture, to avoid the fbx lack of saving about mirror feature. Do you know what I mean? Thanks in advance =)

scurest commented 4 years ago

I was thinking about directly editing the texture, but I don't know what transformation I have to do,

You need to

  1. add a mirrored copy to the end of the texture in the direction of mirroring. For the U direction, it would look like this

    mirror

  2. halve the UV coordinates for any verts with this texture in the direction of mirroring. For the U direction, you'd do (u, v) -> (u/2, v).

  3. set the texture to repeat in the direction of mirroring.

Safraann commented 4 years ago

Hi, thanks dude for your fast response. Is this correct?

original: https://www.zupimages.net/up/20/16/vdk6.png after transformation: http://image.noelshack.com/fichiers/2020/16/4/1587060057-test.png

Thanks in advance!

EDIT: for the third instruction, is it possible with 3ds max? After doing all these steps, will the animation remain as it was originally? Sorry I misread the first step. I'm gonna begin again. But for the 2nd step I need to unwrap the uvw map and affect all (uv) pairs, or maybe there is some script around to do that?

scurest commented 4 years ago

If you have imagemagick you can mirror the image in both directions with

convert \( INPUT.png \( -clone 0 -flop \) +append \) \( -clone 0 -flip \) -append OUTPUT.png

I don't know how 3ds max works. In Blender you can just scale the UVs along the X axis by 0.5, so try something like that. The point is to compensate for doubling the image dimensions

out

Animations won't be affected, they only affect bones.

Safraann commented 4 years ago

Hi, I've found out how to divide uv by 2 with UVW Xform, but then how to repeat the texture along the axis that interests me? What does repeating mean? Thanks in advance!

scurest commented 4 years ago

I mean like how GL_REPEAT works, whatever you'd call that. Probably tick the Tile checkbox in your first screenshot.

Safraann commented 4 years ago

Ok nevermind I've managed to get it working. I've used the render map generated by 3ds max when both "tile" boxes are checked, then I've divided all the uv's pairs by 2 with the uvw Xform modifier. But I'm still getting a problem: noesis can't correctly convert my 3d fbx to quake mdl format. But thats another matter, anyway thanks for your support dude: :)

Safraann commented 4 years ago

Hi again scurest, I'm really sorry to bother you another time, but I need your help. As I said, I need my model to be in quake MDL format, because my video game only parses that kind of format. But Noesis wrongly converts me the model, as you can see there: Here is the fbx in noesis (everything has been fixed with 3ds max): https://www.zupimages.net/up/20/16/56e0.png And heres the mdl converted by noesis, the wrong one: https://www.zupimages.net/up/20/16/1ooh.png

Could you try for me the MDL export script for blender, because I'm not able to import correctly the model in blender, the steps you mentionned above are not clear enough for me. And on top of that, I'm training and working with 3ds max since few years right now, and the Blender's UI really losts me :/ Thanks in advance if you can do that for me :)

scurest commented 4 years ago

No, I don't know anything about an MDL export script. Can't really help you with other programs but the way to convert a mirrored repeat texture to a repeat texture is the same everywhere.