0
\$\begingroup\$

I have a very specific question which I feel should have a very short answer, but which I can't seem to find despite Googling on and off all day.

I'm trying to start with 3D graphics, and I read up a bit on the theory, etc. and I know the math. The issue is just with software. I'm trying to make a cube, which appears to be made of dirt (honestly solid brown would be fine), to appear on the screen. Technically I'm using XNA but I don't think this affects the answer or question very much.

I know how to make a functioning mesh/texture combo appear on the screen properly (I've read http://msdn.microsoft.com/en-us/library/bb975644(v=xnagamestudio.31).aspx among others); the issue is producing the texture itself.

For example, with Blender, I can easily make a cube and stick a procedurally generated texture on it that looks pretty good, but when I export as, say, .fbx, I get a mesh (and I think no texture data) and it doesn't work (as in doesn't appear on the screen but doesn't give an error message, which is consistent with the "no texture data" hypothesis).

So one great answer would just be to tell me how to export texture data from Blender along with, or in addition to, the mesh.

One other great answer would be to tell me how to produce textures in a different (free) program that is perhaps better suited (Blender may not be the right choice, I don't know anything about it).

Either answer or some completely other kind of answer is fine. But I feel like this should be a simple problem to solve, and I don't think I can stand another 30 minute youtube video that doesn't answer the question.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

In Blender, you need to UV map a texture to your cube model. Then when you export your model (using the standard FBX exporter) it will contain a reference to that texture in addition to your UV coordinates on each vertex. Then if you render your cube using a BasicEffect, as in the tutorial you referenced, this would be when you iterate through the mesh's effects...

foreach (BasicEffect effect in mesh.Effects)

you just need to set TextureEnabled = true and Texture to your loaded texture content. See http://msdn.microsoft.com/en-us/library/bb464051.aspx, particularly step 4.

\$\endgroup\$
1
  • \$\begingroup\$ Yup, this was the response. To anyone who happens upon this question in the future, an excellent Blender 2.6 tutorial for this task can be found here: link \$\endgroup\$ Commented Mar 16, 2013 at 18:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .