Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8736485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:18:43+00:00 2026-06-13T10:18:43+00:00

Background: I am currently implementing a skeletal animation shader in GLSL, and to save

  • 0

Background:

I am currently implementing a skeletal animation shader in GLSL, and to save space and complexity I am using Quaternions for the bone rotations, using weighted quaternion multiplication (of each bone) to accumulate a “final rotation” for each vertex.

Something like: (pseudo-code, just assume the quaternion math works as expected)

  float weights[5];
  int bones[5];
  vec4 position;

  uniform quaternion allBoneRotations[100];
  uniform vec3 allBonePositions[100];

  main(){
  quaternion finalQuaternion;
  for(i=0;i<5;i++){finalQuaternion *= allBoneRotations[bones[i]]*weights[i];}
  gl_position = position.rotateByQuaternion(finalQuaternion);
  }

The real code is complicated, sloppy, and working as expected, but this should give the general idea, since this is mostly a math question anyway, the code isn’t of much consequence, it’s just provided for clarity.

Problem:

I was in the process of adding “pivot points”/”joint locations” to each bone (negative translate, rotate by “final quaternion”, translate back) when I realized that the “final quaternion” will not have taken the different pivot points into account when combining the quaternions themselves. In this case each bone rotation will have been treated as if it was around point (0,0,0).

Given that quaternions represent only a rotation, it seems I’ll either need to “add” a position to the quaternions (if possible), or simply convert all of the quaternions into matrices, then do matrix multiplication to combine the series of translations and rotations. I am really hoping the latter is not necessary, since it seems like it would be really inefficient, comparatively.

I’ve searched through mathoverflow, math.stackexchange, and whatever else Google provided and read the following resources so far in hopes of figuring out an answer myself:

  • http://shankel.best.vwh.net/QuatRot.html

  • http://mathworld.wolfram.com/Quaternion.html

  • plus various other small discussions found through Googling (I can only post 2 links)

The consensus is that Quaternions do not encode “translation” or “position” in any sense, and don’t seem to provide an intuitive way to simulate it, so pure quaternion math seems unlikely to be a viable solution.

However it might be nice to have a definitive answer to this here. Does anyone know any way to “fake” a position component of a quaternion, that in some way that would keep the quaternion math efficiency, or some other method to “accumulate” rotations around different origin points that is more efficient than just computing the matrix of the quaternions, and doing matrix translation and rotation multiplications for each and every quaternion? Or perhaps some mathematical assurance that differing pivot points don’t actually make any difference, and can, in fact be applied later (but I doubt it).

Or is using quaternions in this situation just a bad idea on the face of it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:18:44+00:00Added an answer on June 13, 2026 at 10:18 am

    Indeed, there is no such thing as a position component of a quaternion, so you’ll need to track it separately. Suppose individual transformations end up being like

    x' = R(q)*(x-pivot)+pivot = R(q)*x + (pivot-R(q)*pivot) = R(q)*x+p,
    

    where q is your quaternion, R(q) is the rotation matrix built from it, and p=pivot-R(q)*pivot is the position/translation component. If you want to combine two such transformations, you can do it without going full-matrix multiplication:

    x'' = R(q2)*x'+p2 = R(q2)*R(q)*x + (R(q2)*p+p2) = R(q2*q)*x + (R(q2)*p+p2).
    

    This way the combined quaternion will be q2*q, and the combined position, R(q2)*p+p2. Note that you can even apply quaternions to vectors (R(q2)*p and so on) without explicitly building rotation matrices, if you want to absolutely avoid them.

    That said, there is also a notion of “dual quaternions” which, in fact, do contain a translation component, and are presumably better for representing screw motions. Check them out on Wiki, and here (the last link also points to a paper).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background I am currently implementing an application with Google Drive/Docs. Using the latest .NET
I'm running some background threads in the GUI. Currently I'm implementing a personal Thread
Background Currently in a project of mine I am using jQuery autocomplete for a
I am currently using jquery slideonlyone function. I am having problems implementing an expanding/collapsing
I am currently implementing a blog-like site using Ruby on Rails. Each Post has
I am currently implementing a view in Android that involves using a larger than
Background I currently have an array like this: [1,1,2,3,4,5,5,5,6,7,8,8,8,8,9,10] I have been using a
Background Currently, I am working on a Rails application. I have different products that
Background : I'm currently, for my University, creating some simple apps showcasing the possible
Background : I'm currently writing a greasemonkey script that embeds/modifies a specific page's html.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.