Creating a Simple 3D Game with XNA/Quick and easy Texturing

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Preparing your Window[edit | edit source]

Before we start, split the window into two halfs by right clicking the top panel, and selecting split area.

And then change the right one to 'UV/Image editor' as below.

Texturing using UV unwrapping[edit | edit source]

UV unwrapping is, as the name suggests, taking the model and selecting the edges which would allow you to unwrap it. When this has been done, you can apply a texture to it. The best model for this to be demonstrated on is the eyes, as only one cut is needed to split it up. Select each of the edges on the outside of the eye, from the side to the top relative to the front of the body (the easiest way to do this would be to maneuver the camera to the side, push b to allow you to create a box, then selectall of those edges in the middle),

then ensuring that only the middle lines are selected, push space, and select 'Edit/Edges/Mark seam'. Next, select all of the model, and push 'U', and select unwrap. You should see an unwrapped wire frame of the right side of the interface, which will provide the basis for your texture. Save this wireframe by selecting, on the bottom of the right window (under the newly unwrapped UV image) and select 'UVs/Scripts/Save UV Face layout'. This will save your wire as a PNG file, which can be opened and edited in windows paint (at least Vista onwards). Using this image as a basis, clear the wireframe, and draw an eye on the top half (you can find which of the wire effects what part of the model by selecting parts of the model and seeing what is highlighted on the UV image).

Apply the newly drawn image to the model by selecting on the UV window 'Image/Open...' and selecting it. You can see the effect of this by selecting the textured draw type on the left window as below.

Texturing using UV 'Project From View'[edit | edit source]

An easier way to do this, although allowing for less flexibility in your texturing, is by using project from view. To demonstrate this, maneuver the camera so that it is to the side of your main fish body in edit mode, select all of the vertices, and push U. This time select 'Project from view'.

With this, save the map as before, and fill it with the pattern of your choice.

Apply this, the same way as previously. What you should notice if you rotate your model now that the pattern is mirrored on the other side. This can make it unsuitable for more complex models, but for whats basically a sphere it is the quickest way to get a good result.

Next, do the same thing for the fins, applying a solid colour texture to them.