Collada to D3D uv map issue

Started by
4 comments, last by Guthur 15 years, 5 months ago
This has me a little stumped, hoping the gamedev community might be able to shed a little light... I'm trying to put together a small 3D programming demo and needless to say i needed some sort of file format for textured geometry. I decided on Collada; coded a simple xml loader and integrated a simple form of mesh demo to my 3D app. Initially when I directly mapped the collada S and T values to the u and v vertex values in my code the texturing was completely wrong. After a little reading i suspected it might be something to do with coordinate systems (right -> left), I found that inverting the sign of T (-T) seemed to fix it...almost. (See Image Below) The black texture on the side of the duck, jagged line, is not suppose to be there it should be yellow. The only black on the input texture is the eye :S, there also seems to be some mistake near the tail. If anyone has any suggestions it would be much appreciated. Thanks, Michael Collada D3D10 uv map issue
Innovation not reiterationIf at any point I look as if I know what I'm doing don't worry it was probably an accident.
Advertisement
we must see code
hhh ya i was thinking that but which part of the pipeline is the question, plus some of its a pretty nasty prototype hack stuff, might be the problem :p

I'm about a 100% sure the data is good, as i've loaded it into blender and seen no issues.

I was also thinking that if it was my xml loader or mesh compositor then none of it would be right because its all done in loops, but the head seems ok. Thats the baffling thing, its the almost there'ness of it :S

basic flow (trying to avoid dumping masses of my horrid code :| )

Load XML
- XML Tree created

Create Mesh
- Vertex Buffer (BasicVertex3D[]) filled from COLLADA mesh.source[0]
- Normals read from COLLADA mesh.source[1]
- Tex Coordinate (S,T) read from COLLADA mesh.source[2]
- Triangle List read and normals and tex coordinates assign to appropriate vertex; indice list built. (the normals appear right from this stage as the lighting shows)

Render Mesh



Innovation not reiterationIf at any point I look as if I know what I'm doing don't worry it was probably an accident.
One thing i forgot to mention...

I was playing around with AddressU/V sampler states in the shader and noticed that when i set it to BORDER everything is black. I assume because its outside the border after me inverting the V coordinate.

But if thats the case how comes its the closest it comes to working?

Also i converted the texture from .TGA to .DDS, i wouldn't think that would be a problem?!?!?

Thanks,
Michael
Innovation not reiterationIf at any point I look as if I know what I'm doing don't worry it was probably an accident.
In OpenGL world, texture coordinate t(v) goes bottom-up.
In D3D world, texture coordinate v goes top-down.

I think that may be the issue.
qingrui - Ya I was thinking something like that might have been the initial problem.

Inverting the sign or subtracting from 1.0f seems to fix that, well produce the result above at least, as oppose to a texture mapping that is completely wrong when the coordinates are passed pure.

I need to construct a simpler collada test file, textured cube maybe, I got the duck from the COLLADA model repository (Owl). Just need to search for some blender texturing tutorials :|, much rather be coding.
Innovation not reiterationIf at any point I look as if I know what I'm doing don't worry it was probably an accident.

This topic is closed to new replies.

Advertisement