   Simple HLSL and Skeletal Animation(unrelated)
  First, I am in the process of converting my graphics engine to be shader based rather the FFP based.  I had about 4 graphics calsses before I decide to do this, so what I am doing now is writing a shader for each class that renders it normally via a shader rather than through FFP.  I actually got a real simple shader working (single triangle), but now I am trying to write one to render a mesh.  I am getting what I assume to be shader compilation errors because this line:effect = Effect.FromFile(me.graphics, effectFilePath, null, ShaderFlags.None, null); Is throwing an exception, Direct3DXException I believe it was.  me.graphics is a verified valid device and the rest standard stuff.  The .fx file is also in the proper directory, just in case someone was about to ask that.  So the only thing I suspect at this point is the shader code, which follows:floa4x4 WorldViewProj : WORLDVIEWPROJECTION;sampler TextureSampler;void Transform(in float3 inputPosition : POSITION,in float2 inputTexCoord : TEXCOORD0,out float3 outputPosition : POSITION,out float2 outputTexCoord : TEXCOORD0 ){    outputPosition = mul(inputPosition, WorldViewProj);    outputTexCoord = inputTexCoord;}void TextureColor(in float2 texCoord : TEXCOORD0,   out float4 diff : COLOR0 ){    diff = tex2D(TextureSampler, texCoord);}technique TransformTexture{    pass P0    {   VertexShader = compile vs_1_1 Transform();   PixelShader = compile ps_1_1 TextureColor();    }}This was not copy and pasted, so any spelling errors I may have missed are not the way it is in my actual shader code.  I have already triple checked proper spelling.  Anyway, I hope someone can help me out with this.  Many thanks.Second, I've got some skeletal animation code that I got from "Managed DirectX 9 Graphics and Game Programming Kickstart" that I am trying adapt for use in my engine.  I'm getting an error on a certain line, namely:mesh.MeshData.Mesh.DrawSubset(iattrib);iattrib is an index value as the code goes through a for loop.  The error is an AccessViolation exception that I am having a lot of trouble tracking down.  MeshData is used in one class that's used in another class that's used in another, so this going to be a very hard to track down bug.  I was hoping for one of two things.  If someone has and/or is familiar with the code I am referring to, could you give me some insight as to what's going on?  Or if someone knows a better way to do skeletal animation in MDX, that would super [smile].  Thanks for taking the time to read this unusually long (for me) post.-AJ   
  For the shader, I'd recommend saving the code to a separate file and using fxc to verify it's legal.  That, or use the Effect.FromFile overload which can return an error string you can examine in the exception handler.For the animation stuff, you'll have a hard time unless you really understand what they're doing.  I've never looked at the managed version MS wrote, but their unmanaged samples always have 3 or 4 methods of animating the mesh, and they're very specifically different.  My very first intuition is that you're using the original mesh which has fewer subsets, rather than the mesh produced by ConvertToindexedBlendedMesh which will have more, but you're getting iAttrib from the conversions, and thus pushing out of bounds.  But of course, that's all a guess.   ;  You are not handling textures correctly.First, you need a global variable for the texture that you would set in your program:uniform extern texture g_Tex;Then you reference it in your sampler declaration.  Here is an example of one I am using:sampler TexWrap = sampler_state{Texture = <g_Tex>;MinFilter = Anisotropic;MagFilter = LINEAR;MipFilter = LINEAR;MaxAnisotropy = 8;AddressU  = WRAP;   AddressV  = WRAP;};Then, when you do the tex2D call, it know what texture you are sampling.   ;Quote:Original post by RenderTargetFor the shader, I'd recommend saving the code to a separate file and using fxc to verify it's legal.  That, or use the Effect.FromFile overload which can return an error string you can examine in the exception handler.For the animation stuff, you'll have a hard time unless you really understand what they're doing.  I've never looked at the managed version MS wrote, but their unmanaged samples always have 3 or 4 methods of animating the mesh, and they're very specifically different.  My very first intuition is that you're using the original mesh which has fewer subsets, rather than the mesh produced by ConvertToindexedBlendedMesh which will have more, but you're getting iAttrib from the conversions, and thus pushing out of bounds.  But of course, that's all a guess.I got the animation working, kind of.  I decided to go through the book and write it up as presented, then made little changes here and there to make it work properly with my engine.  The mesh displays and it animates properly, but there's two things wrong.  The texture on the mesh is one that was previously set for something else even though I explicity set the mesh's texture in the mesh rendering code.  Also, for some ungodly reason, my skybox(the other thing I am rendering), rotates all crazy like while the mesh stays in place.  Pretty weird I'd say.Quote:Original post by DXnutYou are not handling textures correctly.First, you need a global variable for the texture that you would set in your program:uniform extern texture g_Tex;Then you reference it in your sampler declaration. Here is an example of one I am using:sampler TexWrap = sampler_state{Texture = <g_Tex>;MinFilter = Anisotropic;MagFilter = LINEAR;MipFilter = LINEAR;MaxAnisotropy = 8;AddressU = WRAP;AddressV = WRAP;};Then, when you do the tex2D call, it know what texture you are samplingThanks.  I haven't been able to try it yet,  but I will make sure to let you know how it turns out. -AJ   