Upload
claribel-lynette-daniel
View
213
Download
0
Tags:
Embed Size (px)
Citation preview
1
SE 313 – Computer Graphics
Lecture 11: Projection Painting and Merging Textures
Lecturer: Gazihan Alankuş
2
Quiz• Turn off monitors• Take out a piece of paper and a pen/pencil• 5 minutes
3
Texture painting with the clone tool• We have seen – Texture painting on 3D objects – Using Bprojection and the clone tool to use parts
of images on our models.• Clone tool demonstrated in Gimp
Cursor Start drag
Cursor mimics
drag path
Copies current location under
cursor
4
Texture painting with the clone tool• Great for using details in parts of images• Precise matching can be difficult to master
5
Texturing in Blender• While Bprojection and the clone tool are great
for collecting parts of your texture from different images, getting the whole texture of a model from an image requires more precision
• We will learn projection painting and merging textures for different points of view to create more precise textures
6
Projection Painting in Blender• The idea– Get photographs of the object from different
angles– Paint them on the object as different textures– Merge them together
7
Projection Painting in Blender• The idea– Get photographs of the object from different
angles– Paint them on the object as different textures– Merge them together
8
We will continue with our ice cream truck example
9
Getting the model ready for texturing• We will repeat what we did last week in the
following slides (slides 10-26)
10
Modeling a truck• The initial cube has material on it, remove it
and add a new cube
11
Modeling a truck• Press tab to go to edit mode. Hit A to select
all.• Press subdivide to add more vertices and
edges
12
Modeling a truck• Select faces in the front (multi-select with
shift) and do “extrude region”– If you do “extrude individual” they would be two
separate pieces
13
Modeling a truck• Select and move around edges and faces to
make it look more like a truck• Feel free to play with other mesh tools to
make it better-looking
14
Preparing for texturing• While it’s simple, we’re happy with our model.
Now let’s prepare it to be textured. You have to do these steps to put textures on your models.
15
Preparing for texturing• First we need to unwrap our model. This maps
the 3D model to 2D. Since images are 2D, this will help us cover the model with parts of an image. This is called texturing.
• Earlier in the semester we saw that we can mark seams in our model to unwrap it nicely. – Now we will take a more practical approach and
use automatic unwrapping
16
Preparing for texturing• While in edit mode, select all by pressing A
and making everything orange.• Click on unwrap to bring up its menu• Beside “Unwrap” there are many other
options. Select Smart UV Project.
17
Preparing for texturing• To see things better, on top of the screen click
on the layout button and select UV editing. This will open the image editor on the left.
• There we see where the selected faces are mapped. Since we selected all, we see them all.
18
Preparing for texturing• While the unwrapped model is a bit
discontinuous, we do not care. We will draw on the model itself and will not care how they are located in the 2D image.
19
Preparing for texturing• Now add an image. You can choose to initialize
it with the UV test grid to understand which parts of the image is mapped to which parts of the model.
• Name the image well. “truck texture” is what I wrote.
20
Preparing for texturing• Scroll out and you will see your image
initialized to the UV test image• Under the 3D view on the right, select
“texture” to see the texture on the model
21
Preparing for texturing• Go back to the default layout to have more
screen area for setting up the material. • Even though we are seeing the texture on our
truck, we have to also set the texture as a material on the truck for it to work
22
Preparing for texturing• On the properties pane, go to the material tab• Add a new material if there isn’t already one
there
23
Preparing for texturing• Now go to the textures tab and add a texture
to this material if there isn’t one already
24
Preparing for texturing• Set the type of the texture to “Image or Movie”• Scroll down and browse for the image that we
created earlier • Under mapping, select UV for Coordinates
25
Preparing for texturing• Congratulations, you have successfully added
the texture to the model. Here are the things you can do to verify that you have done everything correctly:– Render and see the texture on the model– Select texture in viewport shading and see the
texture in the 3d view
26
Preparing for texturing• Next we will start painting the texture. Before
that, we will save the texture image. An early reminder: don’t forget to save the image every time after you paint. File->Save’ing the .blend file is not enough.
27
Reviewing the model• Now our model is unwrapped nicely and has a
simple texture on it• We can remove the light in the environment if
some faces of our truck are black– But then when you render it will all be black– Here is how you can fix it:
28
Projection Painting in Blender• The idea– Get photographs of the object from different
angles– Paint them on the object as different textures– Merge them together
29
Reviewing the model• Go to the Object Data tab while
the truck is selected• There you see a section called UV
Maps– This is where the unwrapped UV
coordinates are stored– We will have more than one of
these for different angles. • Rename this to “Main UVMap”
30
Adding a new UV map• Add a new UV map by clicking
the plus button• Rename it to Front
31
Adding a new UV map• In the image editor, we still see
the old UV map and the image. This is because we created an exact copy of it
• To verify this, move one of the vertices in the image editor
• Switch between Main UVMap and Front. You will see that you edited Front and not Main UVMap
32
Using a photo as a texture image• Now we want to load the front
image for the truck and map it to the front of the truck.
• Select Front from UV Maps• Open the image for the front
• Now we want to place the vertices in the image editor such that they match the photo
33
Using a photo as a texture image• In the 3D view, turn the view so that
our truck is oriented the same way as the truck in the photo
• Now select all, click Unwrap and Project from View
34
Using a photo as a texture image• The vertices started really small.
You will always have to resize and locate them by hand
• Select all (“A”), press “S” on keyboard to start scaling
• Press “G” to start moving, and “R” to start rotating if you need to
35
Using a photo as a texture image• Now lets ignore the faces that we
cannot see. In the 3D View, deselect all
• Select the visible edges by clicking and dragging the mouse
• In the image editor we will only have these visible
36
Using a photo as a texture image• Now move around individual
vertices in the image editor so that they match the photo
• You don’t have to get everything. Don’t get any background inside the model.
• You can view the result as you drag
37
Using a photo as a texture image• While this was good for the front of the truck,
the side is not so good.• We will get the side from another texture
later. First, let’s get the back just like the front
38
Using more photos• To get the back of the truck, we
will create a new UV Map• Create a new UV Map and
rename it to Back. Again, it duplicated the current UV Map.
• Load the back image in the image editor.
• We will need to do another unwrap for this
39
Using more photos• Turn the 3D view so that the back of
our truck is in a similar orientation as the photo
• In the 3D view, in edit mode, select all
• Select Unwrap and Project From View
40
Using more photos• Again select all (A), scale (S),
rotate (R), and move (G) the points.
• Select only the visible faces of the truck and move individual points to match the photo
41
Doing the sides from one photo• Now for the sides of the truck, we want to
create another UV Map• Load the side photo• Orient the truck and Unwrap,
Project From View • Select only the visible faces and adjust
the UV coordinates
42
Doing the other side from the same photo• Turn the other side of the truck.
Orient it similarly to our photo.• Select only the faces on this side
(deselect with “A” and select one by one)
• Unwrap, Project From View again. This will not touch the other side that is not visible.
43
Doing the other side from the same photo• In the image editor select all
(A) and mirror these vertices so that they look more like the photo
• Adjust and match the photo
44
Doing the other side from the same photo• Now both sides of the truck are done in this
UV Map
45
Using multiple texture images• Now we have three different UV Maps that all
texture only parts of the model
46
Projection Painting in Blender• The idea– Get photographs of the object from different
angles– Paint them on the object as different textures– Merge them together
47
Using multiple texture images• Problem is, we need only one texture. – Now we want to merge them into one single
texture.• We will copy parts of each texture into the
Main UVMap
48
Merging textures• For this, we will again use texture painting and
the clone brush tool. • Select the Main UVMap from UV Maps and
switch to texture paint mode• On the left, select the clone brush
49
Merging textures• Similar to Bprojection, where we cloned
visuals from a plane, now we will clone from the other UV maps that we cannot see.– We will not place a cursor, it will handle all that
itself. • Scroll down to the Project Paint section. It
should already be checked.
50
Merging textures• The Clone property here lets
us clone from other UV maps• We will start by cloning the
front of the truck from the “Front” UV map.
• Check Clone and select the “Front” UV map that youcreated earlier.
• Also, increase the strength of the brush
51
Merging textures• Now when you click and drag on the model, it
will bring in parts of the Front UV map.• Paint the whole front like this• This way, we will bring in parts of
the truck from different texturemappings
52
Merging textures• Select “Back” and start painting the
back.
53
Merging textures• Select “Sides” and start painting the
sides. Be careful not to paint over the front or the back. If you do,press Ctrl+Z to undo.– Tip: zoom in so that you can’t see
other faces• Paint both sides
54
Merging textures• This looks better than what we did last week.
55
Painting the rest• However, the top and the bottom are not
painted.
56
Painting the rest• We can select a color and paint these, but it
would be difficult to choose the correct color. You can get the value of the color in external programs like Gimp if you want and use that.
• I will do something that’s more hacky.
57
Painting the rest• Select the clone brush, Ctrl+click on the
model where you have color that you want for the top of the model. The cursor will go there.
• Now deselect Clone so that we don’t copy from other UV maps
• Make your brush smaller and paint on top of the truck with very short strokes
58
Painting the rest• Now that we got some color on
top, get the cursor there with Ctrl+click and continue to paint from there
• Let your strokes move away from the cursor. This will avoid messing it up.
59
Painting the rest• Paint the bottom to black with the
regular brush tool
60
Finishing up• Now if you want, you can remove the “Front”, “Back”
and “Sides” UV Maps but you don’t have to. • When you select “truck texture” in the image editor,
you should see your truck unwrapped and textured nicely. Save it next to the blend file.
61
Finishing up• Now when you drag the model and the
texture into Unity, you should see it textured fine.
62
No homework• Work on your projects!