UV/TexCoord transformations required?

I have been writing a collada importer, and things are going well, but I’ve got a problem with my UV’s… in some cases they’re rotated 90 degree’s, and in some cases they’re upside down (all in the same DAE file)

In some cases the UV’s are 90o degrees to the right, and in some cases they’re upside down.
t = 1 - s
s = 1 - t
fixes some cases (and breaks others)

and
t = 1 - t
s = 1 - s
fixes the upside down ones (and again, the 90o degree ones are still broken)

I’m assuming the UV’s exported from max are right, but for the life of me I cannot find a program to which will view this 60mb DAE file to verify the export is correct.

I’ve searched extensively, learnt there is no texture matrix transformation support in the collada spec, and no hints that I need to do anything with the UVs…

AFAIK I’m reading my UV’s from the input/source/accessor correctly (it’s a generic function and seems to be correct for normals and positions)

Many of the nodes in the collada are rotated 90 degrees, but it seems silly if I need to apply node transformations to the UV mapping… but is that the case?

I’ve checked through the sources and they all reference the texcoord source params as S,T (never say, T,S which I thought might be the case)…

Can anyone suggest what might be wrong? or even point me to a tool that will import the DAE AND let me see the texture mapping?

I’m aware TEXCOORD’s and UV’s arent the same thing, but I haven’t found any documentation specifying how I might have to transform the TexCoords into UV’s…

Another note, I’m rendering through the direct3d FF pipeline (dx9) in case I’ve neglected to do something there…

Any help appreciated!

With so much variance in the exported data, I would suggest that you double check that assumption.

Not sure what you mean here but 3ds Max is normally a Z_UP system, while COLLADA defaults to Y_UP. Check that the document’s <COLLADA><asset><unit> element, if any, is being handled correctly.

The order of those param names doesn’t change the ordering of the data as defined by the semantic regardless.

“see the texture mapping”? … try FX Composer or Rendermonkey

Could be something there because 3ds Max, D3D, and COLLADA all use different coordinate systems.

3ds Max is right-handed with Z_UP.
D3D is left-handed with Y_UP.
COLLADA is right-handed with Y_UP.

Also texture coordinates between D3D (top-left origin) and COLLADA (bottom-left origin) map differently.

Did you ever get a resolution for this? I’m currently in the same boat, where the Texture Coordinates are completely messed in an importer app I’m creating.

Not yet I’m afraid, I’m busy working on something else, but hopefully getting back onto this in the next month or so…

Btw what tool did you use to export your problem test file?

Mine was a sample DAE file from a tutorial I found on the net. I believe it was done in lightwave, but I’m not 100% sure.

also experiencing a similar problem, where meshes are being exported out from Maya and their UVs are showing up rotated -90 degrees in Y.

anyone have any thoughts?

3DS Max

Maya and Max use different coordinate systems. Check your settings in Maya for right or left -handed and the up-axis before exporting. If you’re not requesting for a conversion the exported document should be the coordinate system as in Maya; and you should use that as a baseline to isolate what piece of software is breaking the texture coordinate orientation as part of the coordinate system conversion.

FBX also has some bugs reported against it regarding up-axis conversion.