• Announcements

Archived

This topic is now archived and is closed to further replies.

OpenGL Realtime Skin deformation with OpenGL

Recommended Posts

Hi there! I would like to know if someone has already made a realtime skin deformation renderer in OpenGL, and know the code/theory behind it? I''ve been working on my own renderer for a few weeks now, and I can''t manage to have the correct result. I''ve made my own exporter plug-in for 3DS Max 4, and it works pretty well. I can get all the info I need in my renderer from my exported file (Skin, Bones, Weight etc...). But I think I don''t understand how to compute the correct transformations. I''ve read many papers, but they all stay very general and don''t help me much. For the moment I''m able to render correctly some very simple animations (a cylinder with 2 or 3 bones that controle it). But since I''m trying with a whole body and a dozen of bones, it doesn''t work any more. I should be missing something, but I''ve spent many hours trying to solve the probleme and I still don''t know what. I know there is a support for skin with DX. But how to do it with OpenGL ? Is there some kind of hardware acceleration for that ? I can post some parts of my code and some screen shots of what I get if needed. So if someone could answer my questions or send me an example, I would be very grateful.

Nobody?

Share on other sites
Not enough information.

The basic idea is to compute a matrix hierarchy, as in simple, non-skinned animation. Each bone gets a local matrix. You would then walk from the root through the hierarchy, push/pop and multiply matrices as you come along, and draw the individual body parts. That would be without skinning.

With skinning, you walk through the whole hierarchy, and do the matrix concatenation. But you don''t render anything, just save the matrices. Once done, you load all those intermediate matrices into constant vertex program registers. Be careful about the reference coordinate frame you use. Different approaches are possible here, but your matrices need some kind of common reference frame.

In the vertex program itself, you transform a vertex by all the matrices he has been assigned to, and weight the results accordingly. Here again, depending on your approach, you might have to compensate for your reference coordinate frame or bone origin.

quote:

I know there is a support for skin with DX. But how to do it with OpenGL ? Is there some kind of hardware acceleration for that ?

There are some dedicated extensions, but the best and most flexible way is to use a vertex shader (ARB_vertex_program).

quote:

I can post some parts of my code and some screen shots of what I get if needed.

That would be a good idea

Share on other sites
Yeah, thanx a lot for your answer!!

So I was completly wrong :/
I had already heard of vertex program, but never used it.
Now it''s ok, but I still got a few questions. I''ve found some example of skinning programs, but they are all for the NV extension. I tryed to translate it for the ARB, and this is what I get:

For the moment I only use one bone/vertex. If it works, it won''t be difficult to manage the other cases.
glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 4, TM[0] , TM[1] , TM[2] , TM[3] );
glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 5, TM[4] , TM[5] , TM[6] , TM[7] );
glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 6, TM[8] , TM[9] , TM[10], TM[11]);
glProgramLocalParameter4fARB(GL_VERTEX_PROGRAM_ARB, 7, TM[12], TM[13], TM[14], TM[15]);
TM is the bone transformation matrix (in the same order as opengl matrix)

And now my vertex program:

!!ARBvp1.0

PARAM mvp[4]={state.matrix.mvp};
PARAM Matrix2[4] = { program.local[4..7] };
PARAM Pivot = program.local[8];

ATTRIB VertexInitCoord=vertex.position;

OUTPUT VertexFinalCoord=result.position;

TEMP r0, r1, r2;

#Transform the vertex to clip space.
DP4 r0.x, mvp[0], VertexInitCoord;
DP4 r0.y, mvp[1], VertexInitCoord;
DP4 r0.z, mvp[2], VertexInitCoord;
DP4 r0.w, mvp[3], VertexInitCoord;

SUB r2, r0, Pivot;

DP4 r1.x, Matrix2[4], r2;
DP4 r1.y, Matrix2[5], r2;
DP4 r1.z, Matrix2[6], r2;
DP4 r1.w, Matrix2[7], r2;

ADD r0, Pivot, r1;

MOV VertexFinalCoord, r0;

END

Of course it doesn''t work. I get nothing on the screen. When I remove the 4 last DP4 lines the model is back, but w/o animation.
I tryed to pass an identity matrix instead of the bone TM to the local parameter, but the screen stay black too. So I don''t what''s wrong :/

• Partner Spotlight

• Forum Statistics

• Total Topics
627651
• Total Posts
2978397
• Similar Content

• Both functions are available since 3.0, and I'm currently using glMapBuffer(), which works fine.
But, I was wondering if anyone has experienced advantage in using glMapBufferRange(), which allows to specify the range of the mapped buffer. Could this be only a safety measure or does it improve performance?
Note: I'm not asking about glBufferSubData()/glBufferData. Those two are irrelevant in this case.
• By xhcao
Before using void glBindImageTexture(    GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), does need to make sure that texture is completeness.
• By cebugdev
hi guys,
are there any books, link online or any other resources that discusses on how to build special effects such as magic, lightning, etc. in OpenGL? i mean, yeah most of them are using particles but im looking for resources specifically on how to manipulate the particles to look like an effect that can be use for games,. i did fire particle before, and I want to learn how to do the other 'magic' as well.
Like are there one book or link(cant find in google) that atleast featured how to make different particle effects in OpenGL (or DirectX)? If there is no one stop shop for it, maybe ill just look for some tips on how to make a particle engine that is flexible enough to enable me to design different effects/magic
let me know if you guys have recommendations.
Thank you in advance!
• By dud3
How do we rotate the camera around x axis 360 degrees, without having the strange effect as in my video below?
Mine behaves exactly the same way spherical coordinates would, I'm using euler angles.
Tried googling, but couldn't find a proper answer, guessing I don't know what exactly to google for, googled 'rotate 360 around x axis', got no proper answers.

References:
Code: https://pastebin.com/Hcshj3FQ
The video shows the difference between blender and my rotation:

• By Defend
I've had a Google around for this but haven't yet found some solid advice. There is a lot of "it depends", but I'm not sure on what.
My question is what's a good rule of thumb to follow when it comes to creating/using VBOs & VAOs? As in, when should I use multiple or when should I not? My understanding so far is that if I need a new VBO, then I need a new VAO. So when it comes to rendering multiple objects I can either:
* make lots of VAO/VBO pairs and flip through them to render different objects, or
* make one big VBO and jump around its memory to render different objects.
I also understand that if I need to render objects with different vertex attributes, then a new VAO is necessary in this case.
If that "it depends" really is quite variable, what's best for a beginner with OpenGL, assuming that better approaches can be learnt later with better understanding?

• 10
• 12
• 22
• 13
• 33