Grotius

Hi there,

I've been working my way through the tutorials at http://xna101.spaces.live.com/ , and I am stuck on lesson 16, the first 3D tutorial. The download of die.x didn't work, so I whipped up my own little 3D cube in Blender and applied a simple 64x64 pixel texture to it and saved it in DirectX format as cube.x. I was able to add it to my Project fine, but when I try to compile the program, it has all sorts of trouble understanding any texture I put on the thing. It will say the texture file is not found in the debug/bin directory; or it will give me other error messages about the structure of the texture file. I tried saving the cube as cube.3ds and cube.x3d and whatnot, and none of that worked. (Indeed, the Project didn't even recognize a .3ds file as a pipeline object. Does XNA/DirectX take a .3ds file )

The only thing that worked was to model the cube with no texture at all, save it as cube.x, and then display it with the tutorial code. What am I doing wrong Is it my admittedly sloppy Blender skills



Re: XNA Game Studio Express Displaying textured 3D objects

neogir

Only .x  and .fbx meshes are  supported by default content processors. If your mesh has a texture (with a valid inner reference), you have  to check  your Blender export with the DirectX viewer first. If your cube is looking  fine,  all you need is   to load  this mesh with content processor.  It's not necessary to load a texture in this case,  just  place it as referenced (usually in the same directory ).  Don't  forget to enable texturing in your effect.

If the output directory doesn't have this texture again  or if the DX viewer doesn't show the mesh properly (with no texture at all) you  can try to load your  texture as well with the content processor.  Set the asset property "Copy if newer" for it.  You should also tell to the effect which asset to use.

If it doesn't help your mesh probably has no  proper uv  coords. Try your code with some other  model. There are a bundle of the textured meshes in the DX SDK and elsewhere.   





Re: XNA Game Studio Express Displaying textured 3D objects

Bill Reiss

Grotius,

Sorry you had trouble with my site. If the download of the .x file didn't work for you, you can try downloading the zip file for that lesson and then extracting it and adding it to your project. If you still have trouble please let me know and I can try to get it to you a different way.

Bill






Re: XNA Game Studio Express Displaying textured 3D objects

Grotius

neogir wrote:

If your cube is looking fine, all you need is to load this mesh with content processor. It's not necessary to load a texture in this case, just place it as referenced (usually in the same directory ). Don't forget to enable texturing in your effect.

Yeah, I noticed that the tutorial code doesn't load the texture separately. By "place it as referenced" you mean "add existing item to project" using the source explorer, right

If it doesn't help your mesh probably has no proper uv coords. Try your code with some other model. There are a bundle of the textured meshes in the DX SDK and elsewhere.

I suspect this may be the trouble. I'm having the dangedest time unpacking even the simplest object correctly in Blender. I have an easier time with the Max or Maya interface...





Re: XNA Game Studio Express Displaying textured 3D objects

Grotius

Wonder of wonders, I went back to your tutorial, and this time the .x assets all downloaded. Go figure. What program did you make them in, Bill

They are excellent tutorials, by the way! I'm ready to try a simple 2D game on my own, but I want to play with the 3D toys a little first...





Re: XNA Game Studio Express Displaying textured 3D objects

Bill Reiss

Thanks for the kind words, I'm glad you're enjoying them.

I use AC3D just because it was cheap and I needed something to do some simple modeling in. You can download a 14 day trial version. I have, however, had to make a couple of changes by hand to the X files it generates, one because it generated a bad frame and mesh name, and once because of a XNA Beta 2 limitation where there can't be duplicate frame names in a X file. The duplicate bug is supposed to be fixed in the XNA release.

Bill






Re: XNA Game Studio Express Displaying textured 3D objects

Grotius

Ah; that "duplicate frame name" issue is one of the many problems I got when I was trying to load my own textures into your tutorial. Now I'm off to try your die...



Re: XNA Game Studio Express Displaying textured 3D objects

Bill Reiss

Grotius wrote:
Ah; that "duplicate frame name" issue is one of the many problems I got when I was trying to load my own textures into your tutorial. Now I'm off to try your die...

FYI, it sometimes can help if you load the X file into the DirectX SDK DirectX Viewer, that way you can verify the model before trying to bring it into XNA and see if any issues in rendering it are actually in the model or they're somewhere in the rendering code. It helped me a lot when I started rendering models with more than one mesh.






Re: XNA Game Studio Express Displaying textured 3D objects

Grotius

I had no trouble reconstructing your die program once I had your model. :) What I like about your tutorials is that you explain things step by step, and I "test" myself by predicting the next step and trying to code it before I see what you've done. I learn best by making myself try. I'm now doing your tumble tutorial.

Erm, I'm really new to 3D, so one thing I don't fully understand is the Matrix structure. I get the general idea: to describe something in three dimensions, a 2D array won't do. But I don't understand what the backward, forward, left, right etc. Vector3 components of the Matrix are. I see them in the structure definition in GSE's object viewer, and I see that they consist of Vector3s, but I can't find an explanation of what they are. Likewise, I can see that a Matrix consists of four groups of four floats each, but I don't understand what they do. Nor do I understand what it means to multiply or subtract Matrixes, or for that matter how to use them to define rotation. I guess I need to do some reading. Any suggestions on where I might look

FYI, it sometimes can help if you load the X file into the DirectX SDK DirectX Viewer

Hmm, XNA GSE seems to have installed the DX SDK, but I don't see any SDK DirectX viewer. Is that a separate download





Re: XNA Game Studio Express Displaying textured 3D objects

neogir

 Grotius wrote:
By "place it as referenced" you mean "add existing item to project" using the source explorer, right

No. The textured .x mesh contains reference to  textures  like
TextureFilename { "Rock01.jpg";}
If the filename has no path, you have to manually copy  that texture to the model directory, otherwise  create an appropriate directory structure in your project  in accordance to the relative path.
If you are a modeller as well, it's up to you depending on your modelling software, to set the path for a mesh textures and effects.

 Grotius wrote:
Hmm, XNA GSE seems to have installed the DX SDK, but I don't see any SDK DirectX viewer.  Is that a separate download

You are right, the DirectX SDK is a separate download (> 500 Mb). But it worth to be downloaded to have a lot of the samples and useful utilities (including DX Viewer, Texture Tools, PIX etc.) by the hand.
There is a 30 Mb  DirectX End-User Runtime  Package as well (not the same as DirectX SDK) the application may install before being run on the end user computer with an older DX version to provide the correct DX DLLs versions.





Re: XNA Game Studio Express Displaying textured 3D objects

Grotius

Ah, OK, I'll get the DirectX SDK. Is that SDK going to change after December 11 or 12, whenever Microsoft releases the release version of Game Studio Express I.e., will I have to redownload and/or reinstall it then



Re: XNA Game Studio Express Displaying textured 3D objects

Leaf.

The DirectX SDK is on a 2 month release cycle and the last release was in October so its very likely that there will be a December release, sometime soon.

Cheers,
Leaf.





Re: XNA Game Studio Express Displaying textured 3D objects

Grotius

Thanks.

So, can anyone point me to some reliable reading on exactly how a Matrix is used in 3D programming I can make it work in GSE, but I don't understand why. :)





Re: XNA Game Studio Express Displaying textured 3D objects

Joel Martinez

You could start here:
http://gpwiki.org/index.php/3D:Matrix_Math





Re: XNA Game Studio Express Displaying textured 3D objects

Grotius

Thanks. That was helpful, and from there I found some explanations of how Matrices are used by DirectX. Scaling Matrix math is relatively easy to grasp. Translation and rotation math is harder to grasp, especially since DirectX uses a fourth row/column in its Matrix, but I'm working through it all. Rotation in particular requires one to dredge up one's geometry. :)