I've put together a makefile that automates the process of taking four regular single image maps and creates two composite maps used by the texture component. I'm releasing the makefile to the public domain in the hope it is useful and that others will be able to improve on it.
It uses the NetPBM utilities:
Description here: http://en.wikipedia.org/wiki/Netpbm
Project page here: http://netpbm.sourceforge.net/
The pamrgbatopng program seems not to be included in the mingw(windows) port or the Ubuntu Linux package.
I can provide it if you want a pre-compiled elf Linux version. Alternately you can build it from the netpbm sources or get an rpm.
Here's the makefile:
Code: Select all
# makefile for ogre new terrain component textures.
#
# The makefile will attempt to convert separate input image files to a combined ogre compatible format.
# The layer 0 image will be "AlbedoSpecular.png"
# The layer 1 image will be "HeightNormal.png"
#
# Usage:
# You must provide:
# An image file with a prefix of 'Height' for the Height map.
# An image file with a prefix of 'Normal' for the Normal map.
# An image file with a prefix of 'Albedo' for the Albedo(diffuse) map.
# An image file with a prefix of 'Specular' for the Specular map.
#
# It is assumed the file names have the correct extension.
# With this version of makefile acceptable formats are: bmp, jpg, and png.
# It should be simple to accept most other formats.
#
# Run the makefile by issuing the following from your command line or from your build manager:
# make -f ogre.texture.makefile
#
# Requirements:
# A standard 'make' program (I believe gnu make and microsoft nmake work)
# The Netpbm tools for graphics conversions and manipulation into standard ogre format.
# You can get netpbm free for most environments here: http://netpbm.sourceforge.net
# or by using your package manager on linux.
#
# If you're planning on using paging for the terrain you may find the program 'pamdice'
# in the netpbm package useful. It cuts a single large image into a grid of images. This
# would be perfect for creating the individual page images.
#
# The final output file:
# You can use either tga or png format files. The makefile is currently set for png output. See below if you need to change it
#
# The pamrgbatopng program seems not to be included in the mingw port or the Ubuntu Linux package.
# I can provide it if you want a pre-compiled elf Linux version.
#
# written by Jay Sprenkle jsprenkle @ gmail.com 2011-08-08
# I release this file to the public domain. There is no implied or overt warranty.
# implicit rules for conversions
%.ppm : %.bmp
bmptopnm $< > $@
%.ppm : %.png
pngtopnm $< > $@
%.pgm : %.ppm
ppmtopgm $< > $@
%.tga : %.pam
pamtotga -norle -rgb $< > $@
%.png : %.pam
pamrgbatopng $< > $@
%.ppm : %.jpg
jpegtopnm $< > $@
%.ppm : %.jpeg
jpegtopnm $< > $@
# make all targets by default
# If you have pamtotga on your system you can switch to tga format by changing the 'png' to 'tga' on the line below.
all: HeightNormal.png AlbedoSpecular.png
clean:
rm HeightNormal.pam AlbedoSpecular.pam Albedo.ppm Specular.pgm Height.ppm Normal.pgm
# layer 0: combined Albedo and Specular map
AlbedoSpecular.png: AlbedoSpecular.pam
AlbedoSpecular.pam: Albedo.ppm Specular.pgm
pamstack -tupletype=RGB_ALPHA Albedo.ppm Specular.pgm > $@
# layer 1: combined Height and Normal map
HeightNormal.png: HeightNormal.pam
HeightNormal.pam: Height.ppm Normal.pgm
pamstack -tupletype=RGB_ALPHA Height.ppm Normal.pgm > $@