I'm having trouble getting the texture coordinates of the cmo to match how the mesh was unwrapped in blender. I am using the directxmesh to convert the obj to a cmo and the directxtk to load the cmo.
Relevant parts of code are as follows:
std::unique_ptr<DirectX::CommonStates> m_states; std::unique_ptr<DirectX::IEffectFactory> m_fxFactory; std::unique_ptr<DirectX::Model> m_model; ... m_states.reset(new CommonStates(d3d11DeviceInterface.Get())); m_fxFactory.reset(new EffectFactory(d3d11DeviceInterface.Get())); m_model = Model::CreateFromCMO(d3d11DeviceInterface.Get(), L"unit.cmo", *m_fxFactory); ... m_model->Draw(d3d11DeviceContextInterface.Get(), *m_states, local, view, proj);
The model and uv map in blender look like this:
Using the following directxmesh command: meshconvert unit.obj -cmo -y -nodds
the model looks like this in the program:
I thought this would be a simple matter of flipping the texture coordinates by adding the -fliptc switch to directxmesh meshconvert unit.obj -cmo -y -nodds -fliptc
But this changes the winding order resulting in backface culling on the wrong sides. Subsequently, I tried changing the culling face to clockwise with the -cw switch meshconvert unit.obj -cmo -y -nodds -fliptc -cw
Now the backface culling was happening on the correct faces but the texture coordinates were still wrong.
I'm rather lost as to what I have done wrong.
Edit: I seem to have figured out what is going on. The image seems to be flipped around the V axis. If I manually flip the image the coordinates match up to what is shown in blender. It's a shame I can't seem to find an option in blender to flip the UV coords along the V axis.