"Both a valid vertex shader and pixel shader (or valid effect) must be set on the device before any draw operations may be performed."

Topics: User Forum
Nov 27, 2008 at 1:16 PM
Edited Nov 27, 2008 at 1:21 PM
Hi there. I'm loading a model from an FBX file that was exported using the Crosswalk exporter in XSI. I'm not doing anything special with it, it's a simple 2 bone rig enveloped by a cylinder with an animation attached that makes the cylinder "Flex". When the model attempts to draw itself however it throws this error. It has nothing to do with my graphics card since I have a GeForce 8800GTX which supports all the neccessary pixel/vertex shaders. The model appears to be loading correctly as putting a breakpoint in the code and investigating the member variables of the ModelAnimator reveals that everything appears as it should. The offending line of code appears to be that which attempts to draw the indexed primitive in the ModelAnimator's draw function. I've set the correct model processor and I'm kinda running out of idea's as to what could be the problem. Any help would be appreciated.
Nov 27, 2008 at 2:32 PM
OK, I think it might be something do with the model content processor provided by the Animation Component Library not attaching a default shader effect file when none is attached to the model, unlike the XNA Framework model content processor. I'll try writing my own phong shader and attaching it to the objects material in XSI, see if that fixes the problem.
Nov 28, 2008 at 11:56 AM
What version of XNA are you using?
Nov 28, 2008 at 2:29 PM
Version 3 and that was the problem, apparently you need to use your own shader to do the skinning in V2 and above. I've written one and all is dandy, I've got the Dwarf model importing, now all I need to do is get my own meshes animating :/
Nov 29, 2008 at 9:38 PM
I got the same problem. I export the dude.fbx file from Microsft's animation sample to dude.x file with panda exporter and KWexporter, and try to make it work with ACL, I got the same problem. hope your own shader will work.
Nov 30, 2008 at 10:18 PM
Edited Nov 30, 2008 at 10:21 PM
Here's what I think the problem is:

The BasicPalleteEffect is created in the content pipeline. Somewhere in the process, is screws up, and *poof*, you have a problem. You may notice that during the exception, the GraphicsDevice.VertexShader is set to null.

To fix this, you need to load the effect during run time. One way to do this is to create a compiled effect from the source code (Effect.CompileEffectFromSource) and pass in the
converted code (CompiledEffect.GetSource) as a parameter to a new effect,

This might be a little confusing...

I have a version upgraded to XNA 2.0 integrated into my library (http://www.codeplex.com/VLibrary). Take a look at the source. It's under VLibrary.RenderXNA.Graphics.Animation.
Note that the code in the XBOX version won't work.


*Note: The alteration is in VLibrary.RenderXNA.Graphics.Animation.Content.PaletteEffectReader.