Model Not Being Rendered (Was Previously)

Last post 04-28-2008, 10:30 PM by edge10. 6 replies.
Sort Posts: Previous Next
  •  03-28-2008, 3:06 PM

    Model Not Being Rendered (Was Previously)

    I created a model (representing a laser beam) in the XSI mod tool an exported it as an .fbx model for use in an XNA arcade game I am playing with.  The model rendered fine (although it was initially too small, because I am using the Space War starter kit models as well).  My initial starting point for the program was the Tutorial 4: Make a Game in 60 Minutes package, in it's freshly downloaded state.

    I switched to using the Game State Management Sample as a framework, bringing my code in to the GamePlayScreen class.  After a little bit of debugging, I had the game working again, except the laser model was not being rendered.  It was there as far as collisions are concerned, but it is invisible in game.  I can switch the model to another, say one of the Space War ships, and it will render fine.  I have found that the red projectile looking blob from the Space War kit, does not render either.

    Btw, I went back to the Tutorial 4 starting code and replaced the ship model with the laser model and it does still render.

    Does anyone have any suggestions?

    Thank you in advance,

    Dave
  •  03-28-2008, 3:11 PM

    Re: Model Not Being Rendered (Was Previously)

    Are you using SpriteBatch anywhere? If so you'll want to read this: http://blogs.msdn.com/shawnhar/archive/2006/11/13/spritebatch-and-renderstates.aspx.


    Nick Gravelyn -- Microsoft XNA MVP
    XNA Wiki | Zune Games
  •  03-28-2008, 3:43 PM

    Re: Model Not Being Rendered (Was Previously)

    I most definitely am using SpriteBatch.  I will look in to this, and update this thread.

    Thanks,

    Dave
  •  03-29-2008, 5:48 PM

    Re: Model Not Being Rendered (Was Previously)

    Unfortunately that was not the answer.  I even tried removing the SpriteBatch entirely with no change.

    The model from the Space War pack that also does not render is mgun_proj.x

    Any other suggestions would be greatly appreciated!

    Thanks,

    Dave
  •  03-31-2008, 3:56 PM

    Re: Model Not Being Rendered (Was Previously)

    Without seeing your render code, there's not much chance of us helping you at this point.

     

  •  03-31-2008, 5:12 PM

    Re: Model Not Being Rendered (Was Previously)

    This is almost certainly a renderstate issue, but it's impossible to say what without a full copy of your code to experiment with.

    Perhaps your model or textures contain zero alpha values, and you have alpha testing renderstates turned on?

    Maybe the model has a wrong winding order, and you have the cullmode renderstate set?


    --
    XNA Framework Developer
    blog - homepage
  •  04-28-2008, 10:30 PM

    Re: Model Not Being Rendered (Was Previously)

    I finally figured it out. 

    It was due to the order in which I loaded the model and SetupEffectDefaults.

    If I did those two before setting projectionMatrix and viewMatrix the model would not be rendered.  By moving the content.Load<Model>("Models/Laser") and SetupEffectDefaults to after those, it renders fine.

    Thanks,

    Dave
View as RSS news feed in XML
©2007 Microsoft Corporation. All rights reserved. Privacy Statement Terms of Use Code of Conduct Feedback