Phil Barrenger's - 3D Stuff
 
 
Tutorials - Texture Blending with Weight maps

This Tutorial is aimed at people fairly familiar to xsi, though I will endevour to cater to new users as well.

Download tutorial Files :

Start Scene and image
Completed Scene
Weight Map Script

Learning outcomes :
1) Editing weight maps using my weight maps script.
2) Blending textures with weight maps

1) Preparations

First up download the start up scene. Unzip the scene file to a scenes directory of a xsi project, unzip the finger.jpg to the pictures forlder of the same project. Open up the scene.

The scene contains a finger with texture coords already applied and a simple lambert shader with the finger.jpg driving the diffuse. We're not going to worry too much about getting perfect skin but rather getting rid of any seems.

Fig 1 shows the problem areas in the start scene which we want to fix up. They come about because of the nature of texture coordinates. Fig 2 shows the tex coords for the finger, as you can see the places where we get seems are where the texture coords are split.


fig.2

There's not much you can do about the texture coords, at some point you pretty much always have to split them.


fig.1
2) Applying the weight map.

So what we want to do to fix this seam is to create a weight map that has a nice soft falloff around the seams so that we can use this as a blending tool in the render tree.

Select the finger and go to Model - Get - Property - Weight Map.

In the Weight Map PPG that opens up change the Base weight to zero. Leave everything else as is.

If you haven't already then install the Weight Map Script. To do this drag and drop the downloaded .xsiaddon file into xsi. The plugin will install a new menu into your Get - Property - Map Paint Tools menu.

Now select the points that make up the seams of the texture coords as shown in fig.3.

Press W to go into weight painting mode.

Now go to Model - Property - Weight Paint Tools - WMEditPB. This will bring up a ppg as in fig.4.

Adjust the weight slider to 1 and you should see something like fig.4.

NOTE - you don't have to use the WMEditPB tool for this, you could hand paint all the points, but it does do the job nice and easily.

Ok, that's it for the weight map, as you can see we have exaclty what we need, a nice soft falloff over the points that make up the seam.

fig.3

fig.4
3) Blending in the render tree

Open up a render tree view for the finger (7).

Get a mix_2colors node.

Get a Map_lookup_color node from nodes - map lookups - color

Get another image node.

Plug them all together as show in fig. 5 below. Change the map dropdown list in the Map_lookup_color node to use the weight map that we created.

 

fig.5

If you do a render with that tree you'll get something like fig.6.

As you can see it's doing pretty much what we want but at the moment we are using the same texture coordinates for the noicon image, so natuarally we are going to get the same seams.

What we have to do is create a new set of texture coordinates that don't have a seam in the same places.

fig.6
4) Creating a new Texture Projection

Select the finger mesh and apply a new planar texture projection Model - Get - Property - Texture Projection - XY.

Open up the texture Editor (Alt + 7).

Make sure that the texture editor is displaying the coordinates for texture Projection1 by choosing it from the UVs menut.

Change the Clip to finger_.jpg from the Clips menu. You should have something like firg.7

In the Camera View select the polygons around the area that contains the seam, as in fig.8.

fig.8

Now in the texture editor press F6 to synch the selection with the 3D view.

Press the ContourStretch Subprojection button and choose Walking on the Mesh, then in the 3D view right click to end the picking session.

Your new UVs should look like fig.9. >>

At this stage I'm not too fussed about the overlapping as we only need the area around the seams to be ok as this is the only area that is going to get the texture applied. However in the interestes of keeping things tidy we will shift the uvs for the rest of the finger.

In the texture editor activate Island Selection mode and select one of the points on the finger. All the connected points should automatically get selected. Move and scale all these points so that they don't ovelap any of our other points.

You should now have something akin to fig.10

Next we freeze our projection by choosing Edit - Freeze in the texture editor.

fig.7










fig.9

fig.10

5) Setting the Render Tree to use our new projection.

Ok, we have a new projection that covers our seam nicely enough for our purposes in this tut. Now we just need to use it in the render tree.

Open up a render tree for the finger (7).

At the moment we have the noicon plugged into our second image node. Replace this with our finger.jpg.

Double click on the second image node to bring up it's ppg. Change it's texture projection to use Texture Projection1.

Now draw a render region around the problem area and you should see something like fig.11. As you can see the seam has dissappeared!

For this tutorial I cheated and just plugged the same image into that second image node, you may find that you get better results by making a specific image for blending.
I also skimped on the Texture Projection fot the blend. Ideally you should pay close attention to the second texture projection and ensure that you don't have any stretching etc.

 

fig.11