Lithunwrap Tutorial

  • Uploaded by: om
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Lithunwrap Tutorial as PDF for free.

More details

  • Words: 5,270
  • Pages: 45
UV MAPPING IN

LithUnwrap (A simple tutorial, part I)

by

OM

e-mail: [email protected]

INTRODUCTION LithUnwrap is a nice software for UV mapping a 3d model. There are many others to do the same but the good thing about it is that it is free and thus a good choice for the beginners and for those who wants to get the heck of UV mapping and texturing. If you have not got the software already, it can be downloaded from sharecg.com http://www.sharecg.com/v/5169/Software-and-Tools/LithUnwrap--Free-UV-Mapper-for-Windows It has small size of just 633 kb, and comes as a zip file. Just decompress it to a folder and double-click the unwrap.exe file. In my windows xp, it works fine without any hitches. But, I can not say about other OSes. Using the software gets a little tricky for those un-initiated in 3d modeling. I had trouble when I first used this software as I was a total novice and the interface did not mean much to me beyond those ‘file’, ‘edit’ menu buttons. I did the next obvious thing, that is to click the ‘help’. Unfortunately, there was nothing helpful in the ‘help’. Then I opened the example files, but they did not explain it. So, I had to search again for some help in the internet. But, there was very little help on this software till 3 years back. Recently, I tried and it did throw up few tutorial and help links. Link to those are given in the end of this article. But, before going into any details about LithUnwrap, we need to know a little basics about 3d modeling and texturing. If you know much already you can skip the next section altogether. But, if you are as novice as I was 3 years back, you should know this, then you can understand the principles of working of the software easily.

EXTREME BASICS [This part is a short description about the very basics of ‘3d’ in computer graphics. You can skip this section as you may know this already.] A ‘3d model’, in computer graphics, is nothing but a series of numbers. A point in the virtual space of CG, is called a vertex, is a set of three numbers in the x-, y- and z-co-ordinate in the 3d space. A 3d model is the numerical expression of how those vertices are to be joined, whether to form a plane (‘face’ in 3d CG) between them or not. A vertex can have a color, and thus it is possible to make 3d models entirely consisting of vertices with different colors to add detail to a 3d model. But the number of vertices will be too much and so the required computing power. Thus, making it almost useless to most of the uses of a 3d model. So, what they do is- wrap an image over the 3d model to add detail to it without increasing the number of vertices. The image wrapped over 3d model is a texture. Now, another question arises is how to wrap the image correctly, so that it falls over the right places on the model. The information about how to wrap a texture on the model is called UV mapping in technical terms. LithUnwrap does this task for you while giving you options to do it correctly. ‘UV mapping is a 3D modeling process of making a 2D image representing a 3D model. The map transforms the 3D object onto an image known as a texture. In contrast to "X", "Y" and "Z", which are the coordinates for the original 3D object in the modeling space, "U" and "V" are the coordinates of the transformed object. This creates the effect of painting the image onto the surface of the 3D object.’ (from wikipedia: http://en.wikipedia.org/wiki/UV_mapping) Simply saying: UV mapping is flattening a 3d model twodimensionally with information about where to place the points in the 3d model on the flat map. As the map is flat we need only two dimensions (U & V) to denote a 3d model. Now, there are complex UVW maps, but we are not going into that.

UV Mapping types UV mapping as already discussed is simply flattening a 3d model on a flat surface, and putting a flat (2D) image on the flat surface, which will be rendered by the computer on the model. And it can be done in various ways. To understand, consider we want to flat out a box. We can cut out each side of the box separately and put it on the table like the following picture. And we can paste an image on the flat surface. This is one type of UV mapping, and is know ‘box’ mapping. Or if we cutout every face and flatten them on a surface we will get ‘face mapping’. The first image below is a face map of the pyramid shown above, and the next one is the box mapping of the same.

(image: face mapping and box-mapping of the same pyramid)

Above is the box mapping of the model of the pyramid in the last section. Hence box mapping will have six sides. We can map all images in the same way, but it is not necessary, sometimes it is unnecessarily cumbersome also. Suppose we want to map a double-convex surface like a pillow or a bi-convex lens. To map something like a lens, it is simple enough to create the maps from the front and the back side. And paste them over the model. This is planar mapping, because here we reduced the model to two separate planes, and for the purpose it is convenient and easy enough. Depending upon the need we can make the planes from any side, not necessarily front and back; it can be top-bottom or left-right.

(Image: This is the planar and cylindrical mapping of the pyramid) In cylindrical mapping, which is used for structures like a barrel, the round top and bottom are separated and the body of the cylinder is rolled out on a flat surface. The image below explains it pretty well. One of big problems in real life situations is to flatten a sphere, as apparent from so many methods of how to draw a good world map! But for the CG, there are some laid out ways to map a sphere. I am not going deeper, but I would show the following two images about how LithUnwrap does a spherical mapping. I hope this gives you some ideas.

(image: spherical mapping of the pyramid) [**There is one decal mapping, in which the image is simply pasted on the model as a single plane, it like pasting a sticker on a wall. Decal mapping is used for simple mapping purposes like showing bullet-hole on a wall.] Camera mapping is another type of mapping in LithUnwrap. Here the view from the preview camera is flattened as a planar map on the window. There are various options given in each type of mapping. Hopefully, we will learn some of that in the examples. Meanwhile, you can always try them for yourself.

Enough theories, let us jump into LithUnwrap…

EXAMPLE 1: UV MAPPING A BOX Why, a box? Because it is somewhat easier. So, our assignment is to UV map a box. The box has LEFT, RIGHT, FRONT, BACK, TOP and BOTTOM written on its respective sides. What we want to do is: we will place textures on the each side of the box. In other words, we will UV map the box to place those textures correctly. We want to create a box that looks like this:

We will need: A. 3d model of a box. B. 6 image files that will go to the six sides of the box. In these image files we want the LEFT, RIGHT, FRONT, BACK, TOP, and BOTTOM written. C. Create UV map which will define the positions of these image files. That is exactly what we are trying to do here with the help of LithUnwrap.

Actual work: Creating the box: For this exercise we need to have a 3d model of a box. Any 3d modeling software is ok, and it should be in a format understandable by LithUnwrap. But, for this exercise we need not create it separately as LithUnwrap has some primitives included in itself and a box is one of them. We just need to go to File New Box. ‘New box’ dialogue opens up:

Do not change the options now. Click OK. [** Option details in the box, planned to be dicussed later.**]

You are presented with:

Now you have a box in LithUnwrap. The main screen of LithUnwrap shows you six squares with white edges inside a grey edged square. The big grey square is the whole map, inside which the six sides of the box are spread out. The six squares actually means the top, bottom, left, right, front and back sides of the cube. These six squares are the sides of the box as mentioned earlier. But they are broken in six sides because the mapping type default set for a box is ‘box mapping’. But… wait… Where is the box? You can see sides of the box laid out flat. But to see the box in 3D, you have to open the preview window. Preview Show model will show you the box.

You see only a grey cube as the above image. It is non-textured. To learn more about preview window, check the preview window section later in this document.

The images: We are to create the six image files. Any imaging software can be used. Windows Paint is adequate. A texture should have the sides to be a power of 2, that is 32x32, 64x64, 128x128 or 512x512. But LithUnwrap makes your life easier by stretching and scaling a nonsquare image to a square one. So, it is really not necessary to make the images square, but I believe it is a better practice. Here are our images

UV mapping the model: Here is the real work that we are trying to learn.

STEPS FOR UV MAPPING A MODEL

1. We need to create the materials first where we want to use the images. 2. To assign the material to the model. 3. Some minor corrections. 4. We are done!

Creating the material: Before being able to map anything on a model we need to have a material. For this particular assignment we need to create six materials with the images which later will go to the model. Create a new material by clicking Materials Modify.

Click Add, in the ‘modify material’ dialogue box.

A new dialogue box ‘Add Material’ will appear asking for description of the material. Give an easily identifiable name to it. We give the name ‘top’ to this material as we intend to use it as the material going to the top side of the model. Click OK.

You are back in the ‘Modify Material’ dialogue box.

Select the new material ‘top’ by clicking it and then click Properties. Dialogue box for the ‘material editor’ will open.

The first tab is Properties, with some editable options, but we are not going to change it now. Click the second tab that is Maps. We want to do some modifications there. [**ALTERNATE way to create a new material]

Click the ‘map type’ drop down menu and select ‘bitmap’ in the diffuse map section.

Now click ‘Properties’ just below the dropdown box. ‘Diffuse Map Properties’ will open.

In the next dialogue box click Change. The ‘open file’ dialogue box opens.

Go to the folder where we have saved our images. Now, select the image that goes to the ‘top’ material. In this example select the image top.bmp, as we want to use this material for the top of the box.

Now click OK.

Close the ‘Diffuse Map Properties’ dialogue box. Close the ‘Material Editor’ dialogue box by clicking OK.

Close modify ‘material dialogue’ box by clicking Close.

Unfortunately there is nothing that shows up anywhere in the main window. But, the program has actually created a material named ‘top’ with the image and stored it nicely for our use. But, it is not yet visible because we are not asking the computer to show us yet. Click ‘View’ in the main menu, click Material…

The ‘View Material’ dialogue box will open to ask you which material you want to make visible.

There in the box all the materials that we have created are listed. Currently we have only one named ‘top’ for the obvious reason that we have crated only one material. Select the material and click Apply and your material is immediately visible in the window. To close the dialogue box click Close. If your material is not shown, go to Edit Material and see whether ’visible‘ is checked or not. If ’visible‘ is not checked you can’t see the material in the main window.

Now, what you have in the main window is a view of the material selected and the faces of the box we created as six different squares. Now see Preview Show Model and you will find that the box is still grey as ever, with no texture applied in it. Make sure, you have selected the textured view. It’s ok because till now we have only created the material but have not pasted it on the model. So, the box is not textured yet.

Assigning a material on the model We need to assign a material to the model in two steps. First, we select the group to which we want to assign the material and then, we select the material that we want to assign to the group. Then we tell LithUnwrap to assign the material on the model, and the model gets textured. So, let us select the group. A group is a combination of faces starting from one to all. For now, we have one group called ‘box’. We can create different groups from one group. But we are not going to do that. First, we select the group. Go to the ‘side panel’.

Expand the tree view menu ‘Groups’ by clicking it. It will show you one group named ‘box’.

Right click ‘box’, then click select. The faces within the group ‘box’ will be selected and shown in red color in the main window. We are done with selecting the group. Now, in the same side panel, expand materials by clicking the ‘+’ sign.

Right-click over the material ‘top’ and click Assign. And you are done! Can’t believe me? Well then, let us check the preview. Click Preview Show Model in the menu bar. And you are presented with:

What you are seeing is the same box textured with the material we created just now. But, we are not yet done, because the mapping is not what we want as a final result. [Do not forget to keep the preview mode ‘textured.’ If you have forgotten, see the section about the preview window.] You probably have understood what has gone wrong with this texturing. To learn a bit more change the position of the group on the main window and see the changes in the preview window. What actually we have done is that we have mapped the material ‘top’ on the whole cube. As a result, we see parts of the material on each side of the box. We need to correct this. But, first we want to see what else we can do at this stage, because though the mapping is right, still we are ready to manipulate the UV map that too with feedback. Now look at the second tool bar which starts with a reset all button and ends with a familiar help button. Just hover your mouse cursor over the button and you will know the button’s name.

Familiarize yourself with the following buttons..

Reset all Rectangle selection Lasso selection Select mode Move freely Zoom freely Select by vertex Select by face Select by group To manipulate the map on the box, make sure you are in the ‘Select mode’ and ‘Select by Vertex’.

then click one of the corners of the squares.

The purple marked small squares are vertices. To select a vertex just click on them, to deselect click anywhere else. Now, select a vertex. Bring the preview window to the top of the window by checking Always on top (See preview window section). Rotate the view to show you the side you the corresponding side. You can know it because the selected vertex in the main window is coloured red in the preview window. But you have to be in the ‘TexturedWire-Flat’ or ‘Textured-Wire-Smooth’ mode. Move the selected vertex in the main window by left-press and move. The immediate effect on the mapping can be seen in the preview mode. So, change the view as you like it.

Till now we have assigned the top material to all the sides of the box and that too in parts. By selecting and expanding each side face of the box we can map the same top material perfectly in all sides. But, even then we are not done with our assignment. Tip: Can we really do that at this point? Yes, we can. Some clues: we need to just one image with all the sides and then place the respective faces there itself. Check the alternative approach after this tutorial to know it. [**Alternative approach to be written] But, we want to complete our assignment by a complex method, because our main aim is to learn UV mapping. Then let’s move on: Go to the Materials Modify and create five more material for each side of the box and give them appropriate names. I have created bottom, right, left, front and back; these fie materials. These materials have the same name images. (Refer to step 1)

Now in the side panel you will see six different materials with names top, bottom, left, right, front, back. We are going to assign each face a their respective material in the next few steps.

Select the left upper most face in the main window. Go to the side panel again. Expand the Materials, right-click over the material left, click Assign. We have assigned the material ‘left’ to the left side of the cube. How do we know that we have chosen the left face? LithUnwrap in the box-mapping mode, maps the sides as below: LEFT RIGHT

TOP BOTTOM

FRONT BACK

So, we can know which side will go where. To check it, you can open the preview window and you will notice that the right side of the cube is mapped with a different material than the rest.

See preview and you will see the following in the preview window. Here the left side of the box is mapped with the material ‘left’.

So, similarly, we will assign six materials to six sides of the cube. Left to left, right to right, top to top and so on. And we get the following view in the preview window.

But materials are not mapped appropriately, they are broken on the surfaces. See above image. What is wrong with the mapping till now is that we are using a small portion of the image to map on the model instead of the whole image. See, the above image, where the top of the cube, gets only half of ‘O’ and ‘P’ as it falls on the material, see the image below.

To correct it we can move the vertices of the ‘top’ face to cover the entire material. Or we can scale the face. The next few steps discuss scaling a face. But for this exercise we have not used any scaling, we have used the expand option, which is described later. But there is no harm in scaling. So, you can try it without any fear.

Right click over the selected face that you want to scale, click Scale Free.

The selected vertices turn green meaning that they are ready for scaling. Left-click and drag the vertex and the face is scaled accordingly. The option arbitrary enlarges or reduces a face on percentage values.

We are not going to use the arbitrary scaling. So scale the face to cover the whole material by free dragging method as mentioned earlier.

Instead of scaling you can simply expand the selected face to do the same in a much easier way.

Right click the selected face. Click Expand All uniformly. Uniformly expands the face to cover the whole material area but aspect ratio of the face is maintained. Non-uniform expansion expands the face to cover the material without maintaining the aspect ration of the face.

We have expanded the face to cover the whole material. Do the same with all the other faces. Now, let us check what is happening in the preview:

Aha! We have done it the way we want it. If you want to do minor modifications, you can do it by moving the vertices. In this simple exercise, there is nothing much to correct though. Now we have to save the work. Funny that there is no save button in the ‘File menu’! But, don’t worry! It is there.

Go to File menu, then Model Save and you can save the model in any of the formats there and your model properly UV mapped will be saved. But remember, to see the model textured you need the texture (image) files also. The textured model knows the folder where these files are, but if you want to upload or use them in another computer, it is better to save them in the same folder of the model, and copy paste the whole folder so that the textures remain intact. Best practice is to create folder for all textures and keep the folder inside a folder with the 3d model. Well, I think this is enough for our assignment of UV mapping a texture. I know I made it very long. But, I remember how awkward I felt in the initial days of working with LithUnwrap. So, I thought it would be better to be more elaborate than to be too concise to understand.

I personally think it is better to understand the principles of how a software works, and understanding the steps involved. Then it becomes easier to remember and work and it becomes easier to experiment. Because you know what to expect and what might be go wrong. In the next part, I would like to UV map a human model and for that I would like to use a slightly different method than this. Alternative way to do the same exercise We can achieve the same result as above, by taking a simpler approach. Here we create one image with all the sides on it, like:

Then we create one big material and assign it to the box.

Then we resize the faces by selecting them one by one to fall in the right place. After resizing the faces look the following:

Check the preview and you are done. Drawback of one big UV map is that you loose out in details. As, the texture detail is low in such one image. But it has the advantage of having a small texture file size, thus less resource hungry. You should balance the need for detail depending how the model is going to be used.

The preview window The preview window in LithUnwrap is the one of most important tools. This allows you to see the model in 3d. To open the preview, go to the PREVIEW Show model. And a new window will appear which will show you the 3d model in its 3d form. If you right click on the preview window, you have options to change how the 3d-model is shown. Even before you right click there are things you can do. Click left mouse button and drag inside the 3d preview window to rotate the view. The mouse wheel zooms in and out in the window. The rotation is only possible while the view is in ‘3d Perspective View’, not in ‘Orthogonal View’ or any other Orthogonal View. The current view is mentioned in the window caption like: ‘3d Perspective View, Front Orthogonal view, Top Orthogonal view’ and so on. In the Orthogonal view left click and drag moves the scene side to side and up and down. Pressing ‘shift’ key and left click and drag up zooms in the view and drag down zooms out the view. Mouse wheel acts as the zooming tool. ‘Ctrl+left-click and drag’ moves the view side to side in ‘3d Perspective View.’ Press key-s, and you are in the selection mode. Left click on a face and the face is selected, hold Shift and left click to add to the selection, and hold Ctrl to remove a face from the selection. Press key-s again, it will lock the selection and also brings you out of the selection mode. This selection mode is a very usable tool. You can not do anything in the model by selecting them, but what is great is that, once you select a particular face in the Preview window the corresponding face is selected in the main LithUnwrap window. Thus we are able to find which face in the main window corresponds to which face in the 3d model. Right Click on the preview window gives us additional options.

Options in the preview window. The window caption tells you whether the current mode is perspective or orthogonal view. If it is in orthogonal view the side of view is also mentioned as ‘Front Orthogonal View’ for the front

view and so on. Next is the 3d architecture used for rendering the model. In my screenshot it is OpenGL. On the status bar there is some quick tip to navigate the view-port. Once you go into the selection mode by clicking ‘s’, it shows the options in the selected mode. On a text-box to the right side of the status bar, the current viewing mode is written. Tex+Smooth+Wire means the current viewing mode of the scene is smooth textured with wire-frame superimposed. This viewing option can be changed by right clicking on the window and selecting the view mode. When you right-click on the view-port you are given the following options. I represent it again in a hierarchical manner for easy reference. Reset View : Just resets the view to the original mode. Always on Top: Keeps the preview window over the main LithUnwrap window, thus making it easy to see and work. Undo: Does exactly what it is supposed to do. Redo: Does what it means. Auto Rotate: Off by default. To turn it on, go to the submenu and click CW for clock-wise rotation and CCW for counter clock-wise rotation. The frames per second for the rotation can be set by clicking ‘Set FPS’, and entering the value in the dialog box that opens. You can see the actual FPS by clicking ‘Show FPS’. The next section of the menu, is very useful for working in the LithUnwrap. Texture: Clicking this will activate texturing of the model. If a material is set to the model it will be shown instantly on the model in the window. There are options to texturing. Flat: Texture is applied flat without smoothing the edges. Smooth: Texture is applied on the smoothed out model. Wire Flat: Wires are visible over the flat textured model. Wire Smooth: Wires are made visible over a smoothly textured model. I find the last two options very useful to manually adjust the material. Also the models selected faces are visible only when the view is in these two modes.

Wire: Model is shown in wire-frame mode without the texture. Additional options flat shaded and smooth-shaded. Flat: Non-textured flat-shaded view. Smooth: Non-textured smooth view. Texture Filtering: Clickable on and off option. Texture filtering is the method used to determine the texture color for a texture mapped pixel, using the colors of nearby texels (pixels of the texture). In short, it blends the texture pixels together by breaking them up into tinier pixels. Another term for texture filtering is called texture smoothing. Click and see the variation. Hide: By using this and selecting the group you want to hide, a group in the model can be hidden from the view. You need to click apply after selecting the group. Clicking close button closes the window, does not hide the group. You can hide all by clicking All and so on. Unhide: Unhides the hidden groups. Dialogue is similar to the hide menu item. View: Click and then sub-select the view requiredperspective or orthogonal. Selecting an isometric view is also possible. Select: Is used to select a part of the model. Selection can be done for all, none, or inverting the current selection. Selection can be based on name of the group part, view or material wise or bonewise. Best thing about selecting it in the preview mode is that the corresponding map vertices are also selected in the main LithUnwrap window, allowing us manipulate vertex by vertex. When you select Faces, you go into the face selection mode. Or you can simply hit ‘s’ and go to the selection mode. Turning on the ‘select back faces’ select the back face too. Show: Just click and select the options to see what it does. I did not find any use for this in UV mapping except that sometimes back faces remain on the model which are not textured properly and appears black. Turning off back face clears these. But to remove the back faces from the model you need to use the 3d modeler. I am going to skip the next options as they are of no use for the mapping we want to do for this tutorial.

Selection, movement, zoom, scale You can enlarge the face or move the whole face, by first selecting the face through ‘Select by Face’ mode. Here on clicking a vertex the attached face is selected and the whole face can be manipulated then. Last mode is ‘Select by Group’ and as the name it selects the whole group and changes the whole group. The move freely button, allows you to move the whole window up-down or left-right and zoom freely button when clicked, zooms in or out with left-press + mouse movement. Try it to know. Remember that three buttons changes the behaviour of your selection. Rectangle/ Lasso selection, you have to be in the select mode, and last three buttons allows to select vertex, face or the group. After selection you can move a vertex or face or group by left-click and mouse move. Or you can scale them. To scale a face or group, select the face or the group or the group of vertices, then rightclick scale free to scale with mouse, or to do it in percentage, scale arbitrary. To enlarge a face to the whole map, simply right click expand uniformly will enlarge the face keeping the aspect ration intact. Non-uniformly will scale to the whole map, horizontal and vertical do what they mean. Play with them now.

Saving Remember though that LithUnwrap does not ask you to save your work once you close the window, so remember to save it. Secondly, when you open a new primitive or a model, LithUnwrap does not ask you what to do with the old one and simply discards everything. So, you must remember to save your work.

Creating new group (To be written)

Creating new material (To be written)

Related Documents

Lithunwrap Tutorial
June 2020 9
Tutorial
May 2020 17
Tutorial
April 2020 17
Tutorial
May 2020 14
Tutorial
May 2020 27
Tutorial
November 2019 34

More Documents from ""

Lithunwrap Tutorial
June 2020 9
Lluc I Om
May 2020 12
The Post Office
May 2020 11
June 2020 2
Barroco.docx
November 2019 13