3D!

Published January 08, 2008
Advertisement
One of the new things I'm trying to do, that I've been wanting to do for a long time, is learn how to program 3D graphics(at least with XNA). So, sunday I started off with a few tutorials, learning how to load and render 3D models, and how to rotate them and move the camera.

I downloaded Anim8or as my 3D modeling program, mostly because it's free, but also because it is very simple to use. Today I attempted to apply texture mapping to a basic cube. I first tried what I thought would work:
foreach(ModelMesh mesh in _model.Meshes){         foreach(BasicEffect effect in mesh.Effects)         {                effect.View = view;                effect.Projection = projection;                effect.TextureEnabled = true;                effect.Texture = texture;                effect.World = _boneTransforms[mesh.ParentBone.Index] * x_rot_matrix * y_rot_matrix * z_rot_matrix * trans_matrix;         }         mesh.Draw();}


and...It didn't work too well:


So, I'm going to start looking for some good tutorials on texture mapping. Unlike the last times I've tried to learn 3D graphics, I'm going to take this slow and try to learn the basics. So far it's going well.
0 likes 6 comments

Comments

LachlanL
Welcome to the world of 3D! Patience is definitely a virtue here! [smile]
January 08, 2008 10:47 PM
Stompy9999
It helps alot this time that I understand more of the math concepts behind 3D graphics, which before I had no clue about. But yeah, I'm going to keep my goals modest for now, so no First Person Shooters[grin]
January 08, 2008 11:40 PM
Driv3MeFar
Quote:Original post by Stompy9999
effect.World = _boneTransforms[mesh.ParentBone.Index] * x_rot_matrix * y_rot_matrix * z_rot_matrix * trans_matrix;


I don't know if it's just how XNA or your modeling package works, but skeletal animations seem a bit ...overkill for some rotating cubes.

All in all, your first attempt isn't that bad. You do pretty clearly have some cubes that appear to be rotating around in your world, you just need to get your texture coords in order.

Welcome to the world of 3D!
January 09, 2008 05:49 AM
Stompy9999
I got that portion of the code from a tutorial(the original version draws a bunch of dice models to the screen). I'm actually loading the cubes from file, which is definetly a bit much, but I'm really not sure how else to do it. I'll have to see if there is a way to texture map the cube in it's current state, like applying the texture in the 3D editor.
January 09, 2008 03:44 PM
gharen2
Yeah, unless you're working with skeletal animation, you don't need to care about bones. Just replace the _boneTransforms[mesh.ParentBone.Index] with Matrix.Identity and it should work fine.

And welcome to the world of 3D. It can be an exercise in frustration, but I've never been able to go back to 2D.
January 10, 2008 01:58 PM
Stompy9999
Thanks! I do need to fix how I'm drawing the models, considering I'm not planning on using anything really complex, at least not for awhile.
January 10, 2008 04:28 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement