Jump to content

  • Log In with Google      Sign In   
  • Create Account


What is the current trend for skinning?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 mrheisenberg   Members   -  Reputation: 356

Like
0Likes
Like

Posted 27 September 2012 - 10:08 PM

It has been a while before I did a skinning system and the last time I did one was one the CPU with Directx9.Now I see people talking about vertex shader skinning,compute shader skinning,using textures for bone data..kinda confused here,which is the mosts efficient method?Is interpolation more efficient on the compute shader than in the vertex shader?

Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 6734

Like
1Likes
Like

Posted 27 September 2012 - 11:25 PM

I think, that it is pretty common to calculate the bone animation on the CPU and do the skinning in the vertex shader with registers for the bone orientation (quaternion+position or matrix), though saving this data in a texture which will be accessed in the vertex shader could have some advantages.

#3 Hodgman   Moderators   -  Reputation: 27838

Like
2Likes
Like

Posted 27 September 2012 - 11:44 PM

Yeah the current 'baseline' implementation would be calculate bone anim on CPU, put bones into constant registers as matrices, and do skinning with 4 weights in the vertex shader.

Instead of using 4x4 matrices, the simplest improvement is to just use 4x3 matrices (or 3x4, depending) so that you only need 3 registers per bone -- you can do this because one row/column will always be [0,0,0,1].
You can then get down to just 2 registers per bone by using dual-quaternion skinning, or using some kind of rotation+translation format.

On some cards, you might get better fetch performance by putting the bone data into a texture, or a 'tbuffer' instead of a 'cbuffer'.

Another issue is that in most modern renderers, each model is drawn more than once per frame -- e.g. one from a light's point of view for shadow mapping, and then once for the main camera. With vertex-shader skinning, this means that the model is skinned twice (which doesn't occur with CPU skinning).
You can avoid this issue on DX10 cards by using "stream out" -- where instead of rasterizing your skinned vertices, you instead write the results to a vertex buffer. You can then use this temporary vertex buffer to draw the mesh multiple times (without running skinning again).
On DX11, you also have the option of using a compute shader to do this work.

#4 MJP   Moderators   -  Reputation: 10243

Like
2Likes
Like

Posted 28 September 2012 - 01:59 AM

With DX11.1 you can output to a buffer from a vertex shader, which is even better than using a compute shader or stream out since you can just output the skinned verts while rasterizing your first pass.

#5 mrheisenberg   Members   -  Reputation: 356

Like
0Likes
Like

Posted 28 September 2012 - 02:30 AM

With DX11.1 you can output to a buffer from a vertex shader, which is even better than using a compute shader or stream out since you can just output the skinned verts while rasterizing your first pass.


won't that become overly complicated when you implement advanced animations(animation blending,adjusting character body to match the angle of the terrain he is standing on,ect.),you wold have to send a huge amount of matrices

#6 Nik02   Crossbones+   -  Reputation: 2647

Like
0Likes
Like

Posted 28 September 2012 - 06:27 AM

You wouldn't stream out the bones, just the transformed vertices. The point is that you only need to apply the bone transforms (the heavy lifting of skinning) once, and then re-use the resulting mesh in subsequent drawing passes.

Niko Suni


#7 mrheisenberg   Members   -  Reputation: 356

Like
0Likes
Like

Posted 28 September 2012 - 12:54 PM

Ok just 1 last question = in DirectX11.1 you can stream out from the vertex shader,instead of the geometry shader.Is this hardware dependant,or can my directx 11.0 gpu do it?

#8 Nik02   Crossbones+   -  Reputation: 2647

Like
0Likes
Like

Posted 30 September 2012 - 08:29 AM

You can stream out from vertex shader by bypassing the geometry shader. This functionality is available in 11.0 hardware.

The device's CreateGeometryShaderWithStreamOutput method also accepts vertex shader bytecode. You do get a geometry shader handle from that (and you need to set it as the active geometry shader), but it is just a straight pipe that sends the vertices from the VS to the SO buffer.

In addition to that, 11.1 hardware allows you to write arbitrarily to r/w shader resources from within all shader stages, which gives you a lot more flexibility.

Edited by Nik02, 30 September 2012 - 08:31 AM.

Niko Suni


#9 MJP   Moderators   -  Reputation: 10243

Like
0Likes
Like

Posted 30 September 2012 - 10:16 AM

UAV's from any shader stage is a 11.1 feature, so you'd need a fully-compliant FEATURE_LEVEL_11_1 video card with the necessary driver. I'm not sure if existing DX11 GPU's are fully compliant, but if any are I don't believe there are any publicly-available drivers yet. I could be wrong about that though.

Making a GS with stream out from a vertex shader still creates a "dummy" geometry shader. Either way the really bad part about doing it that way is that you can't rasterize a triangle list while streaming out, because you'd have to stream out the fully-expanded list of vertices which is pretty inefficient. The alternative is to have a dedicated "stream-out" pass where you render with a point list topology and stream out from the GS, since that gives you a non-expanded buffer of vertices that you can index into with your index buffer.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS