Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Blender export problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 KurtO   Members   -  Reputation: 230

Like
0Likes
Like

Posted 18 November 2012 - 02:44 AM

Okay.

DirectX and Blender don´t share the same coordinate system.
I used to fix this by importing my models like this.
Also the UV system isnt the same. but i used to fix my models like this:

[source lang="cpp"]for(int i=0;i<m_vertexCount;i++) { model_vertices[i].Color = color; model_vertices[i].Normal.x = Level1Vertices[i].Normal.x; model_vertices[i].Normal.y = Level1Vertices[i].Normal.y; model_vertices[i].Normal.z = Level1Vertices[i].Normal.z; model_vertices[i].U = Level1Vertices[i].U; model_vertices[i].V = Level1Vertices[i].V;//THIS IS WHERE I DO MY FIX model_vertices[i].X = position.x + Level1Vertices[i].X; model_vertices[i].Y = position.y + Level1Vertices[i].Z; model_vertices[i].Z = position.z + -Level1Vertices[i].Y; }[/source]

Suddenly now my models are mirrored left to right. *sight*...
It feels like the export from blender is Random, It gets right 1 time of 10. Pretty frustrating not to be able to rely on the export.
This trouble takes to much time from my development.


Any ideas?

Edited by KurtO, 18 November 2012 - 02:47 AM.


Sponsor:

#2 MrDaaark   Members   -  Reputation: 3555

Like
0Likes
Like

Posted 18 November 2012 - 07:11 AM

There is an XNA option for the .x export. Take a look at the corresponding python script to see how they are handling everything.

In Blender:

X is length
Y is depth
Z is height

#3 KurtO   Members   -  Reputation: 230

Like
0Likes
Like

Posted 19 November 2012 - 06:32 AM

I still dont understand.
The modls are correct just they are mirrored.

I use Ctrl-N to make the normal look good. And if i "Flip Direction".
The model is correct in my game but the normals are upside down.

Why cant blender just implement a way to change coordsystem to right-handed... =(

#4 Ashaman73   Crossbones+   -  Reputation: 7793

Like
1Likes
Like

Posted 22 November 2012 - 03:14 AM

Why cant blender just implement a way to change coordsystem to right-handed... =(

Because it is not the task of the modelling tool but the exporter.

model_vertices[i].Normal.x = Level1Vertices[i].Normal.x;
model_vertices[i].Normal.y = Level1Vertices[i].Normal.y;
model_vertices[i].Normal.z = Level1Vertices[i].Normal.z;

You need to flip the normals too, much like the position, experiment with this:

model_vertices[i].Normal.x = Level1Vertices[i].Normal.x;
model_vertices[i].Normal.y = Level1Vertices[i].Normal.z;
model_vertices[i].Normal.z = -Level1Vertices[i].Normal.y;



#5 KurtO   Members   -  Reputation: 230

Like
0Likes
Like

Posted 23 November 2012 - 07:19 AM

Late answer but, is the normal connected to the draw pipeline?

How can the normals affect the rendering? isnt my triangles drawned just by x,y,z positions?

I am about to give up my development as Blender exporting just is to buggy right now. It seems that my walls are rendered with normals all over the place. I will definetly try to change the normal as you suggested.

thank you for your answer.

Edited by KurtO, 23 November 2012 - 07:21 AM.


#6 MrDaaark   Members   -  Reputation: 3555

Like
0Likes
Like

Posted 23 November 2012 - 10:53 AM

A normal is the direction that the vertex is pointing. It's very important for knowing if a triangle is even facing the camera or not, and important for culling. It's also important for lighting so the light knows if the triangle is even facing it.

You have to make sure that your normal is facing the correct direction in Blender. Press the N key in the 3D viewport while in edit mode and check off the option that lets you see what direction the normal is pointing. Blender will do this by drawing a line out from the polygons. Make sure it;s in the right direction. If not, you can flip it.

You can also change the rendering mode (button at the bottom of the viewport window with the sphere) to textured. You will easily be able to see which faces are pointing the wrong way, because they will be culled.

#7 KurtO   Members   -  Reputation: 230

Like
0Likes
Like

Posted 23 November 2012 - 12:22 PM

What is the right direction? when i flip all the normal is pointing inside and it don´t feel correct. The Texture mode was great, now i see my misstakes before i import model and saves me time.

But my model is rendered mirrored. If i use Ctrl-N and do this for both normal and vertecies it shows correct just that it is mirrored.


[source lang="cpp"]for(int i=0;i<m_vertexCount;i++) { model_vertices[i].Color = color; model_vertices[i].Normal.x = Level1Vertices[i].Normal.x; model_vertices[i].Normal.y = Level1Vertices[i].Normal.z; model_vertices[i].Normal.z = -Level1Vertices[i].Normal.y; model_vertices[i].U = Level1Vertices[i].U; model_vertices[i].V = Level1Vertices[i].V; model_vertices[i].X = position.x + Level1Vertices[i].X; model_vertices[i].Y = position.y + Level1Vertices[i].Z; model_vertices[i].Z = position.z + -Level1Vertices[i].Y; }[/source]

i sometimes solve the mirror thing by flip the normals but then it don´t get rendered correctly with my walls, the normals are not right...

How can i upload images to show you my model with normals?

Edited by KurtO, 23 November 2012 - 12:23 PM.


#8 MrDaaark   Members   -  Reputation: 3555

Like
0Likes
Like

Posted 23 November 2012 - 03:45 PM

The correct direction for normals to face is up to you, and depends on what the models are. The normal should face the camera.

If you make a big box and you want it to represent the inside of a room, then you want to have the normals facing inside.
If you make a box and you want it to be a crate or something, the normals need to face on the outside.

If you go inside the model, the normals need to point inside. If you see the model from the outside, they point outside.

Press Print Screen, past your image in an image editor and save a jpg, then upload your image to image shack, dropbox, or photobucket, or somewhere similar. Then post the link.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS