Terrain Palette Creation

From C4 Engine Wiki

Jump to: navigation, search
Image:warning.jpg Obsolete Article

Some or all of the information on this page is obsolete and needs to be updated.

Creating quality terrain textures is a fairly easy process. With a few exceptions, it is the same as creating textures for characters and props. The biggest difference between terrain textures and "standard" textures is the shader network. This guide was created so that anyone of any level of experience can follow along and produce their own quality terrain textures.

Contents

Source

The source of your textures can be completely hand drawn, or captured photographically. There are many websites with high quality photo textures. The one used in this tutorial was sourced from cgtextures.com

There are a few guidelines to follow when selecting images. Since these will be tiled over a large area, repetition is to be avoided as much as possible. Try to find images that are plain with few large standout details. It may sound boring but the end result is much better for this reason.

Determine the size of the images you want. C4 will import a highest resolution of 2048×18432. This will allow a 9-entry texture palette. If you have the image size to 1024, you can import an 18-entry palette, or 36 entries at 512 resolution. This tutorial uses a 9-entry 2K texture for maximum detail.

Preparing Textures

Inside an application such as Photoshop, prepare the source images for use as a tileable texture. As mentioned above the goal is to remove any unique details to reduce the visual distinction of a repetitive texture. To quickly achieve this, first create a new document of 2048×2048 (or whichever size you determined to use) and copy your texture into the canvas. If the source is smaller, duplicate it and move it to cover any blank areas. Flatten the image and save. We now have a base to start texturing, and without modifying the original image keeping it intact and ready to use elsewhere.

original terrain texture before modifying to become tileable

The stock image from cgtextures.com Notice the areas which would cause an immediate tiling effect.

select the offset filter from the filter menu

Select the offset filter to "wrap" the image both vertically and horizontally. This will let you paint out the seams by using the clone brush. Just sample an area from either side of the seam, and paint it out. Using an irregular brush will make the results look more natural for this type of material.

with wrap selected, enter values roughly half of the height and width to expose the border edges. This will allow the texture to tile properly.

Offset the image to about half of its height and width. This will put the seams in the middle both vertically and horizontally.

the final image. Utilizing the clone tool with an irregular brush allows a nicely blended image perfect for tiling textures.

The final image. Note that is is very uniform with very few areas that are "unique" in detail.

Normal Map Creation

Now that the diffuse map has been made, the next step is to generate a normal map. When dealing with characters and other singular objects, the normal information is usually extracted from a high polygon source. Small high frequency details may be added with the use of a height map, but for terrain this process is generally not easy or quick. To get around this, tools exist to produce rather nice normal maps from photo sources. The one used in this example is CrazyBump, but the Nvidia normal map filter for Photoshop will work okay as well (it's also free!).

Since we only care for the normal map, the process is very easy. Start CrazyBump and open your image. It will produce a normal map and allow you to adjust sliders for large/medium/small details, as well as the intensity of the perturbations. Save this result to file or clipboard, and open or paste it back into Photoshop. The result is below. No other adjustments were made.

the normal map generated from crazybump.

Fresh out of CrazyBump. The result is pretty good, but you can tweak it anyway you like.

Specular map

For this example, the specular map is a darkened contrasted version of the diffuse. While this is not always the best option, for terrains the result is good enough to not require the extra time spend on the specular as it would be for a main character or other prominent object.

adjusting layers on the diffuse allow for a quick and dirty specular map.

By using a brightness/contrast adjustment layer, you can quickly turn the diffuse into a quick and dirty specular map.

Final Maps

the final maps. Clockwise from top left; normal, diffuse, specular.

The final maps produced. Normal, diffuse, and specular.

the compiled 9 segment maps. Diffuse, normal, specular.

At this point, the process is just a repeat of the above steps for the remainder of the textures you want to use. When all 9 (or 18, or 36) textures are done, arrange them into a vertical strip. The final size for each diffuse, normal, and specular is 2048×18432.

Into C4

Now that the maps are compiled and finished, it's time to get them into C4. Since the three maps exist, there is no reason to use any alpha options for normal map generation from a height map. Following the image below will allow quick importing of the terrain textures, and form the terrain palette easily.

import options for each map. No other options need checked because the normal map already exists and each is using a unique texture.

These are the options used for this demo. Compression artifacts are not easily seen with these results, but you may omit them if you feel they are detracting from the textures.

Shader Network

The following images show the shader created for the terrain. Each shader has two components, the ambient and the light. The ambient shader is very easy, consisting of one node. The light shader is more complex, using diffuse reflection and specular reflection. Each of these uses multiply nodes as well as addition, as well as the textures themselves.

ambient shader.

The simple ambient shader.

light shader. More complex than the ambient, but overall it is still a rather easy execution.

The more complex light shader.

Using the palette

For a more detailed brief of the terrain system, please see the other tutorials on this wiki.

Now its time to finally use the textures. Each face of the voxel brush can have a texture assigned to it. By clicking on one of the six squares in each texture group, you can select one of the 9 (or 18,36) textures imported in the palette. This can be changed on the fly to allow for more complex texture painting.

applying 1 of 9 textures to each face of the voxel cube.

Selecting a texture for the cube faces for a group.

final terrain painted with the freshly minted terrain palette.

Final result. As you can see, the whole process is rather easy, however time consuming. Using more exotic materials could allow for any type of terrain to be created. So at this point, take a break, and gaze at your work.