• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Anand Baumunk

Quaternion-Rotation to Degree (Edge-jump)

10 posts in this topic

Well met!

 

This may seem like a rather simple thing, but I can't seem to figure it out or find an answer.

 

I'm trying to write an exporter for 3ds MAX, but it stores its rotations in quaternions while I need angles.

It does provide you with a function to convert them, which gives you bad angles at the edges.

 

A simple rotation around the Y axis jumps like this:

...
(quat -0.0222105 -0.706758 -0.0222105 0.706758)
(eulerAngles 90.0001 86.4 90.0001)

(quat 2.30405e-007 -0.707107 2.30405e-007 0.707107)
(eulerAngles 0 90 0)

(quat 0.0230636 -0.706731 0.0230636 0.706731)
(eulerAngles -90 86.2617 -90)
...

After some research I got told that that is the expected behavior. I tried to write my own conversion function and catch the bad angles, but failed. What exactly should I do to get the degrees?

 

I hope you can help me with this!

Thank you in advance and have a nice day!

Edited by gnomgrol
0

Share this post


Link to post
Share on other sites

What exactly should I do to get the degrees?


don't use degrees, and go learn how complex numbers work, then quaternions should make much more sense. and don't let the name scare you, the concepts behind complex numbers is actually very simple if you take the time to understand them. Edited by slicer4ever
0

Share this post


Link to post
Share on other sites

You only really need a fairly basic understanding of what a Quaternion is to be able to use them effectively, and for animations, it's totally worthwhile to gain that understanding.

0

Share this post


Link to post
Share on other sites

You only really need a fairly basic understanding of what a Quaternion is to be able to use them effectively, and for animations, it's totally worthwhile to gain that understanding.

 

You only really need a fairly basic understanding of what a Quaternion is to be able to use them effectively, and for animations, it's totally worthwhile to gain that understanding.

 

I had my animations implemented using Quaternions at first. 

I am currently rewriting my whole animation code based on a model suggested by L. Spiro, and so far it works out awesome. The last thing I need to get right are the rotations.

Like she mentioned in her post, Quaternions are really slow compared to matrices. And the track based animation system requires me to know every single part of the world matrix in order to gain speed.

(http://www.gamedev.net/topic/659147-optimising-bone-based-animation/#entry5169156)

Edited by gnomgrol
0

Share this post


Link to post
Share on other sites

You only really need a fairly basic understanding of what a Quaternion is to be able to use them effectively, and for animations, it's totally worthwhile to gain that understanding.

 

You only really need a fairly basic understanding of what a Quaternion is to be able to use them effectively, and for animations, it's totally worthwhile to gain that understanding.

 
I had my animations implemented using Quaternions at first. 
I am currently rewriting my whole animation code based on a model suggested by L. Spiro, and so far it works out awesome. The last thing I need to get right are the rotations.
Like she mentioned in her post, Quaternions are really slow compared to matrices. And the track based animation system requires me to know every single part of the world matrix in order to gain speed.
(http://www.gamedev.net/topic/659147-optimising-bone-based-animation/#entry5169156)


so why are you pulling euler angles, instead of rotation matrix's out of the exporter? i'd say keep quaternions as your animation format, and simply convert it the rotation matrix upon loading the animation.
0

Share this post


Link to post
Share on other sites

Because I need the single rotations for each axis in order for the track-based animation-system to work. (But there might be a way around that)

But if I'd convert it into a rotation-matrix, I'd still get the problem at the edges,  wouldn't I?

Edited by gnomgrol
0

Share this post


Link to post
Share on other sites

But if I'd convert it into a rotation-matrix, I'd still get the problem at the edges,  wouldn't I?

Why would you get "problems" at the "egdes" (what edges?) with rotation matrix?

Sounds like you really should re-investigate:
* what is a rotation matrix (how it works / what it represents mathematically)
* what is a quaternion (--||--)
* what is gimbal lock in regards of euler angles ( edit: http://en.wikipedia.org/wiki/Gimbal_lock )

Edited by tanzanite7
0

Share this post


Link to post
Share on other sites

 

But if I'd convert it into a rotation-matrix, I'd still get the problem at the edges,  wouldn't I?

Why would you get "problems" at the "egdes" (what edges?) with rotation matrix?

Sounds like you really should re-investigate:
* what is a rotation matrix (how it works / what it represents mathematically)
* what is a quaternion (--||--)
* what is gimbal lock in regards of euler angles ( edit: http://en.wikipedia.org/wiki/Gimbal_lock )

 

 

I stated what the problem is in my first post.

I understand complex numbers and quaternions as well as where the problem is coming from (Which is, as I stated, the singularity in the conversion function).

I don't really care about the one degree beeing lost due to the gimbal lock.

 

 


But if I'd convert it into a rotation-matrix, I'd still get the problem at the edges,  wouldn't I?

This was supposed to mean that the conversion problem that occurs when converting to degrees also would occur when converting to a matrix.

Edited by gnomgrol
0

Share this post


Link to post
Share on other sites

But if I'd convert it into a rotation-matrix, I'd still get the problem at the edges,  wouldn't I?

This was supposed to mean that the conversion problem that occurs when converting to degrees also would occur when converting to a matrix.

Uh?

There are no conversion problems when converting quaternion to matrix (*) - did you mean from matrix to Euler angles? Then yes, whatever is the perceived problem with quaternion->euler (I am not sure what the problem is - are the values wrong? Why do you care that the values jump around a bit?) would probably crop up again.

Euler angles are usually terrible to work with (expensive, capricious and shall i say - bloody useless. IMMHO, aka YMMV), i would repeat the advice to use a quaternion and/or matrix where appropriate instead.

*) Quaternion transforms fairly easily into a neat equivalent rotation-only matrix (Orthonormal basis. So, just a bunch of unit length orthogonal axis vectors).

Perhaps useful for reference:
http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm
http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/index.htm
http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/index.htm
1

Share this post


Link to post
Share on other sites

If you really know quaternions, as you say, although I'm not convinced, then this may help you:

http://wscg.zcu.cz/wscg2012/short/a29-full.pdf

 

Dual quaternions are excellent for this, especially if you're rolling your own.

Also, don't use matrices (where you don't have to) until the very last moment just before you shove it into GL

 

And... where does degrees come into this? Is it something that comes from 3ds max?

Edited by Kaptein
0

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  
Followers 0