PDA

View Full Version : Transformation from current or original



jos_t_tarigan
12-09-2008, 12:46 PM
Hi,

I notice from most program I got, they always keep the original position, sum up the transformation, and then transform the position eg: vertex A at 0, speed 3/second, 1st second calculation is 0 + 3*1, 2nd second calculation is 0 + 3*2.... i-th calculation is 0+ 3*i.

I try to change the structure so it keep the current position instead of the original eg: 1st second calculation is 0 + 3*1, 2nd second calculation is 3 + 3.... i-th calculation is 3*(i-1) + 3. And since 3*(i-1) is previous position(calculated), i think it will be better in performance since we dont have to do another multiplication.

But i cant find any sample program that use this solution. why is that? is there any problem with this one?

thanks in advance
sorry if this is a stupid question ;) im new with openGL

ZbuffeR
12-09-2008, 01:59 PM
i think it will be better in performance since we dont have to do another multiplication.
Even if it is the case, the gain will be pretty small unless you apply it a million times per second.

The reason to restart from origin is to avoid cumulative errors. A few bits off here and here and after 10 minutes (10*60*60fps = 36000 frames) the tiny errors can become significant. This is mostly notable for rotations, translation may keep ok a long time.
Another advantage is to easily allow features like pause, slomo, back in time, jump to given time.

_NK47
12-10-2008, 03:45 AM
like ZbuffeR said, rounding errors are guaranteed! see matrix creep (http://www.gamedev.net/community/forums/topic.asp?topic_id=495945&whichpage=1&#3234589).