Texturing in XSI
This article needs to be cleaned up to conform to a higher standard of quality.
- 1 Introduction
- 2 Texturing Outline
- 3 Texturing Basics
- 4 Texturing in XSI
- 5 The Texture Editor
- 6 Texturing our Cube
- 7 Selecting Good Textures
- 8 Helpful Links
The aim in this tutorial is to introduce you to the world of texturing and explain how to work your textures into HL2 as well. It assumes that you have read the tutorial on the basics of XSI: XSI_Beginner_Tutorial.
In order to view your model in HL2 you have to texture it with at least a plain white texture, or else it will be purple boxed or not even show up at all! Here I will discuss the principles of texturing, what you should look for in good textures, and how to get those textures into HL2 and Hammer so you can actually use your model. I will assume you know how to make a TGA file and also how to compile it for Source using VTEX, if not GO READ THOSE TUTORIALS NOW!! I mean go now! The proper steps to texturing your model are as follows:
- Find a texture and convert to TGA
- Import into XSI
- Map texture onto your model
- Convert TGA to VTF
- Export Model, Place into Hammer, Compile, View INGAME!!
Whether you want to or not, it is essential to understand the basics of texturing before you even attempt to texture a model. Once you have that mastered, I can talk as little more freely, and you'll still be able to understand.
UV or Not UV That's The Question
The basics of texturing involve some simple math to map coordinates in a 2D plane to a 3D model. In order to do this, the 2D texture has its own coordinate system in the U and V axis. U is the horizontal axis and V is the vertical axis of your texture, and they both go from 0 to 1 (eg. 0.5,0.5 would be the middle of the texture). An object in XSI can only be mapped with ONE texture, as far as I know, so when building your textures you must combine several into one 512x512 image and use that for all your objects. If you download my water fountain you will notice that I did not do that, and that is because I figured out my mistake when it was far too late. I had already mapped it perfectly and I didn't feel like fixing it... I used a texture for each object, which is bad practice.
Normal Mapping and other Peculiarities
A bump map is a texture that changes the way light interacts with the applied surface, much like small bumps on an object in the real world. There are 2 types of bump maps. The old fashioned grayscale (black and white) and rgb normal maps. Bump maps(called height maps in some engines) change the depth of the rendered pixel (since we are taking about pixel shaders here), so its job is to give the illusion of depth. Height maps are useful for rivets, screws, gashes and stuff that isn't very complex. Normal maps are RGB(Red, green, blue) images depicting where there is change in the angle of the rendered pixel. This is much more useful for intricate details like folds, wrinkles, complex surfaces like faces and bodies, unlike height maps. There are several tutorials out there on how to make and apply normal mapped textures, but that is beyond the scope of this article. It usually involves creating a low poly game mesh and a high poly detail mesh, then UV mapping the low poly and baking the high-res model's polygon normals into a texture. I will say that you DO NOT apply a normal map in XSI unless you are doing it to show off how your model will look before compiling it.
Using Ultimapper in XSI for normal map creation
Ultimapper is the tool used within XSI for rendering out normal maps from a high resolution mesh for mapping onto your game resolution mesh. General workflow is as follows; create a group of high resolution objects that define the detail areas of your mesh, or create a subdivided refinement of your base mesh. If you're using more than one object to make a detailed mesh, use the edit: group command from the Main Command Panel (MCP). Once defined and selected, you can render out your tangent space normals, high resolution ambient occlusion maps for texturing, and any other material infomration you may need (in the albedo map). One note of caution, you need to invert the up and down channel of the resulting normal map to match the rendering inside of the engine. Open the normal map in photoshop, open the channel section in the layer window, then select the green channel. You'll now need to invert this channel(ctrl+I). Save this and re-export your vtf. (this refers to version 5 and up of XSI, previous versions use the "GPU surface FX" property, which functions in a similar manner).
Texturing in XSI
Now that I fleshed out some basics we can begin getting textures into XSI and pasting them onto our models! Follow closely and look at the images if you get lost, I know there was a lot of text before, but this will be good I swear.
Importing a Texture
I like to use TGA (Targa) files because they are compressionless and are the same format that will be used by VTEX to create the HL2 materials, therefore WYSIWYG. First we need to make the texture local to our cube so that it will display properly and more importantly export properly. 'MAKE SURE YOUR OBJECT IS SELECTED BY OBJECT!' Click Render at the top of the screen, go down to Get - Texture, then press Image. Click yes, now you are ready to start texturing (see Left Image). What you see in front of you is the XSI default mapping texture which is good to use if you are trying to see how certain sections of your model will map to a texture. Click edit next to the name of the texture (it should be noIcon_pic) at the top of the window (circled in the pic). This will bring up a new property window that you can use to change the image properties of this texture. Go to about the middle of the page using the scroll bar and where you see C:\somedir click the ... button on the far right (circled in pic) and find the image you want to use as a texture on your computer. Congratulations your image is now imported into XSI, click the little left arrow on the top of the current properties window to return to the Texture Map properties page.
Following the UV Textured Road
Having imported our texture into XSI (in the pic you can see it is a new image, and it should be different in yours too) we can now map it to our object. With your object you want to texture selected, press the NEW button in the UV Property section of the property box. Then go down to Unique UV's (polymesh) to create a UV mapping of our model's mesh for use with our texture, how exciting! Now to view our texture on our model, do what's depicted in the image titled Getting your view setup, in the 3D view. Now press ALT+7 to open the Texture Editor Window. As you can see, your object has been broken down into its polygons and laid out naked onto our texture! Now lets investigate the goodies at our disposal in the Texture Editor!!
The Texture Editor
So what have we done so far? We have taken the TGA texture on your computer and imported it into XSI. Then we created a UV mapping of our object. Now we have our mapped polygons laid out on our texture just waiting to be mated together in beautiful texturing glory!! Please follow along closely or else you WILL get lost and start crying.
In this box we have your basic select, move, and manipulate tools. The button on the far left is your select button and it will select depending on the settings you put in the upper blue box (more on that later). The next button is the move button, and will move whatever you click and drag depending on what is selected in the upper blue box. The button after that is the crop button and can be used to crop out your texture image. The last three buttons are for collapsing your selection into a single point, a horizontal line, or a vertical line respectively.
In this box are all the buttons you need to start off wraping your model onto the texture correctly. On the left is the linear wrapping button. Think of this as if you take your texture and paste it onto whatever surface you select. The second button is for cylindrical wrapping and is like taking a soda can and cutting it down vertically one side and pulling it apart into a sheet. This is basically what you are doing to the polygons of your selection (good for a soda can model lol). The third button is spherical mapping, and you guessed it, is good for mapping a texture onto say a basketball or something. I don't know what the last button is used for, but I am pretty sure it is complicated. **If you are going to texture a head on a human I suggest cylindrical mapping and make your head texture look like you tore their skin off from ear to ear and pasted it on your wall**
I only use two buttons in this box. The one with the circular arrows checks to see what you have selected in the 3D view and applys that selection to the texture editor, and the one with the horizontal arrows does the opposite. Very useful if you are mapping certain objects and it isn't selecting right in the texture editor.
First lets discuss the upper blue box. In this box you designate what things you want to select or move using the tools from the orange box. This is exactly like what you have in the modeling portion of XSI only it is in the texture editor. V is for vertex (funny they don't call them points here), E is for Edge, and P is for polygon. The lower blue box are the same things in the modeling portion of XSI in which you can Scale, Rotate, and Translate whatever is selected. Unlike the move arrow in the orange box, when you select one of these bad boys it applies to the entire selection.
Finally, in the green box are your commands for showing and hiding selections, just like in Hammer. Press the S button to show only what is selected. Press the H button to show everything not selected. Press the A button to show everything.
Texturing our Cube
Now comes the fun part, we are going to take our texture and apply it to our cube. As you can see I have spiced up my cube with some of the goodies described in my beginner tutorial, and this creates LOTS of polygons that a lame person would have to manipulate to get the texture looking perfectly. I will show you the secret to fast and effective texturing!
Back to the Texture Editor
Okay, so now that you know how to use the texture editor, lets exploit it's power! In the 3D view with ray-cast polygon selection, select one side of your cube. Now back in the texture editor click the linear wrapping button and select Best Fit. This will instantly place all four vertices of the cube side onto the texture at (0,0);(0,1);(1,0);(1,1) and make a perfect match! Try experimenting by selecting all four sides of the cube and doing cylindrical mapping, the results will be fun.
That about does it for mapping textures, its all about manipulating the polygons in the texture editor with the orange and blue boxed buttons in order to create the appearance you want.
Selecting Good Textures
All I can say about this is, SEARCH SEARCH SEARCH! Google image search is my friend, and it should be yours too. And there is no need for a direct shot when texturing because as we discussed before it's all about how you map it! The texture I used for the top of my waterfountain model is in fact a side profile of a waterfountain, I just stretched my polygons correctly over the texture.