If you haven't done so already, be sure to visit the Wiki Portal to read about how the wiki works. Especially the Ogre Wiki Overview page.
|
| How to create textures for use with the Ogre Terrain Component |
Table of contents
Introduction
The default material generator of the Ogre Terrain Component uses two textures per layer:
Normal_height and Diffuse_specular.
It's important to have the textures in the right format, otherwise the terrain is not going to look right.
The following shows three possible ways to create a working set of terrain textures.
ShaderMap CL
- Get ShaderMap CL from http://www.shadermap.renderingsystems.com/
- Create a bat file with the following contents:
CD "C:\Program Files\ShaderMap CL 1.2.2" START /WAIT shadermap.exe cdiff "<texture_directory>\<texture_name>" -disp (60,100,12,xy) -norm (100,200,xy,0) -spec (100,-50,52,xy) -v
Replace the directory and texture name with what you want to generate maps for. - Generate the maps by running the bat script, once for each texture.
- Use the following C++ code to combine the images:
Ogre::Image combined; combined.loadTwoImagesAsRGBA("moos1.jpg", "moos1_SPEC.bmp", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::PF_BYTE_RGBA); combined.save("moos1_diffusespecular.png"); combined.loadTwoImagesAsRGBA("moos1_NORM.tga", "moos1_DISP.bmp", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::PF_BYTE_RGBA); combined.save("moos1_normalheight.png");
- Get the nVidida texture tools (DDS Utilities) and convert the output textures to dds.
- Done.
PixPlant
PixPlant
is powered by Ogre and is a highly recommended texture tool!
- Fire up PixPlant and File->Load Texture->dirt.jpg
- Adjust the Intensity value of the Specular channel - too much will make the terrain look weird. -80 is about right, but it depends on the source texture, naturally.
- File->Save All 3D Material Maps..
- You should now have four different textures:
dirt_DIFFUSE.png dirt_DISP.png dirt_NORMAL.png dirt_SPECULAR.png
- Use the code from previous section to combine the textures into Diffuse_specular, Normal_height textures.
The Gimp
You work on the layer mask. It's like an alpha channel but with a different name BUT gimp doesn't see it as an alpha channel until you apply it.
Therefore, on the image you're already working, go to the Layer window (if you don't have it, menu Windows->Dockable Windows->Layers):
- Right click on the layer you want to add an alpha channel.
- Go to Layer->Mask->Add Layer Mask...
- Add a grayscale copy of the layer or a blank image, whatever fits your needs. You can later paste something else.
- Once you're finished, click on Layer->Mask->Apply Layer Mask. This will turn the layer mask into the alpha channel.
I prefer opening the file in the regular way (not "Open as Layers").
To work on individual channels (except alpha, you work on it as a "mask") I recommend using the channel window (Windows->Dockable Windows->Channels) and selecting one channel allows you to work on one channel at a time (including copy-pasting)
If you need DDS support, you can try the GIMP DDS plugin, but it has basic support and you may be better off with a dedicated tool.
NetPBM utilities
The NetPBM utilities
are a set of over 200 very simple command line utilities to perform manipulations on images. The programs use a common data format but provide converters to change to and from most image formats in use today. The power of the package is that you can use the programs in concert to perform any desired transformation (such as creating the combined textures or dicing images files for the paging manager). The utilities have been ported to most *nix variants, Mac, and Windows.
A makefile is available that automates the process of creating textures. Support is available here
Todo
- Make a command-line tool which takes four textures: name_DIFFUSE, name_DISP, name_NORMAL and name_SPECULAR as input and produces a set of terrain textures.
- Same as previous, but featuring a GUI and/or a batch mode - maybe even calling ShaderMap CL to generate the four source textures from input textures.
Contributors to this page: uzik
,
jacmoe
and
harkathmaker
.
Page last modified on Tuesday 09 of August, 2011 12:13:32 GMT by uzik
.
The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.

