[Solved] SDK model importing - UVs are a mess

So, I’ve spent and entire afternoon on this and still can’t get it to work properly.

I have a 3D model of a TIE fighter which used to have multiple UV maps. I baked the materials into one final UV map and deleted all the others. Then I switched to blender internal (since that tends to work better with importing) and set up all the baked textures.
Then I fired up the sdk and tried to import it. Seemed to look okay. However, after I tried to create a material from scratch to add all the other maps, suddenly the UVs went all over the place. Same result when I tried to make it a PBR material. I tried several things, but the only material that seemed to work properly was the exported one and even then only the maps set by the importer (specular was wrong for example).
Not even the glorified xbuf managed to produce the proper UVs, neither did directly loading the .blend from code and setting the material. Now I’m all out of ideas.

Model with the material generated by importer:

Model with any other material (PBR in this case):

Whenever you change the textures, did you check to see if the original textures that are correct have any type of extra formatting in the material file?

Like for example, when I exported a material from blender, it automatically added this line in front of my texture reference in the material file:

    BaseColorMap : WrapRepeat_S WrapRepeat_T MinTrilinear "Models/Architecture_Ancient/ancientCoffin/albedoMap.png"

If I use the texture navigator in the material editor to assign a new texture, then the “WrapRepeat_S WrapRepeat_T MinTrilinear” is sometimes lost and I have the same issue you are describing, until I add that line of text in front of every texture reference in the material file.

1 Like

Also, I assume you’ve tested to make sure the texture did/didn’t get y-flipped somewhere.

That’s usually the first thing I check when I get to these “Holy crap!! What happened to my texture?!?!” situations.


I’ll try the suggestions tomorrow. I also thought about y flipping immediately after shutting down the PC, but I don’t know where could that have come from.

Seems like UVs got Y flipped somewhere in the process. After enabling Y flipping, it looks as it should. Any ideas why that could have happened? It looks as it should in blender.

It’s not the UVs that got flipped, it’s the texture. Some paths default to flipping some don’t. There is a boolean on the texture key that can control this.

It’s just common enough that it’s the first thing I check when I see this… but I don’t remember exactly which steps cause it.

Edit: but for example, a common case is exporting/importing where the texture is fine… but then changing the texture in code is flipped because the flip flag was set differently when the texture was loaded.