Giving It Substance

Revision as of 14:42, 21 January 2008 by Trylon (Talk | contribs) (Rocky Detail)

In this chapter, we're going to texture the rocks, and add a patch of fertile soil.

UV Mapping

If you read the Blender Noob To Pro tutorial, you probably already know about creating textures. But you may have missed what UV Mapping is.

Basically, UV mapping is precisely assigning vertices or faces to parts of your texture.
The coordinates that a vertex gets assigned on the texture are called U and V - hence the name UV mapping.

  • Note:
    In Uru, UV Coordinates are set per-vertex, while in Blender they are set per-face (meaning that a vertex can have separate UV coordinates for each face that it's attached to).
    The plugin does accurately handle this (by duplicating vertices for each face that has different UV coordinates), so don't worry too much - but to avoid getting too many vertexes duplicated, it's always best to have similar uv coordinates for as much vertices as possible.
    Most automatic UV calculations already put uv coordinates

We're going to let blender automatically unwrap the island we just made, into nice UV coordinates.

You can start by making one Blender window a UV/Image Editor window.
After that, you can select your object (when you're in object-mode) and press [F] to switch to UV editing mode.
It's best to put the view from straight above by pressing the [7] key on your numpad. (That makes automatic mapping easier later on)
Don't forget to select all the faces by using the [A]-key.

It should look like this, when you're in UV Edit mode now:
Tutorial UVMap Start.png

As you can see, the UV/Image Editor window, shows the UV coordinates for each selected face.
Right now, all faces use the same part of the texture - you can imagine how ugly that must look....

We're going to fix that by having blender "unwrap" the texture.
Press [U]-key on your keyboard to bring up the following pop-op menu that gives us a few options:
Tutorial UV Automatic.png

We are going to use Unwrap, the topmost option.
As you can see in the result below, it tries to accurately map the surface to a flat sheet of texture, but at the same time it translates the relative size of the faces correctly to texture space. (Letting larger faces have a bigger part of the texture than smaller faces)

The result if this operation is below:
Tutorial Unwrap.png
It looks a bit weird, I know, but it has a texture map that is balanced to the size of the faces, and that is the most important here.

Making the island rocky

First, we are going to give the entire island a rocky material. After all, we need a bit of solid surface to plant something on.

To do this, we are going to use the following two textures:

Rock .pngRock detail.png

Base Rock

The first texture, we will apply as a basic terrain.
Make a new material to the mesh, and add a texture to it - call it Rock or something like that:
Tutorial AddRockMaterial.png

Make the color something like in the image above.
Since we are making a rock, we can get away with letting it have a bit of specularity if you wish.
To do that, set the specularity slider and hardness slider.

Now, we are going to add the texture.
Go to the textures panel, and load in the rocky texture from above. Make it look like below:
Tutorial AddRockTexture.png
By having the MIPMAP button pressed, PyPRP is told to make MipMaps of the image (a set of continually smaller images used to render at greater distances.)
The INTERPOL button tells PyPRP to compress the texture.

Now, it's probably a bad idea to have this entire texture encompass the entire island. So, we're going to scale it up a little... In the Material Tab, select the Rock texture, and then select the Map Input panel:
Tutorial RockMapInput.png

Set the map input button to UV, telling PyPRP to use the UV map.
For scaling it up, we're going to use the SizeX and SizeY fields.
As in the example picture, set them both to 6.0. This will make the texture image 6 times smaller in rendering. That way it's a bit smaller and more realistic.

Rocky Detail

We now have a bit of a problem:
If we make the texture any smaller - it will get too repetitive, not showing us large outlines of the rocks, as we are used to in real life. But on the other hand, at the moment, it does not give enough detail to convey a realistic result.

To solve this, we will use the second texture I provided - Rock_detail.png This image has a lot of transparency (alpha), except on the areas that are close to the edges. It will be used to give the a more detailed rocky effect to the terrain.

  • Note:
    This image was made in GIMP from the first rocky texture by adding an layer mask for transparency, and using the result of an 'edge detect' for the mask.

Add it to the material like you did before (call it RockDetail), but this time, make the SizeX and SizeY quite a bit larger, as this texture must be a lot smaller. Around 32.0 for both should be ok.
Tutorial RockDetailMapInput.png

Now, we have another trick:
It would be nice if the influence of this map would fade a bit with distance. To accomplish this, we are going to influence the creation of the mipmaps, so that each new mipmap level gets a little more transparency than the previous one.

Go to the Texture tab, and make your settings look like this:
Tutorial RockDetailTexture.png
The USEALPHA button will ensure that your texture gets compressed in a format that preserves transparency. (Even though pyprp should detect that automatically)

Our fading trick however, is accomplished by the filter field.
On every new mipmap level that is created, the transparency (alpha) of the texture is multiplied wiht this number.
So, by setting it lower than 1.0, each mimpap level gets a little more transparent than the last one.
The influence of the texture will thus fade with distance.

Set the filter field to a value of about 0.9, that will be just right for our purposes.

If you did all this, the terrain will have a nice rocky texture that has both detail, and is not too repetitive.

Adding a bit of soil

Now, we should have a little vegetation on our island. However, it is a well known fact that plants don't grow that well on rock alone.
We will need to add a patch of fertile soil for us to have that grass upon.


Continue

After we have soil, we are ready to start Planting Some Grass