Vertically flipped DXT1 and DXT5 textures to keep original files orienta...#43
Vertically flipped DXT1 and DXT5 textures to keep original files orienta...#43dletozeun wants to merge 1 commit intoata4:masterfrom
Conversation
…ntation + allowed '-' character in output file names
|
Hi there, thanks for the contribution! For the filename filtering, I recently added the FilenameSanitizer class in IOUtils, which should filter out all bad characters on various operating system, so that's fixed already. And I addressed the flipped texture issue, too. However, instead of modifying the texture data, I decided to simply flip the U/V coordinates. The benefit of this method is that it works with all texture formats, since Unity supports a lot more formats than just uncompressed RGB and DXT. However, I would like to convert all compressed textures to RGB in later releases somehow, so your code still might come in handy. |
|
Hi, sorry I did not checked out all your latest commit after I forked your repo. I am going to do so and merge :) About the texture vertical flip. Actually it is not clear to me which textures format are actually flipped and which are not (in the asset bundle files context) and more importantly why. Because looking at your code you are just taking the DXTn compressed data as is. So it looks like Unity devs are flipping vertically textures on purpose compared to the source texture. Since I was not sure that all textures formats supported in asset bundles encode textures vertically flipped I preferred not to flip meshes UV because if i am not mistaken it is assuming that all textures used by a particular mesh are actually vertically flipped, so is it really safe to flip the meshes UV coordinates instead ? Also that sets a strong relationship between the mesh and the applied texture and you may end up in some case (if texture is not vertically flipped) to not need to flip UV and being stuck in other cases where the mesh is using flipped and not flipped textures at the same time. |
|
dds flip seems fixed problem for me thanks! |
|
Nice, you are welcome :) |
Hello,
I did a while ago some changes regarding DXTn textures orientation. Apparently (from my tests) the extracted dds files are vertically flipped compared the the original image files used to build theasset bundle. So I added a few lines to flip vertically DXT1 and DXT5 data without decompressing it.
There is another little thing regarding file names sanitization, I allowed the "-" character as it is a common character in textures file names and replacing it by "_" was breaking textures references in extracted materials (I could fix missing references on my side but I think it is better the not alter too much original file names and as you see it is a very small change.
Bellow are the changes that should interest you.