Skinning on DX9 vs CineFX:

LeStoffer

Veteran
I just caught this from the updated CineFX whitepaper about how the NV3x can perform skinning:

Under DirectX 9, this improves somewhat. One shader can now be written to represent the example involving up to four bones, but since DirectX 9 only supports a very limited notion of branching, it can only be performed per object, which means that the model must still be broken up and drawn separately.

The NVIDIA “CineFXâ€￾ architecture, with its fully generalized loops and branches that can be data-dependent, has a much more straightforward programming methodology. One shader is written to encompass all the skinning methods and operations, and since the shader can branch on a per-vertex basis, it is not required to break up the model. By performing the loop conditionally on a per-vertex basis, segmentation of the model is not necessary, dramatically improving both application performance as well as developer productivity.

Hmmm, will it be practical to do skinning with shaders in games? I thought that this was done on the CPU by the game application...
 
Actually that's good. Flow selection on vertex basis. However, since DX9 does not support it, I think games using DX9 is very hard to benefit from it (perhaps by Cg? NVIDIA likes to implement strange hacks into D3Ds). OpenGL 2.0 is another story, of course.
 
There is no way you could sneak some functionality into DirectX using Cg. If DirectX runtime finds something that does not comply with specs in a shader it simply rejects it (that's before shader even gets to driver). But there might be something like vs.2.1 also coming with DirectX 9.0, but I really don't know anything about something like that for now.
 
The description of how it would be done in DX8 is mostly to highlight the data dependent branches, and not realy the way you actually would do it.

You would probably use the 4-bone shader all the time. If you only want two bones, the weight for the other two bones would be set to zero.

Having data dependent branches makes it more efficient, but it's still efficient enough to implement it in one VS1.1 shader.

Now if the mesh has vertices that is associated to a lot more than 4 bones, then you might want to consider to do a few versions of the shader. (4-bone, 8-bone) Or in the case of VS2.0, change a VS constant now and then (in large steps, not per vertex).
 
I believe(heard) the final versions of Cg and HLSL are going to allow you to "tag" effects with meta data labels, and select them at runtime, ala LOD.

e.g. (pseudo syntax)

vertex_shader "dx9" do_skinning()
{
// NV30/R300 version
}

vertex_shader "dx8-8bone" do_skinning()
{
// 8-bone version
}

vertex_shader "dx8-4bone" do_skinning()
{
// 4-bone version
}

vertex-shader "default" do_skinning()
{
// no bones, or DX7 fixed function bones
}


That way you can trade shaders with other people, and the file format will support multiple versions, selected at runtime.
 
That's not really much of a surprise. DX8 techniques and effects already have support support silmiar to that. Not quite as complete as your DX9 example, but still fairly close. With DX8 the developer needs to validate that the technique can actually run on the hardware (by just calling ID3DXTechnique::Validate), it's not automatic like it would appear to be in DX9 from your example. The effect files already allow you to embed pixel and vertex shaders in them.

-Colourless
 
LeStoffer - I know it's no game but the vertex shader test in 3DMark2k1 uses a VS for skinning the 100 models in the scene. Everything else though is standard pipeline stuff.
 
Thanks for the replies everybody. I have no clue about the instructions in the different shader versions so I just wanting to know if this was anything truely special. Apparently not.

It's also very refreshing to only get well educated responses for a change. ;)

[/Back into lurk mode with me]
 
Back
Top