PDA

View Full Version : Skeleton Rendering



bobtedbob
08-06-2012, 10:40 PM
Hi

I have seen quite a few threads on similar topics so I won't go in to the how, but I wanted to ask a few quick questions to put me in the right direction.

I have a skeleton model setup with multiple bones and some meshes are skinned to one bone and some to multiple (depends on the mod as you can add lots of different body parts).

When I add animation I find the slowest bit is recalculating the new vertex positions.

Another thing to add is I currently only have opengl 1/2 code (This was done on purpose as I wanted to learn opengl from the early basics and the optimise things in the futures) and I currently calculate all the final positions of everything (so I use no push and pops)

The questions are

Is recalculating the vertices more efficiently done on the CPU or will it be better to write a shader to do the recalculation?
Are there other ways in future versions of opengl that are even more efficient?
Are there other ways in my current version of opengl that are more efficient?

Thanks

V-man
08-07-2012, 04:24 AM
glPushMatrix and glPopMatrix are ancient history as far as GL 3 and GL 4 are concerned.
If you find that your CPU code is slow, then optimize it with SSE instructions or move the skeletal calculations to the vertex shader.


Are there other ways in my current version of opengl that are more efficient?
If you are using GL 2, then write a vertex shader.


Are there other ways in future versions of opengl that are even more efficient?
You mean GL 3 and GL 4? Use a vertex shader.

Shader capable GPUs have been around since 2002. I can't imagine why you aren't writing shaders.

Kopelrativ
08-08-2012, 04:57 AM
Another thing to add is I currently only have opengl 1/2 code (This was done on purpose as I wanted to learn opengl from the early basics and the optimise things in the futures)


I thinks this was a design mistake. OpenGL 3 does it differently, so you end up having to re-write your code instead of incrementally improve it. Well, as V-man says, much of shaders have been available for a long time already, but you probably missed the idea as you didn't have to use it. With OpenGL 3+, you have to.

Otherwise, it is as V-man says, use a shader for this computation.

bobtedbob
08-08-2012, 12:01 PM
V-man, Kopelrativ

Thanks for the reply. I realise I am behind the times a bit on opengl versions :) I have found learning the fixed pipeline stuff interesting, its very easy to code the fixed pipeline opengl commands and to tweak very simple data sets. At the moment I have spent more time modelling the data than drawing it and only writing 150 lines of code to render some complex models made things very simple at the beginning.

I have started reading the orange book so I'm making progress, I'm looking forward to re working the skeleton processing and to also finally get some decent light implemented (tired of the default crappy light you get in version 1!). I'm sure also it will open a whole new world of cool things I can do too.