Where Blender's Axes are Defined?

I’ve been hunting through the source trying to figure out where Blender defines its axes/orientation. Could someone please point me at the right file(s)?

This question is too vague to answer, it’s not clear what you mean exactly or want to achieve.

If you want to change Blender to have e.g. a different up axis, that’s not something that’s explicitly defined in a specific place. It’s an implicit assumption throughout the code.

Not sure what your goal is, but if you’re trying to make Blender Y-up or something, you’re better off doing what Modo does and just change the user’s perception of which axis is up and then handling the transformation on export to any other file format, rather than change the actual coordinate system (which would probably be a herculean feat at this point).

3 Likes

This thought has always appealed to me. Probably full of ugly weeds, but still interesting to think about.

1 Like

It honestly wouldn’t be that difficult, the hardest part would be making sure all of the exporters can correctly transform to a new coordinate system (which most already do). The rest is just polishing up the user experience- changing the viewport Gizmo, re-ordering any vec3 properties, etc. At the end of the day it boils down to demand… do people really care that much?

1 Like

I’m not (yet) convinced. I’ve got down uncountable roads that ended up dark and full of terrors that started with “not that difficult” and “just”. It would have to add minimal complexity yet work 100%. Even if it worked 98% we’d be inviting new bug reports from people complaining about something moving backward while running it “x-up”. LOL

1 Like

Oh for sure, a solution like this would basically be edge-case whack-a-mole, but the consequences wouldn’t be as dire as trying to unravel the underpinnings of the whole coordinate system. So I guess ‘not that difficult’ is entirely relative in this case :slight_smile:

Hey, I would probably contribute to a branch if someone else wanted to start such a project, just because it would be fun making it look as if it were Y-up. But I think I would quickly get bored of making it actually work that way. I don’t like having an unknown number of moles to whack.

Any idea of how Maya handles its axes? Maybe like Modo since we can chose between yup and zup in its preferences and the exported assets are always as asked in the export options.

If the goal is “Y up”, there aren’t that many places where the coordinates really matter. Walk/fly (which I never use, hence assume nobody else ever uses lol), default gravity vector. The big one is the view, which orbits based around poles at plus and minus world Z. And which, to my knowledge, can’t be changed without coding up a fork.

Change the view tracking poles, and if people want to change their numpad 7 hotkey to numpad 1, they can feel free. (Wouldn’t expect it would be worth it to try to change the whole coordinate system handedness, I doubt anybody is very invested in whether they’re moving in plus or minus X.)

Honestly, I don’t really know why people care… Up is up, left is left, etc. Shouldn’t really matter what color your arrows are, so long as when you export it’s pointing the right direction for the target coordinate system (which already happens). That said, clearly there is a lot of interest in this type of functionality- since the reasons seem to be somatic, I still think changing the users perception of what the axes are is a much better idea than messing with things like gravity, gimbal rotation order, etc.

you’d be surprised: https://blender.community/c/rightclickselect/3Tdbbc/

Its very Important to change y _up you want to know why because its world base all software in world make z up except blender take look befor 3d software the x is left and y is up after create 3d software they add z mean depth so we have change and make y up in official blender 2.81

First- welcome to devtalk. Second- low effort arguments like that aren’t going to get you very far here, so there’s not much point in trying unless you’re going to put forth a more compelling case that can be discussed rationally.

1 Like

Thanks for the welcome. Tell me how to make the topic big for discussion. I have an idea. What do you think you would do to post a vote about that topic on the Facebook page? Or I have big idea what about add this change in preferences like spacebar if I want to change y to up just by preferences ?

To be totally honest, something like that is best posted on Right Click Select. If you’re not familiar, it’s a site where people can pitch ideas/proposals to the blender community and they will get upvoted or downvoted based on user interest. Doing a quick search, I can see that there are already several proposals asking for Blender to be made Y-up, so the easiest thing to do would just be to upvote one of those and add your own comments on the subject to one of the existing threads for discussion Proposal: Industry standard axis orientation option (Y up axis, Z depth axis)

I apologize for my vagueness…

I’m working toward an understanding how to build a 3D viewport, a view into a 3D world, in other words. I’m assuming that the axes have to be defined somewhere so that everything else viewport related can reference them?

And please also excuse my tardiness in replying. It involves alligators, armpits, and a lack of wack-a-mole clubs.

I have to wonder if this same discussion happened on Maya forums before they added the capability to switch which axis is up. How many said it was impossible or impractical?

Also, I did some digging and found that the industries that use Z-up are (among others, I’m sure) mathematics and architecture. Those that use Y-up are film and animation. So with Blender working so hard to become the animator’s best friend, I still think adding a switch for the up axis is a good idea. How many new art-n-film-oriented users would flock to Blender if it has they had this choice?

When the user hits the ‘s’ key followed by the ‘z’ key, scaling is done only in the up-n-down direction. Somewhere there has to be a line or two of code that associates the ‘z’ direction with up and down, associates ‘y’ with upstage/downstage, and associates ‘x’ with stage left/stage right. Otherwise, the single-axis scale direction would be arbitrary… wouldn’t it?

And I’m asking here because you guys are far more familiar with the code than I could ever hope to be. Searching for what I’ve described above would be a nightmare. The single letter ‘z’ or ‘Z’ appears in nearly every single source file. Even trying to cut back on hits by including single or double quotes around it wouldn’t help much.

So, please point me in the right direction.

No, there are hundreds of lines throughout the source code that make this assumption. For someone who wants to implement a user-defined up axis, a big part of the work is exactly identifying all those places. There is no simple answer to this.

3 Likes

All right, can you give me some idea of the type of thing I’d be looking for? What does a line of code look like if it’s making the z-up assumption?

 z = ???

or

direction = ???

Even knowing the type of comment to search for would be helpful.

Or, failing that, how about we start with these questions:

  1. You know the tri-color gizmo in the upper-right corner of the ViewPort… Where in the code are the ‘X’, ‘Y’, and ‘Z’ defined for this?
  2. Is that thing actually called a ‘gizmo’ because when I search for it, I get GIZMO which seems to be the gizmo that appears attached to an object when scaling, translating, or rotating.
  3. Where is the code for scaling an object?