Jump to content
  • Advertisement
terrysworkstations

Textures in Directx 11

This topic is 408 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

Im in DirectX 11 using the D3DX11CreateShaderResourceViewFromFile for textures. I have to rotate texture file 180 and flip horizontal in Mspaint for the texture to fit on the object.  SO when I have a .obj object with text, it will be backwards like in the image. I have to rotate and flip with all objects that have textures.Does anyone know how to fix the issue?

Untitled.png

Edited by terrysworkstations

Share this post


Link to post
Share on other sites
Advertisement

I use the regular image now(not rotated or flipped), and negated the x. Did not work though. I negated the y uv and almost works accept as seen, the text is backwards.

 

Untitled.png

Edited by terrysworkstations

Share this post


Link to post
Share on other sites

from, http://www.rastertek.com/dx11tut08.html,

Quote

Right hand to Left hand conversion

By default Maya 2011 is a right handed coordinate system and exports the .obj file data in right hand coordinates. To convert that data into a left handed system which DirectX 11 is by default you have to do the following:

1. Invert the Z coordinate vertices. In the code you will see it do this: vertices[vertexIndex].z = vertices[vertexIndex].z * -1.0f;

2. Invert the TV texture coordinate. In the code you will see it do this: texcoords[texcoordIndex].y = 1.0f - texcoords[texcoordIndex].y;

3. Invert the NZ normal vertex. In the code you will see it do this: normals[normalIndex].z = normals[normalIndex].z * -1.0f;

4. Convert the drawing order from counter clockwise to clockwise. In the code I simply read in the indexes in reverse order instead of re-organizing it after the fact:

fin >> faces[faceIndex].vIndex3 >> input2 >> faces[faceIndex].tIndex3 >> input2 >> faces[faceIndex].nIndex3; fin >> faces[faceIndex].vIndex2 >> input2 >> faces[faceIndex].tIndex2 >> input2 >> faces[faceIndex].nIndex2; fin >> faces[faceIndex].vIndex1 >> input2 >> faces[faceIndex].tIndex1 >> input2 >> faces[faceIndex].nIndex1;

With those four steps complete the model data will be ready for DirectX 11 to render correctly.

 

Share this post


Link to post
Share on other sites

  • 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!