[Fluxus] matrix blending

Dave Griffiths dave at pawfal.org
Fri Dec 12 03:30:51 PST 2008


> On Thu, Dec 11, 2008 at 9:20 PM, Dave Griffiths <dave at pawfal.org> wrote:
>>
>>> hi
>>>
>>> i'm trying to implement a camera that flies around on a sort of arm
>>> made of two locators - one is the origin of the arm and center of
>>> rotation, the other holds the camera and can be extended. I had to
>>> change the camera attachment logic, so that camera follows the object
>>> in world coordinates:
>>>
>>> http://git.savannah.gnu.org/gitweb/?p=fluxus.git;a=commitdiff;h=02898c88b024aa4c3624c4d5fe82f86b47fe98f5
>>>
>>> (that's my qt branch, but I guess this patch would apply to master as
>>> well).
>>
>> Thanks for that... Looks like (due to Linus I guess) patches are well
>> supported in git - can we merge across branches more officially? Does it
>> help that the qt stuff will just be in fluxus/src?
>
> there is "cherry pick" operation for picking only safe commits, it
> will attempt to fit the commit diff onto another branch. The right way
> to do was of course to do safe stuff on master, but I'm in a hurry for
> the gig tomorrow evening.

Ahah - right, I see :)

>>> I use the attached script to test this constriuction (joystick
>>> controlled) and I noticed, that matrix blending used with camera-lag
>>> now causes some unpleasant squashing. without camera-lag the box looks
>>> OK. is there anything I could do to fix the blended matrix?
>>
>> I've grown quite fond of the squashing, but it's happening because it's
>> doing the blend completely wrong. The proper way to do it is to
>> decompose
>> the matrix into transform, scale and rotation - lerp the transform and
>> scale, and do the rotation as a quaternion slerp.
>>
>> At the moment the scale and rotation are mixed up in the matrix - you
>> shouldn't really treat matrices like this - the exception is skinning,
>> where you create a weighted average of multiple matrices - but the
>> rotation isn't important, as it's mainly vertex translations.
>
> in the mean time I started to extend the quaternion class, so I can do
> the right thing with matrix interpolation (I want to do rotation slerp
> with quaternions).

It's probably easier now to lock the camera on to something you do the
blending on manually in scheme - although I guess we should have some
functions to extract rotation/scale/translation from matrices...

cheers,

dave




More information about the Fluxus mailing list