Why is data in Blender stored the way it is?

The interface, modeling, 3d editing tools, import/export, feature requests, etc

Moderators: jesterKing, stiv

Post Reply
bloodangel
Posts: 0
Joined: Tue Dec 30, 2008 1:00 am

Why is data in Blender stored the way it is?

Post by bloodangel »

In the last couple of weeks I've begun to write and make use of my own Python export script. The thing that has shocked me the most is the way that data is stored by Blender. Blender uses OpenGL but does not seem to conform much to OpenGL defaults. OpenGL is right-handed while Blender is left-handed. By default, OpenGL recognizes faces as front faces when the vertices have been fed in counter clock-wise order while Blender recognizes the exact opposite. Blender even goes so far as having backwards U coordinates.

I have come to all of my conclusions based on the modifications I have had to make to my export script to get my meshes to look exactly the same way in my OpenGL applications as they do in Blender. Either I am going to have to keep making peculiar modifications to my export script or I am going to have to adopt the way Blender stores it's data, which would make me an oddity among innumerable coders who do not expect front faces to be in clock-wise order.

I have a hard time believing that I am the only one that is uneasy about these oddities. I cut & pasted my code into the post, but it looks horrible on this forum, so I took it out. I would just appreciate knowing how the Blender developers or other Blender users feel about this.

joeri
Posts: 96
Joined: Fri Jan 10, 2003 6:41 pm
Contact:

Post by joeri »

Not sure if you want to know why it is this way.
I think it's this way because blender was created on irisGL.
Or maybe it's even this way because Traces rendered on Amiga...

Not much help to you, just some guessed background info as an answer to your topics question.

jesterKing
Site Admin
Posts: 207
Joined: Fri Oct 18, 2002 12:48 pm
Location: Finland

Post by jesterKing »

Blender is 100% compliant with OpenGL. The up vector is Y for the camera (and looks down its negative axis, IIRC).

Thing is that Blender has for world floor the XY plane, which has been a distinct design decision: creation of scenes is done from World POV, not camera.

You can test this by clearing camera rotation, you'll be looking down (negative Z) on the floor plane (XY).

When you export, just make sure you use the proper transformations bearing above in mind, and you should be fine.

/Nathan

bloodangel
Posts: 0
Joined: Tue Dec 30, 2008 1:00 am

Post by bloodangel »

jesterKing wrote:Blender is 100% compliant with OpenGL. The up vector is Y for the camera (and looks down its negative axis, IIRC).

Thing is that Blender has for world floor the XY plane, which has been a distinct design decision: creation of scenes is done from World POV, not camera.

You can test this by clearing camera rotation, you'll be looking down (negative Z) on the floor plane (XY).

When you export, just make sure you use the proper transformations bearing above in mind, and you should be fine.

/Nathan
Wow, I never thought about it that way. What you said may completely change my perspective on this. I've always had this wierd idea in my head that NumPad 7 was the top view. That being said, is it possible to make custom keybinds for different camera angles? The way I see it is that if Z is the up axis, then Numpad 7 is top view, Numpad 1 is front view and Numpad 3 is side view. When I think of that differently, like 7 being front and 1 being top, then 3 turns out to be some other kind of view that I can't make sense of. Considerign how the default scene is set up with the light and camer, looking down on the XY plane could easily be considered top view when thinking the way I have been. Just knowing about that makes it not nearly as confusing. Making my export script has forced me to learn new aspects of Blender the hard way. I think it'll pay off in the long run. I first started toying with Blender back when it was first created by NaN, before it was free. Now, anybody with even a tiny understanding of Python can make use of it.

zingbat
Posts: 0
Joined: Thu Apr 29, 2004 12:36 am

Post by zingbat »

Blender also follows the usual color convention for major axis. Red, green and blue is X, Y, Z.

Besides if you look at the small axis on the lower left corner the names of the axis are also visible. This should be an easy way to see what view you are looking at.

Post Reply