Advertisement

Blender to DirectX Export problem

Started by February 13, 2013 08:52 AM
0 comments, last by Kurt-olsson 12 years ago

I know blender is using the right-handed and DirectX is using Left handed coordinate system.

Of course this is creating some problem with my export.

But my problem isn´t logical.

I have made the simplest model in Blender and then export vertex-list x,y,z and normal x,y,z and u,v for texture mappings.

If i import my model with x = x, y = y, z = z from blender to DirectX in both vertex and normals my model is drawned like this:

It is 90 degrees tilted (this is understandable and logic), BUT also the model is "mirrored" in X-axis.

I can fix the Title by changing x with z when importing. but my normals is always wrong then and i cant fix it.

my code looks like this.

model = my directX model that has vertex Vector3 and normaol Vector3 and u,v float for mapping.

import = values from my export script from blender.

//When i just import the model i use this:

model.vertex.x = import.vertex.x;

model.vertex.y = import.vertex.y;

model.vertex.z = import.vertex.z;

model.texture.u = 1-import.texture.u;

model.texture.v = import.texture.v;

model.normal.x = import.normal.x;

model.normal.y = import.normal.y;

model.normal.z = import.normal.z;

this is just 1->1 import and gives me titled result with mirrored x-axis.

I have tried this, but it wont work, the model is right but my normals and uv-mapping is wrong...

model.vertex.x = -import.vertex.x;

model.vertex.y = import.vertex.z;

model.vertex.z = -import.vertex.y;

model.texture.u = 1-import.texture.u;

model.texture.v = import.texture.v;

//No mather what i set my normals to it is still wrong normals...

model.normal.x = -import.normal.x;

model.normal.y = import.normal.z;

model.normal.z = i-mport.normal.y;

How should my import routine look like for my vertex and normals plus uv?

Solved it, had culling set to Back, that made the X-axis texture the wrong way. When i set it to NONE it worked!

This topic is closed to new replies.

Advertisement