Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: XNA4.0
Hi . I down this :
http://thefree3dmodels.com/stuff/aircraft/sci_fi_airship/15-1-0-430
 
then Import in blender then export to fbx file;
but when I render it basicly it's be black and have no color. What should I do ?
 
I render that like this :
 
public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        Matrix world;
        Matrix projection;
        Matrix view;
        Model model;
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }
 

        protected override void Initialize()
        {
            world = Matrix.Identity;
            view = Matrix.CreateLookAt(new Vector3(20, 20, 20), Vector3.Zero, Vector3.Up);
            projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, graphics.GraphicsDevice.Viewport.AspectRatio, 1, 1000);
 
            base.Initialize();
        }
 
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            model = Content.Load<Model>("SpaceShip/SpaceShip");
        
        }
 
        protected override void UnloadContent()
        {
 
        }
 

        protected override void Update(GameTime gameTime)
        {
 
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();
 

 
            base.Update(gameTime);
        }
 
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.World = world;
                    effect.View = view;
                    effect.Projection = projection;
                    effect.EnableDefaultLighting();
                }
                mesh.Draw();
            }
            base.Draw(gameTime);
        }
    }
Posted 19-Jan-13 7:09am
Edited 19-Jan-13 7:10am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 494
1 CHill60 405
2 OriginalGriff 345
3 PIEBALDconsult 285
4 BillWoodruff 213


Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 19 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100