4.07.2012

Matrices the second

I'm writing quite a lot about this stuff (in fact, nobody's probably reading it anymore due to that) but here's something new I found interesting to mention. I've analysed OpenGL's own matrix use, research a bit about the few things I couldn't remember from my own math lectures and thought more than once about how to efficiently apply any of the matrices. See, just creating a static matrix isn't possible - they have unique parameters each time. Always creating a local array on the stack is also stupid because it wastes a lot of memory. Specialized multiplications with left-out factors etc are not readable enough (imho) and fail to be of use if the matrix to multiply is already so full with previous multiplications that you can't use a all-same code for all multiplications (well, the latter one's actually not that valid after writing it). Anyway, the essence is that you need to store this stuff somewhere. Those matrices can be used on and on again if the parameters don't change. Therefore, it's a better idea to generate a matrix one time and then apply it for all following steps. My current approaching is just like that and, combined with a direct multiplication, this does actually work well when considering the fact that my graphics engine is now more like a VM that can possibly optimize multiple matrix commands into a single one, avoiding unnecessary calculations and so on. This might be a nitpicking thing from the outside, but when you can get less calculation time for free, you should possibly take it. The more is possible with one engine, the more awesome in can be in the end - think about it! And the "easiest" way to let things look better is to make everything as fast as possible so that more details can be done in time. I'm having quite a lot ideas what to do with more free CPU time, so it's never wasted (even if it's just some more wobble effect or an additional light source).

I'm beginning to like this for reason. Finally there's a whole room of possibilities that doesn't limit itself like multithreading or so. Plain and simple! Just like I like graphics programming. Ideally, it's also straightforward and logical since it should be quick for the system to execute. Oh boy, I'm looking so damn forward to doing more of this stuff in the future.

No comments: