While creating the Tips&Tricks: Change script template for C#, UnityScript and Boo I needed a catching eye image to be displayed in the article header and for the rest of the thumbs. So I started a search on the net to get some inspiration and I was lucky because the first result in google search on images was this image in the right.
Now, the form is simple enough to be modeled fast but I wasn't sure if I am able to match the letters to the texture to get this dice kind of looking. I opened Blender and I was sure I am going to finish this in half an hour... top. We are talking after all about simple cubes... no biggie.
Well, I was right, but only 10%.
Modeling a dice is a simple thing, because of the shape: a cube. When you start Blender the default primitive added in scene is a cube.
I kept that cube and proceeded to transform it into a nice smooth letter dice. First thing was to add a bevel modifier to make the edges if the cube more soft (if you noticed, very few things have sharp edges in real life). Breaking the edge of the cube will make the bounce in another direction and as a result the edge will become softer and benefit more from specular light.
The next step is to add a Subdivision Surface modifier to get a nice and smooth face when rendering. As you can see in the image I set the Subdivisions for View and Render to 4 and most important, unchecked Subdivide UV's (which is checked by default). If you let that check in place like I did first time, when you are going to map the texture to the cube, the letter is going to be distorted. Since we need to unwrap the model to place the letters in right position and we are not going to apply the modifiers the seams will be place on the low poly mesh and keeping that check will distort the texture mapped on the low poly.
The beauty of a cube is the fact that we can place seams very easy on it. I am going to unwrap it on a cross position and keep the top quad in the middle so we can have a reference of cube orientation. Split the main window in two by dragging the small hashed tool-tip on the upper right corner and switch to UV/Image editor. Add a new image by clicking on the plus button for the image browser control in the bottom menu. If you dont know where they are, don't worry, I am going to highlight them on the image. Notice the seams, if you want the texture to unwrap in that position, you need to place the seams as I did. Is doesn't really matter but I like the texture to make a little sense. This habit might help you latter when working on complex shapes, because you might want to tweak (or even create) the texture in a 2D program.
Next, On the Properties window click on Mesh tab and add a new UV map. I called mine letter, because we are going to use this UV map to actually map the letter on each cube face. Select all the faces of the cube in 3D window and unwrap them on newly loaded image from disk. I've made a transparent png image of the letter T, because we are going to use the png file to paint the letter on the cube. After loading the image is better to unwrap it again.
Place the middle quad on the image and scale it in such way that it covers all the image. you don't need to be pixel precise but is good to scale it as perfect you can. The rest of the quads will have the same image because Blender is recalculating the outside pixels in the 0...1 texture space (in case you didn't know a 3D pixel is mapped on a 2D image in 0-1 interval; this is reason you can cover enormous models space with a texture with only 256x256. It comes with a downsize because no texture is really seamless and you look from distance at the model textured this way it show a repetitive pattern).
Now, as you can see when doing this, there is a problem. Not all letters are aligned correctly, especially the sides of the cube display the letters in a wrong position (we try to make the letters on the sides to display in a natural position). This is easy to fix: select each wrong quad on 3D and go to UV/Image editor and rotate it in 90 degree increments until it display the letter in correct position.
To be able to see the texture on all sides of the cube is better to delete the default light, or if you already set a complex light system, move them to another layer and make it inactive.
Another tip&trick is to close the display of modifier in real time (the eye icon on modifier header near name) when matching the texture. I found it much easier to work this way. Also is a good idea to see now how the Subdivide UVs from subsurf modifier distort the texture (or unchecked if you didn't).
Now, you can consider texturing the cube a finished job and to point it is enough. The cube is a simple form and arranging the faces to match the texture is easy. But that's only the cube case not the case for more complex models, real life models where, for example you might need to draw a sign or an poster and you don't want to create a real model for it. The way we are doing the cube texture will teach you how to do that.
The next step is to bring the letter texture to the main texture. We are going to do this by project painting the letter texture from letter UV map to the main texture.
One minor detail: the cube is going to be red with white letters. Our texture is now black because this is the default color for new textures added in UV/Image editor. We could have created the texture with a red color but i didn't think of this at that time. No problem, we can fix that in many ways: one is to save the texture like it is now, and add the color in a 2D program then reload the texture. But is too much work this way, so I am going to paint the texture directly in Blender. To do this, in UV/Image editor window in the bottom menu, switch to Paint in the little window where it says View, press N to bring up the left toolbar and choose the Brush from brushes :). Under Brushes window you'll see 2 sliders, they control the size of the brush (hot key F) and the strength of the brush (hot key SHIFT+F). Choose a size and make the strength full, then apply the color you selected on the texture.
Now you are ready to paint the letter on the cube.
Switch to the 3D window and choose from the bottom menu Texture Paint mode (little window where is says Object mode or Edit mode). From the left toolbar of 3D window (if the toolbar is not open press T) select the Clone brush. Set the strength to 1.00 and move down in the toolbar until you find Project Paint panel. Check the Clone from UV Map and choose letter UV map. An important thing to do before start painting, make sure the main UV Map the one associated with our red texture is selected, otherwise you are going to paint on the letter texture making a mess. If that is happening, don't worry the fix is easy, just go to the Image in the UV/Image editor menu and reload the letter texture.
If all those are set, proceed to paint the texture on to the cube. If you worked correct the letter is going to appear on the main texture. Neat :)
One more very important thing: SAVE as often as you can remember. Also, take note on the fact that saving the .blend file WILL NOT SAVE your texture automatically. For this to happend you need to be in UV/Image editor and press ALT+S or save the image from the bottom menu.
Now lets add this texture to the cube material and do a render. In properties window, go to the material window and change the name of the default material to something meaningful. I choose T_mat to reflect the fact that is the T letter. You can play with diffuse, specular, shading, mirror and surface scattering to get a render a bit close to your reference image. I am going to use the default values, for this tutorial are more than enough.
After finishing here, we need to bring the texture we just created to display on the cube not only in 3D window, but also in the render. Go to the Texture panel on Properties window and select the default texture (if no texture is present just add one). As a type select Image or Movie and scroll down to the Image panel. Now, go to the the disk location where you saved the texture created earlier and open it. It should appear in the Preview panel. After this, move down and find the Mapping panel. Here change the Coordinates to UV. map to UVMap and Projection as Flat. This will wrap our 2D image on to the cube the same way a game engine does.
One more thing to do, scroll down to the Influence panel and make sure the Color is checked under Diffuse. You can uncheck everything else. We are only interested to influence the color of the pixels, but if you have time to experiment, fell free to add more textures and use them to influence the rest of the properties.
Part 2: Lights setup, ambient occlusion testing and final render.