Sign in to follow this  
Kurt-olsson

Blender to DirectX Export problem

Recommended Posts

Kurt-olsson    254

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?

Edited by KurtO

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this