lucasvinbr / blender_io_GTA5Ped

import-export of parts of OpenIV's openFormats for peds
GNU General Public License v3.0
29 stars 7 forks source link

UV placement in blender #3

Open Hacktaz123 opened 3 years ago

Hacktaz123 commented 3 years ago

Hello there, and first : Thank you for your addon ! :D

I'm quite noob with anything github related when it comme to issue/pull request/discussion, so i hope i'm in the good place for this suggestion.

I have tried your addon, imported flawlessly a .mesh ( uppr_015 ( mp_female body) ) and i have noticed something "wrong" with the UV Mapping actually. I have read your code, and saw, line 138 of your import_mesh.py, that you are flipping the UV with

lineDataEntry.y *= -1

The problem is that since you are flipping it, it put the UV map out of bound of the UV editor. So i have modified your script to translate the flipped UV back to place, which give :

lineDataEntry.y *= -1
lineDataEntry.y += 1

(I also did it with the second flipped UV)

But now i have a question, has this been done on purpose because of how GTA handle this ?

3941 commented 3 years ago

I think what you mean is you get something like this: https://i.imgur.com/5Utbyco.jpeg

Right? Tbh I don't know if GTA5 really NEEDS it that way, but you'll get the same thing if you use other tools for GTA5, like in 3dsmax with GIMS, so it seems to be the norm.

It's no big issue though. All you need to do is enable "repeat image" in the sidebar thingy for that view: https://i.imgur.com/K5Ii7g6.jpeg

Apparently this is how UVs work. It repeats over and over (even if you don't click that box), and technically you could move UV islands to different repetitions of the texture, and Blender definitely wouldn't care at all. I'm not sure if GTA would, though.

Hacktaz123 commented 3 years ago

Yeah, it's that indeed. And alright, i must admit i haven't really looked at how 3dsmax and GIMS does it ( cant stand the interface in the first place :p )

lucasvinbr commented 3 years ago

Hey! @Hacktaz123 have you tried exporting with the "y + 1" offset as well? I also don't know if GTA5 really needs that specific positioning, but if I'm reading the uppr_015_high.mesh correctly, it has some big variations on the second UVs' Y axis (from around -0.3 to -6.0), so maybe offsetting those could affect something

Hacktaz123 commented 3 years ago

I haven't tried exporting it back to GTA with that modification. It was mainly for personal usage, and thought it was maybe something you forgot in the importer :)

( I did that little modification to save it to .DAE, and be able to import the model on Substance Painter without it bugging ( apparently, the program doesnt like to have the UV out of bound ). )

I'm tinkering here and there and still learn about how GTA deal with models/texture, and must admit, it's quite unusual ( plus the fact that we are only assuming, that doesnt help a lot in the end :) )

3941 commented 3 years ago

I suppose it couldn't hurt to change it so the UV islands end up in the "proper" place, as long as import AND export account for that and the resulting export remains the same... You'd definitely have to reimport everything you're working on, though.