Sign in to follow this  
Karl G

Bug: Lit, skinned animation with indexed vertex blending

Recommended Posts

Karl G    170
I would consider this an advanced topic. It might be a long shot, but I'd like to see if anyone else has encountered this bug. I am using the FF pipeline because I want this code to run on old hardware. I am using indexed blended vertex animation to animate a bipedal skinned mesh. I split the mesh into vertex groups, since not all vertices are are weighted with the same number of bones, or if there are too many bone matrices to fit on the hardware simultaneously. Everything works fine when D3DRS_LIGHTING is FALSE, and Direct3D outputs no errors or warnings. As soon as I toggle this flag, some of the vertices look as if they are being transformed by the null matrix (stretching out from wherever they are attached on the model to the origin). Direct3D still outputs nothing unusual. Change the lighting flag back, and the error goes away. This error occurs on one specific mesh. This happens to be the mesh with the most number of bones, but the number of bone influences doesn't seem to be the problem (it happens for 1, 2 or 3 influences). Now here's the really weird part: this only happens in hardware mode. Software mode works perfectly. I am running a 100% D3D9-compatible graphics card. This has been bugging me for a while, but I've chosen to ignore it for now since I don't have any ideas. Does this sound familiar to anyone?

Share this post


Link to post
Share on other sites
J-Fox    174
I was having similar problems if I tried to draw too much at once.
Try splitting the problematic render calls into different DrawPrimitives.
I m not sure how the problem was caused - it might have been a problem with the bandwidth.

Share this post


Link to post
Share on other sites
Karl G    170
Thank you for your replies.

As I said, there is nothing unusual being output from the debug runtime; just the usual occasional warning that a state change is being ignored because it is already set.

Thanks for the tip J-Fox; however, I tried splitting up the DrawIndexedPrimitive calls further and got the same results. Unfortunately, D3D is VERY sparse on its documentation of indexed blended animation with the FF shader. When you split up your calls, did you also split up the buffers? I am wondering if it could it be a buffer-size issue (i.e. the vertex buffers are too large to be handled by the pipeline?)

If you have any more insight, I'd really appreciate it.

Share this post


Link to post
Share on other sites
ViLiO    1326
Sounds like a perfect use for PIX to me. Sorry I can't be of more help, but having a look at the draw primitive calls in PIX should hopefully give you more to go off.

Regards,
ViLiO

Share this post


Link to post
Share on other sites
Karl G    170
Ah! PIX, of course!

I ran a very simple test scene through PIX, and thanks to your help I think I'm getting closer to an answer.

There are 21 bone matrices in this mesh. Splitting up the draw calls into sets of 16 polygons, I traced backward through the index buffer and found that all of the vertices rendered with bones 19, 20 and 21 produce the artifacts. There are no problems with any bone lower than 19. 20 and 21 are both children of 19, so I'm assuming that's where the problem is.

Now here's the kicker: a different mesh with more bones and more vertices renders just fine. Both of these meshes render correctly in both the MultiAnimation D3D demo and both old and new versions of MeshView (all with lighting enabled).

Normally, this would make me think that the mesh has a problem--except for some very strange PIX output. The mesh transformation on each draw call works perfectly: under the "Mesh" tab, the Pre-Vertex Shader, Post-Vertex Shader and Viewport all look exactly correct for every single render call--including a DIP for the whole mesh. However, flipping over to the "Render" view, as soon as bone 19 is drawn, the artifacts are there. It seems that during the actual texturing/rasterization, D3D chokes on something.

All D3D calls (including SetTransform for all matrices, SetRenderState, EndScene and Present) return S_OK.

Any other things to try would be very helpful--this problem is driving me nuts.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this