Hello, I'm a self taught programmer and I'm currently working on my own game engine built from the ground up using LWJGL. I'm currently having a pretty big performance problem with animations. I have written my own format for skeletal meshes and animations that I export from 3DS Max and then import at load time. The information is stored in a simple array of bones, vertexes and, triangles and rendered by OGL. For animation I use quaternions for the rotation values of each bone.
On each update I move and rotate the bones to the next place they need to be in the animation and then calculate the movement and rotation for each vertex based on their weight.
- I use doubles for almost all my location and rotation values in the engine.
- I am doing the vertex calculations on the CPU with my own Math classes and what not.
- I am currently only using a single thread for the model updates.
- In java I am using the built in Math.sin, Math.cos, Math.tan for a lot of calculations.
As it stands the models animate fine but it takes too long to do the calculation for the animations. I get noticeable slow downs after I have about 20,000 vertexes being updated on every game step.
Should I try using floats? Should I try using the OpenGL GPU skinning api? Should I try splitting the calculations out to seperate threads? Should I find a faster math Library for java?
All advice is welcome.
I can post the actual code for my vertex weights if it would help as well.