svxtc

Does anyone know of any sites where I can find out how to texture a model and then export that texture to be used in XNA I am new to modeling and any help would be awesome.

Thanks in advance.



Re: XNA Game Studio Express Model texturing

Richard Kain

You're not providing enough details. The process for texture mapping a model is going to be different depending on what application you are using. You don't map a model the same way in Maya as you do in 3DS Max. (despite the fact that both programs are now published by the same company)

Most programs do have some basics that they usually offer, though. Your mapping technique is going to be largely dependent on the nature of your model. If your model is fairly organic, that is to say, it is smooth and seamless, you'll probably want to use a pelt-mapping technique. This is where you mark off certain edges on your model, and then let the program define the mapping coordinates based on these pre-determined edges. This is a very fast method and usually provides nice results with seamless models. Most of the major applications now support this method, as well.

If your model is broken up into distinct parts, you may want to go about your mapping differently. Say you were making a robot character, for instance. Such a model would have many distinct sections, and probably a lot of flat planes. (that you would want to keep flat) A different mapping technique would probably be better. Deriving the mapping coordinates from an orthographic viewport for each separete section, for example.

Then there's also level editing. If your model is going to be used as an environment/level, you're going to want to map it with repeating textures. This is also handled differently.

As to exporting the texture Most applications have a feature that allows you to save the UV mapping coordinates to a pixel image. (once the UV coordinates have been defined, naturally) Once you have this UV-map image, you can take it into a paint program and doctor it up however you like. Once you have it painted the way you want, you should export it in a format that is compatible with XNA's content pipeline. I'd either suggest a PNG file or a TGA file. If you don't care about having an alpha mask, a JPEG would also probably work fine. XNA handles most of these formats without any issues. If you do run into problems, you can always download the DirectX SDK and use some of the texture-formatting tools that it comes with. This will allow you to convert your texture into the DDS format, which is specifically designed for DirectX, and works fine with XNA. This step should be optional though. I've personally never had any issues importing textures directly to my projects using XNA's content pipeline. I generally lean towards PNGs. They have some very nice compression options, and can still have transparent areas. I wouldn't bother with TGAs unless you need to have some really complex alpha masking.






Re: XNA Game Studio Express Model texturing

svxtc

Sorry, I forgot to mention that I am going to be modeling in Max. I am mostly interested in modeling buildings at the moment and therefore they will have many flat parts. I was wondering how I would "paint" parts of the model so that other sections would look different. I know about UV maps but I don't think that you can limit them to certain parts of a poly mesh. Also, should I even be using a poly mesh. Like I said, I don't know much about modeling but have a pretty good understanding of what needs to be done. Thanks.



Re: XNA Game Studio Express Model texturing

Richard Kain

For starters...yes, you should definitely be using a poly mesh. I don't know of any game engines that are capable of rendering anything that is not a poly mesh. You can construct a model as nurbs, or subsurfaces, or patches, or whatever. But if you ever want to get a model into a game, you ALWAYS have to convert it into basic triangle polygons. So yes, you want to be using poly meshes, and knowing how to work on that level will help you greatly.

Secondly, yes, it is possible to limit UV maps to certain parts of a poly mesh. However, it is generally considered inneficient to assign multiple textures maps to different sections of the same model. As a general rule of thumb, you design each model to have its own set of UV coordinates, that don't overlap. Game engines are also much more friendly towards UV painting. You could go with vertex colors instead, but you would be limiting the potential detail. And unless you were willing to throw a lot of polygons at each model, you're buildings would look very blocky.

For your purposes you'll probably want to go with UV mapping and poly meshes. You can give each face on your building its own mapping coordinates, so it will be possible to paint something different on every single surface. There's no problem with that at all. If you want extra detail on specific parts of the building (doors, windows, etc...) you can just build those as different models, and have them inherit the main building's transformations in your code. (effectively parenting them to the main building)

Keep in mind that you are going to want to make things as modular as possible, so that you can re-use the same resources.

As far as 3DS Max is concerned, you're going to want to use the UVMap modifier, and the UVUnwrap modifier. The UVMap modifier will allow you to actually assign UV coordinates. The UVUnwrap modifier will allow you to Edit the positions of the coordinates you've already asigned.






Re: XNA Game Studio Express Model texturing

svxtc

So would I just use the UV Map modifier to set UV coordinates for one model And how would I do that



Re: XNA Game Studio Express Model texturing

svxtc

Also, one more thing. Is it possible to create a texture that changes or has reflective properties Is there something that I will have to add to in XNA to make sure that this displays correctly I was thinking of parts of the texture that will be reflective and other parts that will emit light. Don't know if this is possible.



Re: XNA Game Studio Express Model texturing

Richard Kain

Emitting light is probably not feasible. That would require some very complex codework. I'm sure it can be done, but probably wouldn't be worth the trouble. Lighting is one of the more complicated aspects of 3D applications.

However, "glowing" would be possible. When you want different affects on the same model, you just add an additional texture map. You can use multiple texture maps to define different aspects of your model's material properties. If you want certain areas to look glossy, and other areas to look rough, you would create another texture to define those areas. If you want some areas to be affected by the lighting, and other areas to be immune to the lighting, you create another texture map. Using this method, you can do all sorts of things with the materials for your model. For your "emit light" areas, you would probably want a luminance map. That way you can define areas of your model that will always be lit 100%, regardless of the lights in the scene. This will make it appear that they are glowing.

This method can be used in other ways. It's how you apply normal maps, bump maps, specularity maps, alpha maps, etc... And yes, you will probably have to add some coding to XNA to get most of these features to work. XNA might have some of the more basic ones built in. But even if it does, you will still have to define the textures, define the way in which they will affect your model, and apply them to the model itself.

To really get the whole "emit light" effect, you can add a light to the scene right in front of a defined "lit" area on the model. Use this in conjunction with a luminance map, it will look better. That will go a long way towards simulating the effect you're looking for. Of course, then you run the risk of adding too many lights to your scene. If you do add lights for specific areas of a model, make sure they are simple point lights that don't cast shadows. Adding shadow calculations for small environmental lights will kill your performance.