ata4 / disunity

An experimental toolset for Unity asset and asset bundle files.
The Unlicense
2.7k stars 659 forks source link

UV issue ? #39

Closed anthonykozak closed 10 years ago

anthonykozak commented 10 years ago

Hi, First of all, thank you so much for you tool. It's the only decompiler working at the moment !

I succeed to decompile a .unity3d with the latest 0.31 release. But it seems that the UV mapping is failing, do you maybe already know this issue ?

Thank you for your help ! regards, Anthony

uv

ata4 commented 10 years ago

I think the UV is okay, but you may have to flip the textures on the Y axis. It's the way how Unity is storing textures and Disunity can fix that on uncompressed textures only.

But now that I think about it... it may be easier to fix the UV coordinates instead of the textures...

anthonykozak commented 10 years ago

okay, I just tried to flip X, Y, then X and Y and for each way rotating in the 4 directions. but it doesn't seem to work unfortunatly.

I attached the model and original texture if you want to see the issue.

http://goo.gl/1jJde1

So I guess it's not only a matter of rotating the UV ?

ata4 commented 10 years ago

Hmm yeah... the UV really doesn't fit. But it's not completely wrong either, so it's probably not a reading error. Can you upload the binary file as well or is it too large?

anthonykozak commented 10 years ago

The webplayer can be downloaded here (60MB) : http://goo.gl/zQTXGx Really hope you can find something ;)

ata4 commented 10 years ago

Thanks for the link. It looks like that the models are using a custom shader that transforms the UV coordinates. If I use a default shader in Unity, the result is pretty much the same as in your screenshot, just with one axis flipped. If you want to use the models outside Unity, you'll have to look at the shader code in Lightmap-Color_Spc_Ref.shader and use a script or something that fixes the coordinates or emulate the shader in the shading language of your choice.

anthonykozak commented 10 years ago

Thank you very much for the time spent! So you actually succeed to get it right placed inside Unity ? I tried the Lightmap-Color_Spc_Ref shader and the others, but it doesn't seems to change the UV comparing to the default diffuse shader. I retried the 16 texture transform possibilities (flip X, Y, X+Y then 4 ways rotating) with that shader but it seems to be the same. If you get it working, can you maybe send me a package ? Else, I think I will try to regenerate the lightmaps.

Thank you so much ;)

ata4 commented 10 years ago

Well, I opened the file directly in the editor. Extract the .unity3d with bundle-extract, add .unity to the extension-less scene file, place both files in the root directory of a Unity project and open it from there. You should see the whole model collection with correct texturing.

anthonykozak commented 10 years ago

Alright ! So the models from the .asset are well mapped, I was using the models extracted from the extract command, which doesn't worked with the same materials.

Thanks for your help, and keep it up! I'm currently integating your tools inside a native GUI application.