Community Forums

XNA Training

+ Reply to Thread
Results 1 to 6 of 6
  1. #1

    Angry Effects from skinnedmodel.fx not loading

    Hey there,

    Ive been learning c# for about a year now in a software design and development course, so im fairly new to programming, and ive just started the series "Real time shaders in XNA". So far i understand whats going on, however i have been completing this series on Visual C# 2010 and XNA game studio 4.0 (i didnt think this would make a DRASTIC difference). Anyway cutting to the point I found that by the time when this code was being implemented my game would get an "ArgumentNullReferenceException was unhandled" error:

    Code:
                // TODO: Add your drawing code here
                foreach (ModelMesh mesh in gcv.Meshes)
                {
                    foreach (Effect effect in mesh.Effects)
                    {
                        effect.Parameters["Bones"].SetValue(bones);  
                        effect.Parameters["View"].SetValue(view);                          ERROR WAS HAPPENING HERE
                        effect.Parameters["Projection"].SetValue(projection);      and here as well if above was commented out and so on   
                    }
                    mesh.Draw();
                }
    So when the instructors game loads mine doesn't pretty much. Ive followed word for word (i'm fairly certain), and ive compared our code which is exactly the same. If i had a guess where the problem was i would think it was not picking up where my SkinnedModel.fx file is or its having difficulty finding the words "View" or "Projection" etc. Like i said fairly new to programming so go easy on me :P but any help is extremely appreciated .

    P.S i am not using my own model that was shown how to make in the maya lessons beforehand.

  2. #2

    Re: Effects from skinnedmodel.fx not loading

    So pretty much i restarted the course, this time round i used the SkinningSample from XNA 3.1 rather than 4.0, and im rid of the error, however im not certain that that was the root of the error as of yet. I am now faced with another problem though which is that my animation is not behaving as in the video, it seems to be in a standing position bobbing up and down and its left hand flopping all over the place. It seems as though it is in an orthographic viewport.

    e.g.lousy_animation.jpg

    EDIT: The player is shaded white as that is what the vertex and pixel shader were being told to do in that particular lesson.
    Last edited by Prophet; 11-15-2010 at 01:43 AM.

  3. #3
    Join Date
    Oct 2006
    Location
    Digital Tutors HQ
    Posts
    2,325
    DT Staff
    I am a Face of Change

    Re: Effects from skinnedmodel.fx not loading

    Hi Prophet,

    I wish I could help, but XNA has changed quite a bit from when we created that training.

  4. #4

    Re: Effects from skinnedmodel.fx not loading

    I solved this exact bug, if someone cares. (the effects not loading, with a null exception)
    First, don't include skinnedmodel.fx, it doesn't seem to exist anymore in the sample for XNA 4.0.
    Second, don't use "Effect effect" but "SkinnedEffect effect", as specified in the sample 4.0 readme.
    Third, it's no longer effect.Parameters["View"].SetValue(view), but effect.View = view, ect...
    You can look how to set bones/view/projection in the sample solution.

    With all that, it runs as in the video.

  5. #5

    Re: Effects from skinnedmodel.fx not loading

    Thanks Iywald!

  6. #6

    Re: Effects from skinnedmodel.fx not loading

    Yeah thanks, I'm using the tutorials now and this is the first real problem I've run into. I think I might put this and all the other differences that I find in a seperate tutorial when I'm finished.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts