Jump to content
  • Advertisement
Sign in to follow this  
Guthur

Collada to D3D uv map issue

This topic is 3633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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



Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!