Building amazing 3D models is just a part of making digital scenes look real. Models without textures are the same as having black and white picture of a beautiful painting - you may see the shapes and forms, but have no information on the colors. In 3D environment, before you apply texture to the model,, you need to create UV mapping which will define the way of displaying any image file you"d like to view on the actual 3D surface.
To quickly give you the basic understanding what's UV mapping all about, try imagining a candy wrapped in a paper. This paper will probably have some kind of label and graphic imprinted. You can imagine how hard would it be to print the graphics on the paper while being wrapped on the candy - what you'd normally do would be "unwrapping" the paper so it;s plain and straight and printing the graphics only then.
In short, this is exactly what UV mapping is all about. Before you put a texture on any object in 3D space you must make its geometry perfectly plane. This is because texture images are just a flat, surfaces and every 3D shape has to be transitioned to two dimensions as well. It may seem a bit confusing but try recalling geometry classes you had in school. You probably did an excessive with building a paper cube model and drawing its "mesh" before cutting out? This is another example of how UV mapping works.
With all that being said I'm sure you'll now follow the techniques I'm using in Blender to UV map 3D models so they display various textures correctly. Before we continue I'd like to mention that again, I won't be covering how to UV map all the scene elements as it would take too much time. Instead, I'm focusing on the main techniques and these can be easily implemented in almost every environment or element.
The fastest way to start will be just adding the most simple objects and trying to UV map them. Create basic cube and enter Edit Mode. Select all the faces and hit "U" button. An UV Mapping list will pop up and you can see many different mapping methods available in Blender. Select the first one from the top which is Unwrap. As you see, nothing changes in 3D viewport since our UV map will be displayed in other working space. Open UV/Image Editor and see how your newly generated UV map looks like.
Right now I won't be describing shader creating process in Corona as we're focusing on correct scene preparation. If you'd like to read about that straight away, please move to Part 5. When working with Corona it's a good habit to export any changes applied to the scene geometry, including material modifications on your 3D meshes.
Project From View is very easy and fast method of mapping your geometry. What it does is "projecting" the current viewport situation to UV/Image Editor. No matter if you're in Perspective or Orthogonal View, Top, Side or random camera position - Project From View will always map what's visible in Edit Mode.
Let's now UV map something relatively simple - ground, floor plane in our interior. Hide all elements and leave the floor only. Switch to Top View and enter Edit Mode. Press U and choose Project From View. Let's see the update in UV/Image Editor and check if anything changes after loading the image texture. As you can see below, our UV mapping has slightly deformed and that's because the projection was done for default, squared size map layout. For instance if we had 4096 x 4096 texture map, no deformation would appear. To fix this issue, just Project From View again.
Everything seems to be correct but it would be nice to have a preview of our mapping and texture in 3D viewport. To do so, we need to create a basic Cycles diffuse shader. Add Image Texture node, connect it as a color input and load the wooden texture file. After that, you just need to change the Viewport Shading mode to Texture.
As you can see, wooden planks are way too big and we need to scale them down. You already know 3 basic transformation types: (S)caling, (R)otating and (G)rabbing - all of these work in UV/Image Editor as well so simply scale up our UV map so it looks correct in the viewport.
Another thing worth mentioning here - I personally prefer doing all UV mapping operations on the actual image texture that will be applied on the final model,. To preform UV map scaling beyond texture's 2D layout borders you'll need a tileable one. You can either download the floor texture used above or use some of the textures included within our free model samples. Just log in to your chocofur account in the upper navigation bar and browse the free files.
In this step I'll describe another very common and probably most recommended method of UV mapping which is Unwrapping. This is the method most closely related to the candy and box examples described in the introduction to this tutorial part. Since candy paper isn't this hard to map as a plane object (we could even use Project From View method), for box model we'd need to specify where exactly should it be "cut" so the geometry can be unfolded and flattened to 2D surface.
As you know from the previous step, we can only UV map geometry selected in Edit Mode. This can be very helpful in Unwrapping more complex shapes as we can simply select the parts we need, hide them after Unwrapping and continue with the rest of geometry. Take look at the example below:
Another way of Unwrapping is adding seams to the geometry. This method precisely specifies where the mesh should be cut though by the Unwrap tool. The main advantage of adding seams is that whenever you decide to Unwrap the model again it will preserve its previous UV mapping. This won't unfortunately occur if we just Unwrap the model by selecting the faces as in the previous example...
Here I would like to quickly describe two other UV mapping techniques I personally use. One of them is Box Projection method. What it does is kind of automatic unwrapping basing on the model's X, Y and Z axes. It's also similar to applying Project From View on the selected faces but from top and sides simultaneously. The results are pretty good, especially on the objects that aren't this much exposed to the camera and we don't want to spend too much time on mapping them precisely.
Second and similar method is Smart UV Projection. The difference lies in generating the UV mapping basing on the differences in model's face angles. You can also use it for not this important, background objects.
Let's now try UV mapping one of the free models available in chocofur store. I've chosen Paimio Chair as we will learn one more technique which wasn't described yet - pinning and aligning in UV/Image Editor. I will focus on describing the main furniture element which is a bent seat. All the other parts can be mapped exactly the same way.
Start with adding seams along the main edges, separating the seat surfaces from the sides. Repeat on the openings in the upper part of the mesh. If you switch to Face Select mode and hit L button pointing your mouse cursor at any surface - you'll select the geometry separated by seams. Use this to select two main surfaces and Unwrap them. Next, add additional seams on the remaining side elements. Cutting them in one place won't be enough as the generated map will be very long so I suggest adding 2 cuts around the corners. Unwrap these elements as well.
Now let's focus on the UV/Image Editor and learn a bit about Pinning. Blender enables us to "Pin" selected UV Map vertices to the 2D space layout and edit the rest of the UV map around it. May sound a bit confusing, but the slideshow explanation is available below. As you can see, the UV map of the side elements, generated by default is bent in both axes - this would be very hard to map correctly. The real furniture piece would have straight, wooden lines following the curvature. What we need to do is editing the side UV maps so they're straight and even both in X and Y axes. This is where Pinning comes to action.
Select one of the side elements and hide the others (Shift + H) for better preview. Enable the "Live Unwrap" option in UV/Image Editor from the UV menu. Select vertices on one of the endings and press P. You'll see red dots appearing - this means that current selection has been pinned to the UV layout.. Rotate pinned vertices so they look straight in Y axis. You should see the rest of the UV map following the rotation. Now select the vertices on the opposite end and repeat the process. The UV map will get very distorted while rotating the points but don't worry - try moving them to the other end of what should soon be a straight and even UV map of the side chair element. For better editing select other vertices in the middle of the element, Pin and aligning them straight as well.
As you can see in the slideshow above, what needs to be done is the UV point alignment. Turn off Live Unwrap and select the upper vertices by Alt + Right clicking (same as edge loop selection in Edit Mode). Press W and align the selection in Y axis. Repeat this step for other loops until the whole element looks straight.
Using these techniques allows you to UV map all the remaining parts of the chair. What I usually do by the end is selecting everything in UV/Image Editor, applying uniform scale by Alt + A, "packing" the elements next to each other by pressing Alt + P and finally scaling the whole layout up a few times so it looks good in the viewport.
Before we end this tutorial part, I;d like to give you a few more tips on Unwrapping more organic models like sofas or couches. Using the methods described above you should have no problems with Unwrapping any furniture model like chair, table or sideboard. The aproach you need to take with sofas or couches is a bit different but in my opinion easier to adapt. What you actually need to do is creating the Edge Seams exactly where they would appear on the real furniture. As you know from the introduction - UV Mapping is 3D geometry projected to 2D surface. With sofas and couches It's actually the same as real life - you get a plain, fabrics and "wrap" them on the furniture frame. The fabric has to be cut and sewn so the seams are visible. This gives us an idea how we could repeat the process in 3D environment.
Below are few examples of furniture models I've prepared for chocofur store. As you can see, Edge Seams are placed where they would actually appear on the existing furniture. Best results can be achieved when you also rotate each UV map so the texture follows the fabric direction.
To conclude this tutorial part, I think it would be good to compare all the UV mapping methods we've learned. Each one of them has its advantages and best use scenario so choose what's the most suitable for you.
As always the best and fastest way of learning each method is just trying it by yourself. You can download some of the free models from our store and practice the techniques on existing furniture examples. Of course you can also buy some models if you find this tutorial helpful and would like to donate for our further development :)
Good luck and happy blending!