POV-Ray : Newsgroups : povray.off-topic : Ok, someone explain this in English... (exploring quaternions) : Ok, someone explain this in English... (exploring quaternions) Server Time
7 Sep 2024 09:22:37 EDT (-0400)
  Ok, someone explain this in English... (exploring quaternions)  
From: Patrick Elliott
Date: 27 Jun 2008 00:33:27
Message: <MPG.22ce1ad82064e98e98a16d@news.povray.org>
http://wiki.secondlife.com/wiki/Quaternion

Seriously. SL uses these dang things for their rotation matrix, 
apparently due to how the GPU uses them too, also apparently do to it 
being "easier" somehow for the 3D software to work with them. Ok, fine 
so far. But, SL is **notorious** for the fact that lots of scripts doing 
things causes so much lag that just having 10 people in a sim can 
sometimes grind the damn thing to a halt at this point (often do to the 
number of scripts on the avatars). Anything that can "reduce" the number 
of function calls needed in a script to "do" something would help this. 
So, what does that mean in a practical sense.. Lets take something I 
tried:

Make a sphere, hollow it, cut into it, all so you get something that 
looks like you cut an orange in sections, removed the fruit and kept the 
wedge of rind. Add some textures to it. Get permissions, etc. to find 
out where the camera is, read its rotation, rotate your new object to 
"match" that rotation. Watch as the object which was right side up, 
facing forward is now a) 90 degrees out of alignment (i.e.) sideways, b) 
rotated so its pointing "up", and c) reorients the wrong @#$#@$#@ 
fracking direction when ever you change the camera angle...

Now, obviously, there are a few problems here:

1. The existing rotation needs to be preserved.
2. The "correct" rotation has to be applied to the object so it "does" 
face the cameras direction of view properly.
3. What happens to the object has to be either 100% accurate to the 
direction the camera is looking, *or* limits need to be applied, so it 
only rotates as much as 45 degrees up/down, never does so in terms of 
where its top and bottom are (i.e., if its "forward" direction is Y, it 
should **never** rotate on the Y axis at all.), and it should be able to 
rotate 360 degrees the other way.

Problem is, how the frack do you transpose the vectors for X,Y,Z to 
something "valid" for an object using this system, without converting it 
to euler values?

Basically, in the above example, if I remember right, the cutting can 
only happen along the X axis, so the "face" becomes "Z", Z is the 
objects "X", this means that, to map the camera to the object, camera Z 
= object X, camera Y = object Y still, but camera X = object Z. (I 
think, I am trying to visualize this without the actual object/wrong 
result in front of me). With Euler coordinates, this is as simple as 
switching the values. With Quaternions.. well, there may be a dozen ways 
to *rotate* the same object into a particular orientation, so there is 
not "direct" way to just pull the X,Y,Z and switch it to Z,Y,X, at least 
that I can see.

So, I guess, my question is, am I right, and am I *forced* to use the 
conversion functions to get the Euler values, switch things around 
there, then convert back "again" to the system the rotation commands 
use?

I tried asking something similar on the SL forums, but... basically I 
got ignored... Which really irks me, since you would think people 
lagging so bad they can't walk 5 meters in a minute, on really bad sims, 
would *want* to find ways to simplify scripts and reduce the crap the 
servers are running... lol

-- 
void main () {

    if version = "Vista" {
      call slow_by_half();
      call DRM_everything();
    }
    call functional_code();
  }
  else
    call crash_windows();
}

<A HREF='http://www.daz3d.com/index.php?refid=16130551'>Get 3D Models,
 
3D Content, and 3D Software at DAZ3D!</A>


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.