<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://springrts-wiki.p2004a.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tinnut</id>
	<title>Spring - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://springrts-wiki.p2004a.com/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tinnut"/>
	<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/wiki/Special:Contributions/Tinnut"/>
	<updated>2026-11-08T21:47:42Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18771</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18771"/>
		<updated>2008-02-27T20:43:01Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a texture for a Spring map using the freeware Povray program.  Povray is an excellent [http://en.wikipedia.org/wiki/Ray_tracing raytracing] application that generates &amp;quot;scene&amp;quot; images using a scene definition language in a text file.  We can use it to create a map&#039;s texture by creating a heightfield object, putting our &amp;quot;camera&amp;quot; directly over the object, setting the camera to orthographic, and rendering a bitmap at our map&#039;s dimension.  The steps below will give you an easy enough to follow process to generate a nice map, but if you want to create different maps you&#039;ll need to learn Povray&#039;s scene definition language.  This language is easy enough to follow, but depending on your tastes you could be better off using a tool that specialises in maps and map textures, such as the excellent [http://www.bundysoft.com/L3DT/ L3DT].  &lt;br /&gt;
&lt;br /&gt;
The guide does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
Please note that a lot of the maths used in the scene definition file has only been tested on a 16x16 map (8192x8192 pixels).&lt;br /&gt;
&lt;br /&gt;
Warning:  The base textures I use in this example are all mostly rubbish that I created in a couple of minutes.  I would suggest that you do not use them in your own maps :)&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like [http://www.gimp.org/ The GIMP], which is good, and it&#039;s free).  Here is the one we&#039;ll use for our map (I created this in a hurry and it was quite a mistake that it ended up so similar to Altered Divide):&lt;br /&gt;
&lt;br /&gt;
[http://img441.imageshack.us/my.php?image=povmapheightbp9.png http://img441.imageshack.us/img441/8862/povmapheightbp9.th.png]&lt;br /&gt;
&lt;br /&gt;
Your map will need to be named povmap_height.png, but if you want to use another name, just update the pov script below to use your heightmap&#039;s actual name.&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level1zd7.png http://img176.imageshack.us/img176/953/level1zd7.th.png]&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
[http://img170.imageshack.us/my.php?image=level2pf6.png http://img170.imageshack.us/img170/6473/level2pf6.th.png]&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level3wv7.png http://img176.imageshack.us/img176/6159/level3wv7.th.png]&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope1on6.png http://img411.imageshack.us/img411/2153/slope1on6.th.png]&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope2fk7.png http://img411.imageshack.us/img411/8908/slope2fk7.th.png]&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Setup some parameters that we will use within the script&lt;br /&gt;
#declare MAP_WIDTH=8192;&lt;br /&gt;
#declare MAP_HEIGHT=8192;&lt;br /&gt;
#declare MAP_EL=600; // elevation&lt;br /&gt;
&lt;br /&gt;
global_settings { &lt;br /&gt;
  // ambient light level&lt;br /&gt;
  ambient_light rgb&amp;lt;1,1,1&amp;gt; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set a directional light&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;100,-100,100&amp;gt; * 20, color rgb 1&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at &amp;lt;1, 0, 0&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set the background colour&lt;br /&gt;
background {rgb&amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
// Define our camera position, and set it to &amp;quot;orthographic&amp;quot; (important :)&lt;br /&gt;
camera {&lt;br /&gt;
  orthographic&lt;br /&gt;
  location &amp;lt;0,0,MAP_EL + 90&amp;gt;    // position &amp;amp; direction of view&lt;br /&gt;
  look_at  &amp;lt;0,0,0&amp;gt;&lt;br /&gt;
  right MAP_WIDTH*x            // horizontal size of view&lt;br /&gt;
  up MAP_HEIGHT*z               // vertical size of view&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Define our primary textures **&lt;br /&gt;
 &lt;br /&gt;
// lowest texture (512 x 512)&lt;br /&gt;
// Found in low lying areas of the heightfield&lt;br /&gt;
#declare level1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// middle texture (512 x 512)&lt;br /&gt;
// Found in the middle areas of the heightfield&lt;br /&gt;
#declare level2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// highest texture (512 x 512)&lt;br /&gt;
// Found in the peaks / hills / mountains of the heightfield&lt;br /&gt;
#declare level3_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level3.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one level&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare levels_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 level1_texture]  // from 0.0 to 0.1 we have just level1.png&lt;br /&gt;
    [0.10 level1_texture]&lt;br /&gt;
                    // from 0.1 to 0.2 we blend from level1.png to level2.png&lt;br /&gt;
    [0.30 level2_texture]  // from 0.2 to 0.5 we have just level2.png&lt;br /&gt;
    [0.40 level2_texture]&lt;br /&gt;
                    // from 0.5 to 0.6 we blend from level2.png to level3.png&lt;br /&gt;
    [0.60  level3_texture]  // from 0.6 to 1.0 we have just level2.png&lt;br /&gt;
    [1.00  level3_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** Define textures used on areas of slope&lt;br /&gt;
&lt;br /&gt;
// lower slope texture (512 x 512)&lt;br /&gt;
#declare slope1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// upper slope texture (512 x 512)&lt;br /&gt;
#declare slope2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one slope&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare slopes_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 slope1_texture]&lt;br /&gt;
    [0.30 slope1_texture]&lt;br /&gt;
    &lt;br /&gt;
    [0.65  slope2_texture]&lt;br /&gt;
    [1.00  slope2_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Now define the final texture blending between the height textures &lt;br /&gt;
// and the slope textures:&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  slope {&lt;br /&gt;
    &amp;lt;0,0,-1&amp;gt;, 0, 0.5&lt;br /&gt;
  } &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    levels_elevation_texture]&lt;br /&gt;
    [0.06    levels_elevation_texture]&lt;br /&gt;
    [0.40    slopes_elevation_texture]&lt;br /&gt;
    [1.00    slopes_elevation_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
// ***!! Now we declare our heightfield object that uses this texture&lt;br /&gt;
#declare primaryHF=&lt;br /&gt;
height_field {&lt;br /&gt;
  png &amp;quot;povmap_height.png&amp;quot;                                  &lt;br /&gt;
  smooth              // smooth the heightfield&lt;br /&gt;
  no_shadow           // you may want to remove this&lt;br /&gt;
  translate &amp;lt;-.5, -.5, -.5&amp;gt;&lt;br /&gt;
  rotate &amp;lt;90,0,0&amp;gt;     // rotate it so that the projection of the texture is correct&lt;br /&gt;
  scale &amp;lt;1,-1,1&amp;gt;      // invert the y axis&lt;br /&gt;
  translate &amp;lt;0.5, 0.5, 0.5&amp;gt;&lt;br /&gt;
  texture {&lt;br /&gt;
    final_texture&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // now scale to the maps height x width&lt;br /&gt;
  scale &amp;lt;MAP_WIDTH, MAP_HEIGHT, MAP_EL&amp;gt;    &lt;br /&gt;
  // and center it for the camera&lt;br /&gt;
  translate &amp;lt;-MAP_WIDTH/2, -MAP_HEIGHT/2, -MAP_EL/2&amp;gt;   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** If you&#039;re going to add the metal placement stuff&lt;br /&gt;
// ** described below, you need to put it here!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
object {primaryHF}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
What we&#039;re essentially doing above is:&lt;br /&gt;
&lt;br /&gt;
* Setting up scene parameters: lighting, the orthographic camera, etc.&lt;br /&gt;
&lt;br /&gt;
* Defining a set of textures to display at different elevations and different slopes; and&lt;br /&gt;
&lt;br /&gt;
* Defining a heightmap that uses our png image and applies our texture to this object&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
&lt;br /&gt;
9.1)	Drop down menu &amp;quot;Render&amp;quot; &amp;gt; &amp;quot;Edit Settings/Render&amp;quot; &amp;gt; Click &amp;quot;Edit&amp;quot; button&lt;br /&gt;
&lt;br /&gt;
9.2)	Add text at bottom of file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[8192x8192, No AA  Spring]&lt;br /&gt;
Width=8192&lt;br /&gt;
Height=8192&lt;br /&gt;
Antialias=Off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
9.3) Save file&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray so that it re-reads the ini-file&lt;br /&gt;
&lt;br /&gt;
11) Select your new render size and click Render.  This creates a bitmap file: gen_pov_texture.bmp&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps).  I personally use [http://www.imagemagick.org/ imagemagick] to do this as it has a simple command line program &amp;quot;convert.exe&amp;quot; that will convert an image from one format to another and it works well with the very large bitmap image that comes out of the above steps.&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
Our blend function could actually be an image if you wanted finer control of a map&#039;s texture, by having sections of metal mixed with sections of wilderness, for example.  To do this, you would:&lt;br /&gt;
&lt;br /&gt;
1) Create a new png image the same size as your heightmap (although you could make it larger or smaller) and paint sections of the map that are to use your wilderness textures in white, and the sections that are to use your metal texture in black.  For effect you could do a slight blur on the image to create grey coloured transitions where the two sections meet.  For our example I created this:&lt;br /&gt;
&lt;br /&gt;
[http://img185.imageshack.us/my.php?image=texturedistributionpa8.png http://img185.imageshack.us/img185/2641/texturedistributionpa8.th.png]&lt;br /&gt;
&lt;br /&gt;
3) Change the &amp;quot;final_texture&amp;quot; texture name in your script to &amp;quot;final_nature_texture&amp;quot;&lt;br /&gt;
&lt;br /&gt;
4) Define a set of textures in a similar manner that define your metal textures (based on heights and slopes), with the final blended metal texture named &amp;quot;final_metal_texture&amp;quot;.  Don&#039;t forget to give them different names than the wilderness texture names are.&lt;br /&gt;
&lt;br /&gt;
5) Create a new &amp;quot;final_texture&amp;quot; that is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  image_pattern { png &amp;quot;texture_distribution.png&amp;quot; }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    final_metal_texture]&lt;br /&gt;
    [1.00    final_nature_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Here is a screen shot of our map using this:&lt;br /&gt;
&lt;br /&gt;
[http://img341.imageshack.us/my.php?image=screen000wd0.png http://img341.imageshack.us/img341/43/screen000wd0.th.png]&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures - like &amp;quot;Painted Rock&amp;quot;.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
The povray install also includes a number of nice example procedural textures.&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A transparent texture&lt;br /&gt;
#declare Transparent_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
	pigment {color rgbt&amp;lt;0,0,0,1&amp;gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the&lt;br /&gt;
// Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_EL*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18770</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18770"/>
		<updated>2008-02-27T20:37:13Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: /* Complex Texture Map Combinations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a texture for a Spring map using the freeware Povray program.  Povray is an excellent [http://en.wikipedia.org/wiki/Ray_tracing raytracing] application that generates &amp;quot;scene&amp;quot; images using a scene definition language in a text file.  We can use it to create a map&#039;s texture by creating a heightfield object, putting our &amp;quot;camera&amp;quot; directly over the object, setting the camera to orthographic, and rendering a bitmap at our map&#039;s dimension.  The steps below will give you an easy enough to follow process to generate a nice map, but if you want to create different maps you&#039;ll need to learn Povray&#039;s scene definition language.  This language is easy enough to follow, but depending on your tastes you could be better off using a tool that specialises in maps and map textures, such as the excellent [http://www.bundysoft.com/L3DT/ L3DT].  &lt;br /&gt;
&lt;br /&gt;
The guide does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
Please note that a lot of the maths used in the scene definition file has only been tested on a 16x16 map (8192x8192 pixels).&lt;br /&gt;
&lt;br /&gt;
Warning:  The base textures I use in this example are all mostly rubbish that I created in a couple of minutes.  I would suggest that you do not use them in your own maps :)&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like [http://www.gimp.org/ The GIMP], which is good, and it&#039;s free).  Here is the one we&#039;ll use for our map (I created this in a hurry and it was quite a mistake that it ended up so similar to Altered Divide):&lt;br /&gt;
&lt;br /&gt;
[http://img441.imageshack.us/my.php?image=povmapheightbp9.png http://img441.imageshack.us/img441/8862/povmapheightbp9.th.png]&lt;br /&gt;
&lt;br /&gt;
Your map will need to be named povmap_height.png, but if you want to use another name, just update the pov script below to use your heightmap&#039;s actual name.&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level1zd7.png http://img176.imageshack.us/img176/953/level1zd7.th.png]&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
[http://img170.imageshack.us/my.php?image=level2pf6.png http://img170.imageshack.us/img170/6473/level2pf6.th.png]&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level3wv7.png http://img176.imageshack.us/img176/6159/level3wv7.th.png]&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope1on6.png http://img411.imageshack.us/img411/2153/slope1on6.th.png]&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope2fk7.png http://img411.imageshack.us/img411/8908/slope2fk7.th.png]&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Setup some parameters that we will use within the script&lt;br /&gt;
#declare MAP_WIDTH=8192;&lt;br /&gt;
#declare MAP_HEIGHT=8192;&lt;br /&gt;
#declare MAP_EL=600; // elevation&lt;br /&gt;
&lt;br /&gt;
global_settings { &lt;br /&gt;
  // ambient light level&lt;br /&gt;
  ambient_light rgb&amp;lt;1,1,1&amp;gt; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set a directional light&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;100,-100,100&amp;gt; * 20, color rgb 1&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at &amp;lt;1, 0, 0&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set the background colour&lt;br /&gt;
background {rgb&amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
// Define our camera position, and set it to &amp;quot;orthographic&amp;quot; (important :)&lt;br /&gt;
camera {&lt;br /&gt;
  orthographic&lt;br /&gt;
  location &amp;lt;0,0,MAP_EL + 90&amp;gt;    // position &amp;amp; direction of view&lt;br /&gt;
  look_at  &amp;lt;0,0,0&amp;gt;&lt;br /&gt;
  right MAP_WIDTH*x            // horizontal size of view&lt;br /&gt;
  up MAP_HEIGHT*z               // vertical size of view&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Define our primary textures **&lt;br /&gt;
 &lt;br /&gt;
// lowest texture (512 x 512)&lt;br /&gt;
// Found in low lying areas of the heightfield&lt;br /&gt;
#declare level1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// middle texture (512 x 512)&lt;br /&gt;
// Found in the middle areas of the heightfield&lt;br /&gt;
#declare level2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// highest texture (512 x 512)&lt;br /&gt;
// Found in the peaks / hills / mountains of the heightfield&lt;br /&gt;
#declare level3_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level3.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one level&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare levels_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 level1_texture]  // from 0.0 to 0.1 we have just level1.png&lt;br /&gt;
    [0.10 level1_texture]&lt;br /&gt;
                    // from 0.1 to 0.2 we blend from level1.png to level2.png&lt;br /&gt;
    [0.30 level2_texture]  // from 0.2 to 0.5 we have just level2.png&lt;br /&gt;
    [0.40 level2_texture]&lt;br /&gt;
                    // from 0.5 to 0.6 we blend from level2.png to level3.png&lt;br /&gt;
    [0.60  level3_texture]  // from 0.6 to 1.0 we have just level2.png&lt;br /&gt;
    [1.00  level3_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** Define textures used on areas of slope&lt;br /&gt;
&lt;br /&gt;
// lower slope texture (512 x 512)&lt;br /&gt;
#declare slope1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// upper slope texture (512 x 512)&lt;br /&gt;
#declare slope2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one slope&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare slopes_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 slope1_texture]&lt;br /&gt;
    [0.30 slope1_texture]&lt;br /&gt;
    &lt;br /&gt;
    [0.65  slope2_texture]&lt;br /&gt;
    [1.00  slope2_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Now define the final texture blending between the height textures &lt;br /&gt;
// and the slope textures:&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  slope {&lt;br /&gt;
    &amp;lt;0,0,-1&amp;gt;, 0, 0.5&lt;br /&gt;
  } &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    levels_elevation_texture]&lt;br /&gt;
    [0.06    levels_elevation_texture]&lt;br /&gt;
    [0.40    slopes_elevation_texture]&lt;br /&gt;
    [1.00    slopes_elevation_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
// ***!! Now we declare our heightfield object that uses this texture&lt;br /&gt;
#declare primaryHF=&lt;br /&gt;
height_field {&lt;br /&gt;
  png &amp;quot;povmap_height.png&amp;quot;                                  &lt;br /&gt;
  smooth              // smooth the heightfield&lt;br /&gt;
  no_shadow           // you may want to remove this&lt;br /&gt;
  translate &amp;lt;-.5, -.5, -.5&amp;gt;&lt;br /&gt;
  rotate &amp;lt;90,0,0&amp;gt;     // rotate it so that the projection of the texture is correct&lt;br /&gt;
  scale &amp;lt;1,-1,1&amp;gt;      // invert the y axis&lt;br /&gt;
  translate &amp;lt;0.5, 0.5, 0.5&amp;gt;&lt;br /&gt;
  texture {&lt;br /&gt;
    final_texture&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // now scale to the maps height x width&lt;br /&gt;
  scale &amp;lt;MAP_WIDTH, MAP_HEIGHT, MAP_EL&amp;gt;    &lt;br /&gt;
  // and center it for the camera&lt;br /&gt;
  translate &amp;lt;-MAP_WIDTH/2, -MAP_HEIGHT/2, -MAP_EL/2&amp;gt;   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** If you&#039;re going to add the metal placement stuff&lt;br /&gt;
// ** described below, you need to put it here!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
object {primaryHF}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
What we&#039;re essentially doing above is:&lt;br /&gt;
&lt;br /&gt;
* Setting up scene parameters: lighting, the orthographic camera, etc.&lt;br /&gt;
&lt;br /&gt;
* Defining a set of textures to display at different elevations and different slopes; and&lt;br /&gt;
&lt;br /&gt;
* Defining a heightmap that uses our png image and applies our texture to this object&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
&lt;br /&gt;
9.1)	Drop down menu &amp;quot;Render&amp;quot; &amp;gt; &amp;quot;Edit Settings/Render&amp;quot; &amp;gt; Click &amp;quot;Edit&amp;quot; button&lt;br /&gt;
&lt;br /&gt;
9.2)	Add text at bottom of file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[8192x8192, No AA  Spring]&lt;br /&gt;
Width=8192&lt;br /&gt;
Height=8192&lt;br /&gt;
Antialias=Off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
9.3) Save file&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray so that it re-reads the ini-file&lt;br /&gt;
&lt;br /&gt;
11) Select your new render size and click Render.  This creates a bitmap file: gen_pov_texture.bmp&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps).  I personally use [http://www.imagemagick.org/ imagemagick] to do this as it has a simple command line program &amp;quot;convert.exe&amp;quot; that will convert an image from one format to another and it works well with the very large bitmap image that comes out of the above steps.&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
Our blend function could actually be an image if you wanted finer control of a map&#039;s texture, by having sections of metal mixed with sections of wilderness, for example.  To do this, you would:&lt;br /&gt;
&lt;br /&gt;
1) Create a new png image the same size as your heightmap (although you could make it larger or smaller) and paint sections of the map that are to use your wilderness textures in white, and the sections that are to use your metal texture in black.  For effect you could do a slight blur on the image to create grey coloured transitions where the two sections meet.  For our example I created this:&lt;br /&gt;
&lt;br /&gt;
[http://img185.imageshack.us/my.php?image=texturedistributionpa8.png http://img185.imageshack.us/img185/2641/texturedistributionpa8.th.png]&lt;br /&gt;
&lt;br /&gt;
3) Change the &amp;quot;final_texture&amp;quot; texture name in your script to &amp;quot;final_nature_texture&amp;quot;&lt;br /&gt;
&lt;br /&gt;
4) Define a set of textures in a similar manner that define your metal textures (based on heights and slopes), with the final blended metal texture named &amp;quot;final_metal_texture&amp;quot;.  Don&#039;t forget to give them different names than the wilderness texture names are.&lt;br /&gt;
&lt;br /&gt;
5) Create a new &amp;quot;final_texture&amp;quot; that is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  image_pattern { png &amp;quot;texture_distribution.png&amp;quot; }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    final_metal_texture]&lt;br /&gt;
    [1.00    final_nature_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Here is a screen shot of our map using this:&lt;br /&gt;
&lt;br /&gt;
[http://img341.imageshack.us/my.php?image=screen000wd0.png http://img341.imageshack.us/img341/43/screen000wd0.th.png]&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures - like &amp;quot;Painted Rock&amp;quot;.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
The povray install also includes a number of nice example procedural textures.&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A transparent texture&lt;br /&gt;
#declare Transparent_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
	pigment {color rgbt&amp;lt;0,0,0,1&amp;gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the&lt;br /&gt;
// Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_EL*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18769</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18769"/>
		<updated>2008-02-27T20:18:30Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a texture for a Spring map using the freeware Povray program.  Povray is an excellent [http://en.wikipedia.org/wiki/Ray_tracing raytracing] application that generates &amp;quot;scene&amp;quot; images using a scene definition language in a text file.  We can use it to create a map&#039;s texture by creating a heightfield object, putting our &amp;quot;camera&amp;quot; directly over the object, setting the camera to orthographic, and rendering a bitmap at our map&#039;s dimension.  The steps below will give you an easy enough to follow process to generate a nice map, but if you want to create different maps you&#039;ll need to learn Povray&#039;s scene definition language.  This language is easy enough to follow, but depending on your tastes you could be better off using a tool that specialises in maps and map textures, such as the excellent [http://www.bundysoft.com/L3DT/ L3DT].  &lt;br /&gt;
&lt;br /&gt;
The guide does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
Please note that a lot of the maths used in the scene definition file has only been tested on a 16x16 map (8192x8192 pixels).&lt;br /&gt;
&lt;br /&gt;
Warning:  The base textures I use in this example are all mostly rubbish that I created in a couple of minutes.  I would suggest that you do not use them in your own maps :)&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like [http://www.gimp.org/ The GIMP], which is good, and it&#039;s free).  Here is the one we&#039;ll use for our map (I created this in a hurry and it was quite a mistake that it ended up so similar to Altered Divide):&lt;br /&gt;
&lt;br /&gt;
[http://img441.imageshack.us/my.php?image=povmapheightbp9.png http://img441.imageshack.us/img441/8862/povmapheightbp9.th.png]&lt;br /&gt;
&lt;br /&gt;
Your map will need to be named povmap_height.png, but if you want to use another name, just update the pov script below to use your heightmap&#039;s actual name.&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level1zd7.png http://img176.imageshack.us/img176/953/level1zd7.th.png]&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
[http://img170.imageshack.us/my.php?image=level2pf6.png http://img170.imageshack.us/img170/6473/level2pf6.th.png]&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level3wv7.png http://img176.imageshack.us/img176/6159/level3wv7.th.png]&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope1on6.png http://img411.imageshack.us/img411/2153/slope1on6.th.png]&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope2fk7.png http://img411.imageshack.us/img411/8908/slope2fk7.th.png]&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Setup some parameters that we will use within the script&lt;br /&gt;
#declare MAP_WIDTH=8192;&lt;br /&gt;
#declare MAP_HEIGHT=8192;&lt;br /&gt;
#declare MAP_EL=600; // elevation&lt;br /&gt;
&lt;br /&gt;
global_settings { &lt;br /&gt;
  // ambient light level&lt;br /&gt;
  ambient_light rgb&amp;lt;1,1,1&amp;gt; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set a directional light&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;100,-100,100&amp;gt; * 20, color rgb 1&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at &amp;lt;1, 0, 0&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set the background colour&lt;br /&gt;
background {rgb&amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
// Define our camera position, and set it to &amp;quot;orthographic&amp;quot; (important :)&lt;br /&gt;
camera {&lt;br /&gt;
  orthographic&lt;br /&gt;
  location &amp;lt;0,0,MAP_EL + 90&amp;gt;    // position &amp;amp; direction of view&lt;br /&gt;
  look_at  &amp;lt;0,0,0&amp;gt;&lt;br /&gt;
  right MAP_WIDTH*x            // horizontal size of view&lt;br /&gt;
  up MAP_HEIGHT*z               // vertical size of view&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Define our primary textures **&lt;br /&gt;
 &lt;br /&gt;
// lowest texture (512 x 512)&lt;br /&gt;
// Found in low lying areas of the heightfield&lt;br /&gt;
#declare level1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// middle texture (512 x 512)&lt;br /&gt;
// Found in the middle areas of the heightfield&lt;br /&gt;
#declare level2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// highest texture (512 x 512)&lt;br /&gt;
// Found in the peaks / hills / mountains of the heightfield&lt;br /&gt;
#declare level3_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level3.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one level&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare levels_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 level1_texture]  // from 0.0 to 0.1 we have just level1.png&lt;br /&gt;
    [0.10 level1_texture]&lt;br /&gt;
                    // from 0.1 to 0.2 we blend from level1.png to level2.png&lt;br /&gt;
    [0.30 level2_texture]  // from 0.2 to 0.5 we have just level2.png&lt;br /&gt;
    [0.40 level2_texture]&lt;br /&gt;
                    // from 0.5 to 0.6 we blend from level2.png to level3.png&lt;br /&gt;
    [0.60  level3_texture]  // from 0.6 to 1.0 we have just level2.png&lt;br /&gt;
    [1.00  level3_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** Define textures used on areas of slope&lt;br /&gt;
&lt;br /&gt;
// lower slope texture (512 x 512)&lt;br /&gt;
#declare slope1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// upper slope texture (512 x 512)&lt;br /&gt;
#declare slope2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one slope&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare slopes_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 slope1_texture]&lt;br /&gt;
    [0.30 slope1_texture]&lt;br /&gt;
    &lt;br /&gt;
    [0.65  slope2_texture]&lt;br /&gt;
    [1.00  slope2_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Now define the final texture blending between the height textures &lt;br /&gt;
// and the slope textures:&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  slope {&lt;br /&gt;
    &amp;lt;0,0,-1&amp;gt;, 0, 0.5&lt;br /&gt;
  } &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    levels_elevation_texture]&lt;br /&gt;
    [0.06    levels_elevation_texture]&lt;br /&gt;
    [0.40    slopes_elevation_texture]&lt;br /&gt;
    [1.00    slopes_elevation_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
// ***!! Now we declare our heightfield object that uses this texture&lt;br /&gt;
#declare primaryHF=&lt;br /&gt;
height_field {&lt;br /&gt;
  png &amp;quot;povmap_height.png&amp;quot;                                  &lt;br /&gt;
  smooth              // smooth the heightfield&lt;br /&gt;
  no_shadow           // you may want to remove this&lt;br /&gt;
  translate &amp;lt;-.5, -.5, -.5&amp;gt;&lt;br /&gt;
  rotate &amp;lt;90,0,0&amp;gt;     // rotate it so that the projection of the texture is correct&lt;br /&gt;
  scale &amp;lt;1,-1,1&amp;gt;      // invert the y axis&lt;br /&gt;
  translate &amp;lt;0.5, 0.5, 0.5&amp;gt;&lt;br /&gt;
  texture {&lt;br /&gt;
    final_texture&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // now scale to the maps height x width&lt;br /&gt;
  scale &amp;lt;MAP_WIDTH, MAP_HEIGHT, MAP_EL&amp;gt;    &lt;br /&gt;
  // and center it for the camera&lt;br /&gt;
  translate &amp;lt;-MAP_WIDTH/2, -MAP_HEIGHT/2, -MAP_EL/2&amp;gt;   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** If you&#039;re going to add the metal placement stuff&lt;br /&gt;
// ** described below, you need to put it here!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
object {primaryHF}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
What we&#039;re essentially doing above is:&lt;br /&gt;
&lt;br /&gt;
* Setting up scene parameters: lighting, the orthographic camera, etc.&lt;br /&gt;
&lt;br /&gt;
* Defining a set of textures to display at different elevations and different slopes; and&lt;br /&gt;
&lt;br /&gt;
* Defining a heightmap that uses our png image and applies our texture to this object&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
&lt;br /&gt;
9.1)	Drop down menu &amp;quot;Render&amp;quot; &amp;gt; &amp;quot;Edit Settings/Render&amp;quot; &amp;gt; Click &amp;quot;Edit&amp;quot; button&lt;br /&gt;
&lt;br /&gt;
9.2)	Add text at bottom of file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[8192x8192, No AA  Spring]&lt;br /&gt;
Width=8192&lt;br /&gt;
Height=8192&lt;br /&gt;
Antialias=Off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
9.3) Save file&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray so that it re-reads the ini-file&lt;br /&gt;
&lt;br /&gt;
11) Select your new render size and click Render.  This creates a bitmap file: gen_pov_texture.bmp&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps).  I personally use [http://www.imagemagick.org/ imagemagick] to do this as it has a simple command line program &amp;quot;convert.exe&amp;quot; that will convert an image from one format to another and it works well with the very large bitmap image that comes out of the above steps.&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
Our blend function could actually be an image if you wanted finer control of a map&#039;s texture, by having sections of metal mixed with sections of wilderness, for example.  To do this, you would:&lt;br /&gt;
&lt;br /&gt;
1) Create a new png image the same size as your heightmap (although you could make it larger or smaller) and paint sections of the map that are to use your wilderness textures in white, and the sections that are to use your metal texture in black.  For effect you could do a slight blur on the image to create grey coloured transitions where the two sections meet.  For our example I created this:&lt;br /&gt;
&lt;br /&gt;
[http://img185.imageshack.us/my.php?image=texturedistributionpa8.png http://img185.imageshack.us/img185/2641/texturedistributionpa8.th.png]&lt;br /&gt;
&lt;br /&gt;
3) Change the &amp;quot;final_texture&amp;quot; texture name in your script to &amp;quot;final_nature_texture&amp;quot;&lt;br /&gt;
&lt;br /&gt;
4) Define a set of textures in a similar manner that define your metal textures (based on heights and slopes), with the final blended metal texture named &amp;quot;final_metal_texture&amp;quot;.  Don&#039;t forget to give them different names than the wilderness texture names are.&lt;br /&gt;
&lt;br /&gt;
5) Create a new &amp;quot;final_texture&amp;quot; that is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  image_pattern { png &amp;quot;texture_distribution.png&amp;quot; }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    final_metal_texture]&lt;br /&gt;
    [1.00    final_nature_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures - like &amp;quot;Painted Rock&amp;quot;.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
The povray install also includes a number of nice example procedural textures.&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A transparent texture&lt;br /&gt;
#declare Transparent_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
	pigment {color rgbt&amp;lt;0,0,0,1&amp;gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the&lt;br /&gt;
// Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_EL*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18768</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18768"/>
		<updated>2008-02-27T20:03:31Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: /* Complex Texture Map Combinations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a texture for a Spring map using the freeware Povray program.  Povray is an excellent [http://en.wikipedia.org/wiki/Ray_tracing raytracing] application that generates &amp;quot;scene&amp;quot; images using a scene definition language in a text file.  We can use it to create a map&#039;s texture by creating a heightfield object, putting our &amp;quot;camera&amp;quot; directly over the object, setting the camera to orthographic, and rendering a bitmap at our map&#039;s dimension.  The steps below will give you an easy enough to follow process to generate a nice map, but if you want to create different maps you&#039;ll need to learn Povray&#039;s scene definition language.  This language is easy enough to follow, but depending on your tastes you could be better off using a tool that specialises in maps and map textures, such as the excellent [http://www.bundysoft.com/L3DT/ L3DT].  &lt;br /&gt;
&lt;br /&gt;
The guide does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
Please note that a lot of the maths used in the scene definition file has only been tested on a 16x16 map (8192x8192 pixels).&lt;br /&gt;
&lt;br /&gt;
Warning:  The base textures I use in this example are all mostly rubbish that I created in a couple of minutes.  I would suggest that you do not use them in your own maps :)&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like [http://www.gimp.org/ The GIMP], which is good, and it&#039;s free).  Here is the one we&#039;ll use for our map (I created this in a hurry and it was quite a mistake that it ended up so similar to Altered Divide):&lt;br /&gt;
&lt;br /&gt;
[http://img441.imageshack.us/my.php?image=povmapheightbp9.png http://img441.imageshack.us/img441/8862/povmapheightbp9.th.png]&lt;br /&gt;
&lt;br /&gt;
Your map will need to be named povmap_height.png, but if you want to use another name, just update the pov script below to use your heightmap&#039;s actual name.&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level1zd7.png http://img176.imageshack.us/img176/953/level1zd7.th.png]&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
[http://img170.imageshack.us/my.php?image=level2pf6.png http://img170.imageshack.us/img170/6473/level2pf6.th.png]&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level3wv7.png http://img176.imageshack.us/img176/6159/level3wv7.th.png]&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope1on6.png http://img411.imageshack.us/img411/2153/slope1on6.th.png]&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope2fk7.png http://img411.imageshack.us/img411/8908/slope2fk7.th.png]&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Setup some parameters that we will use within the script&lt;br /&gt;
#declare MAP_WIDTH=8192;&lt;br /&gt;
#declare MAP_HEIGHT=8192;&lt;br /&gt;
#declare MAP_EL=600; // elevation&lt;br /&gt;
&lt;br /&gt;
global_settings { &lt;br /&gt;
  // ambient light level&lt;br /&gt;
  ambient_light rgb&amp;lt;1,1,1&amp;gt; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set a directional light&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;100,-100,100&amp;gt; * 20, color rgb 1&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at &amp;lt;1, 0, 0&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set the background colour&lt;br /&gt;
background {rgb&amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
// Define our camera position, and set it to &amp;quot;orthographic&amp;quot; (important :)&lt;br /&gt;
camera {&lt;br /&gt;
  orthographic&lt;br /&gt;
  location &amp;lt;0,0,MAP_EL + 90&amp;gt;    // position &amp;amp; direction of view&lt;br /&gt;
  look_at  &amp;lt;0,0,0&amp;gt;&lt;br /&gt;
  right MAP_WIDTH*x            // horizontal size of view&lt;br /&gt;
  up MAP_HEIGHT*z               // vertical size of view&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Define our primary textures **&lt;br /&gt;
 &lt;br /&gt;
// lowest texture (512 x 512)&lt;br /&gt;
// Found in low lying areas of the heightfield&lt;br /&gt;
#declare level1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// middle texture (512 x 512)&lt;br /&gt;
// Found in the middle areas of the heightfield&lt;br /&gt;
#declare level2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// highest texture (512 x 512)&lt;br /&gt;
// Found in the peaks / hills / mountains of the heightfield&lt;br /&gt;
#declare level3_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level3.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one level&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare levels_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 level1_texture]  // from 0.0 to 0.1 we have just level1.png&lt;br /&gt;
    [0.10 level1_texture]&lt;br /&gt;
                    // from 0.1 to 0.2 we blend from level1.png to level2.png&lt;br /&gt;
    [0.30 level2_texture]  // from 0.2 to 0.5 we have just level2.png&lt;br /&gt;
    [0.40 level2_texture]&lt;br /&gt;
                    // from 0.5 to 0.6 we blend from level2.png to level3.png&lt;br /&gt;
    [0.60  level3_texture]  // from 0.6 to 1.0 we have just level2.png&lt;br /&gt;
    [1.00  level3_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** Define textures used on areas of slope&lt;br /&gt;
&lt;br /&gt;
// lower slope texture (512 x 512)&lt;br /&gt;
#declare slope1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// upper slope texture (512 x 512)&lt;br /&gt;
#declare slope2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one slope&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare slopes_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 slope1_texture]&lt;br /&gt;
    [0.30 slope1_texture]&lt;br /&gt;
    &lt;br /&gt;
    [0.65  slope2_texture]&lt;br /&gt;
    [1.00  slope2_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Now define the final texture blending between the height textures &lt;br /&gt;
// and the slope textures:&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  slope {&lt;br /&gt;
    &amp;lt;0,0,-1&amp;gt;, 0, 0.5&lt;br /&gt;
  } &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    levels_elevation_texture]&lt;br /&gt;
    [0.06    levels_elevation_texture]&lt;br /&gt;
    [0.40    slopes_elevation_texture]&lt;br /&gt;
    [1.00    slopes_elevation_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
// ***!! Now we declare our heightfield object that uses this texture&lt;br /&gt;
#declare primaryHF=&lt;br /&gt;
height_field {&lt;br /&gt;
  png &amp;quot;povmap_height.png&amp;quot;                                  &lt;br /&gt;
  smooth              // smooth the heightfield&lt;br /&gt;
  no_shadow           // you may want to remove this&lt;br /&gt;
  translate &amp;lt;-.5, -.5, -.5&amp;gt;&lt;br /&gt;
  rotate &amp;lt;90,0,0&amp;gt;     // rotate it so that the projection of the texture is correct&lt;br /&gt;
  scale &amp;lt;1,-1,1&amp;gt;      // invert the y axis&lt;br /&gt;
  translate &amp;lt;0.5, 0.5, 0.5&amp;gt;&lt;br /&gt;
  texture {&lt;br /&gt;
    final_texture&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // now scale to the maps height x width&lt;br /&gt;
  scale &amp;lt;MAP_WIDTH, MAP_HEIGHT, MAP_EL&amp;gt;    &lt;br /&gt;
  // and center it for the camera&lt;br /&gt;
  translate &amp;lt;-MAP_WIDTH/2, -MAP_HEIGHT/2, -MAP_EL/2&amp;gt;   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** If you&#039;re going to add the metal placement stuff&lt;br /&gt;
// ** described below, you need to put it here!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
object {primaryHF}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
What we&#039;re essentially doing above is:&lt;br /&gt;
&lt;br /&gt;
* Setting up scene parameters: lighting, the orthographic camera, etc.&lt;br /&gt;
&lt;br /&gt;
* Defining a set of textures to display at different elevations and different slopes; and&lt;br /&gt;
&lt;br /&gt;
* Defining a heightmap that uses our png image and applies our texture to this object&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
&lt;br /&gt;
9.1)	Drop down menu &amp;quot;Render&amp;quot; &amp;gt; &amp;quot;Edit Settings/Render&amp;quot; &amp;gt; Click &amp;quot;Edit&amp;quot; button&lt;br /&gt;
&lt;br /&gt;
9.2)	Add text at bottom of file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[8192x8192, No AA  Spring]&lt;br /&gt;
Width=8192&lt;br /&gt;
Height=8192&lt;br /&gt;
Antialias=Off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
9.3) Save file&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray so that it re-reads the ini-file&lt;br /&gt;
&lt;br /&gt;
11) Select your new render size and click Render.  This creates a bitmap file: gen_pov_texture.bmp&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps).  I personally use [http://www.imagemagick.org/ imagemagick] to do this as it has a simple command line program &amp;quot;convert.exe&amp;quot; that will convert an image from one format to another and it works well with the very large bitmap image that comes out of the above steps.&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
Our blend function could actually be an image if you wanted finer control of a map&#039;s texture, by having sections of metal mixed with sections of wilderness, for example.  To do this, you would:&lt;br /&gt;
&lt;br /&gt;
1) Create a new png image the same size as your heightmap (although you could make it larger or smaller) and paint sections of the map that are to use your wilderness textures in white, and the sections that are to use your metal texture in black.  For effect you could do a slight blur on the image to create grey coloured transitions where the two sections meet.&lt;br /&gt;
&lt;br /&gt;
3) Change the &amp;quot;final_texture&amp;quot; texture name in your script to &amp;quot;final_nature_texture&amp;quot;&lt;br /&gt;
&lt;br /&gt;
4) Define a set of textures in a similar manner that define your metal textures (based on heights and slopes), with the final blended metal texture named &amp;quot;final_metal_texture&amp;quot;.  Don&#039;t forget to give them different names than the wilderness texture names are.&lt;br /&gt;
&lt;br /&gt;
5) Create a new &amp;quot;final_texture&amp;quot; that is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  image_pattern { png &amp;quot;texture_distribution.png&amp;quot; }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    final_metal_texture]&lt;br /&gt;
    [1.00    final_nature_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures - like &amp;quot;Painted Rock&amp;quot;.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
The povray install also includes a number of nice example procedural textures.&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A transparent texture&lt;br /&gt;
#declare Transparent_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
	pigment {color rgbt&amp;lt;0,0,0,1&amp;gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the&lt;br /&gt;
// Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_EL*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18767</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18767"/>
		<updated>2008-02-27T20:01:13Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: Undo revision 14237 by Tinnut (Talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a texture for a Spring map using the freeware Povray program.  Povray is an excellent [http://en.wikipedia.org/wiki/Ray_tracing raytracing] application that generates &amp;quot;scene&amp;quot; images using a scene definition language in a text file.  We can use it to create a map&#039;s texture by creating a heightfield object, putting our &amp;quot;camera&amp;quot; directly over the object, setting the camera to orthographic, and rendering a bitmap at our map&#039;s dimension.  The steps below will give you an easy enough to follow process to generate a nice map, but if you want to create different maps you&#039;ll need to learn Povray&#039;s scene definition language.  This language is easy enough to follow, but depending on your tastes you could be better off using a tool that specialises in maps and map textures, such as the excellent [http://www.bundysoft.com/L3DT/ L3DT].  &lt;br /&gt;
&lt;br /&gt;
The guide does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
Please note that a lot of the maths used in the scene definition file has only been tested on a 16x16 map (8192x8192 pixels).&lt;br /&gt;
&lt;br /&gt;
Warning:  The base textures I use in this example are all mostly rubbish that I created in a couple of minutes.  I would suggest that you do not use them in your own maps :)&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like [http://www.gimp.org/ The GIMP], which is good, and it&#039;s free).  Here is the one we&#039;ll use for our map (I created this in a hurry and it was quite a mistake that it ended up so similar to Altered Divide):&lt;br /&gt;
&lt;br /&gt;
[http://img441.imageshack.us/my.php?image=povmapheightbp9.png http://img441.imageshack.us/img441/8862/povmapheightbp9.th.png]&lt;br /&gt;
&lt;br /&gt;
Your map will need to be named povmap_height.png, but if you want to use another name, just update the pov script below to use your heightmap&#039;s actual name.&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level1zd7.png http://img176.imageshack.us/img176/953/level1zd7.th.png]&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
[http://img170.imageshack.us/my.php?image=level2pf6.png http://img170.imageshack.us/img170/6473/level2pf6.th.png]&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level3wv7.png http://img176.imageshack.us/img176/6159/level3wv7.th.png]&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope1on6.png http://img411.imageshack.us/img411/2153/slope1on6.th.png]&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope2fk7.png http://img411.imageshack.us/img411/8908/slope2fk7.th.png]&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Setup some parameters that we will use within the script&lt;br /&gt;
#declare MAP_WIDTH=8192;&lt;br /&gt;
#declare MAP_HEIGHT=8192;&lt;br /&gt;
#declare MAP_EL=600; // elevation&lt;br /&gt;
&lt;br /&gt;
global_settings { &lt;br /&gt;
  // ambient light level&lt;br /&gt;
  ambient_light rgb&amp;lt;1,1,1&amp;gt; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set a directional light&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;100,-100,100&amp;gt; * 20, color rgb 1&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at &amp;lt;1, 0, 0&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set the background colour&lt;br /&gt;
background {rgb&amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
// Define our camera position, and set it to &amp;quot;orthographic&amp;quot; (important :)&lt;br /&gt;
camera {&lt;br /&gt;
  orthographic&lt;br /&gt;
  location &amp;lt;0,0,MAP_EL + 90&amp;gt;    // position &amp;amp; direction of view&lt;br /&gt;
  look_at  &amp;lt;0,0,0&amp;gt;&lt;br /&gt;
  right MAP_WIDTH*x            // horizontal size of view&lt;br /&gt;
  up MAP_HEIGHT*z               // vertical size of view&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Define our primary textures **&lt;br /&gt;
 &lt;br /&gt;
// lowest texture (512 x 512)&lt;br /&gt;
// Found in low lying areas of the heightfield&lt;br /&gt;
#declare level1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// middle texture (512 x 512)&lt;br /&gt;
// Found in the middle areas of the heightfield&lt;br /&gt;
#declare level2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// highest texture (512 x 512)&lt;br /&gt;
// Found in the peaks / hills / mountains of the heightfield&lt;br /&gt;
#declare level3_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level3.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one level&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare levels_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 level1_texture]  // from 0.0 to 0.1 we have just level1.png&lt;br /&gt;
    [0.10 level1_texture]&lt;br /&gt;
                    // from 0.1 to 0.2 we blend from level1.png to level2.png&lt;br /&gt;
    [0.30 level2_texture]  // from 0.2 to 0.5 we have just level2.png&lt;br /&gt;
    [0.40 level2_texture]&lt;br /&gt;
                    // from 0.5 to 0.6 we blend from level2.png to level3.png&lt;br /&gt;
    [0.60  level3_texture]  // from 0.6 to 1.0 we have just level2.png&lt;br /&gt;
    [1.00  level3_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** Define textures used on areas of slope&lt;br /&gt;
&lt;br /&gt;
// lower slope texture (512 x 512)&lt;br /&gt;
#declare slope1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// upper slope texture (512 x 512)&lt;br /&gt;
#declare slope2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one slope&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare slopes_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 slope1_texture]&lt;br /&gt;
    [0.30 slope1_texture]&lt;br /&gt;
    &lt;br /&gt;
    [0.65  slope2_texture]&lt;br /&gt;
    [1.00  slope2_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Now define the final texture blending between the height textures &lt;br /&gt;
// and the slope textures:&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  slope {&lt;br /&gt;
    &amp;lt;0,0,-1&amp;gt;, 0, 0.5&lt;br /&gt;
  } &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    levels_elevation_texture]&lt;br /&gt;
    [0.06    levels_elevation_texture]&lt;br /&gt;
    [0.40    slopes_elevation_texture]&lt;br /&gt;
    [1.00    slopes_elevation_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
// ***!! Now we declare our heightfield object that uses this texture&lt;br /&gt;
#declare primaryHF=&lt;br /&gt;
height_field {&lt;br /&gt;
  png &amp;quot;povmap_height.png&amp;quot;                                  &lt;br /&gt;
  smooth              // smooth the heightfield&lt;br /&gt;
  no_shadow           // you may want to remove this&lt;br /&gt;
  translate &amp;lt;-.5, -.5, -.5&amp;gt;&lt;br /&gt;
  rotate &amp;lt;90,0,0&amp;gt;     // rotate it so that the projection of the texture is correct&lt;br /&gt;
  scale &amp;lt;1,-1,1&amp;gt;      // invert the y axis&lt;br /&gt;
  translate &amp;lt;0.5, 0.5, 0.5&amp;gt;&lt;br /&gt;
  texture {&lt;br /&gt;
    final_texture&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // now scale to the maps height x width&lt;br /&gt;
  scale &amp;lt;MAP_WIDTH, MAP_HEIGHT, MAP_EL&amp;gt;    &lt;br /&gt;
  // and center it for the camera&lt;br /&gt;
  translate &amp;lt;-MAP_WIDTH/2, -MAP_HEIGHT/2, -MAP_EL/2&amp;gt;   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** If you&#039;re going to add the metal placement stuff&lt;br /&gt;
// ** described below, you need to put it here!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
object {primaryHF}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
What we&#039;re essentially doing above is:&lt;br /&gt;
&lt;br /&gt;
* Setting up scene parameters: lighting, the orthographic camera, etc.&lt;br /&gt;
&lt;br /&gt;
* Defining a set of textures to display at different elevations and different slopes; and&lt;br /&gt;
&lt;br /&gt;
* Defining a heightmap that uses our png image and applies our texture to this object&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
&lt;br /&gt;
9.1)	Drop down menu &amp;quot;Render&amp;quot; &amp;gt; &amp;quot;Edit Settings/Render&amp;quot; &amp;gt; Click &amp;quot;Edit&amp;quot; button&lt;br /&gt;
&lt;br /&gt;
9.2)	Add text at bottom of file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[8192x8192, No AA  Spring]&lt;br /&gt;
Width=8192&lt;br /&gt;
Height=8192&lt;br /&gt;
Antialias=Off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
9.3) Save file&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray so that it re-reads the ini-file&lt;br /&gt;
&lt;br /&gt;
11) Select your new render size and click Render.  This creates a bitmap file: gen_pov_texture.bmp&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps).  I personally use [http://www.imagemagick.org/ imagemagick] to do this as it has a simple command line program &amp;quot;convert.exe&amp;quot; that will convert an image from one format to another and it works well with the very large bitmap image that comes out of the above steps.&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
Our blend function could actually be an image if you wanted finer control of a map&#039;s texture, by having sections of metal mixed with sections of wilderness, for example.  To do this, you would:&lt;br /&gt;
&lt;br /&gt;
1) Create a texture function:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getTextureType = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;texture_distribution.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
2) Create a png image the same size as your heightmap and paint sections of the map that are to use your wilderness textures in white, and the sections that are to use your metal texture in black.  For effect you could do a slight blur on the image to create grey coloured transitions where the two sections meet.&lt;br /&gt;
&lt;br /&gt;
3) Change the &amp;quot;final_texture&amp;quot; texture name in your script to &amp;quot;final_nature_texture&amp;quot;&lt;br /&gt;
&lt;br /&gt;
4) Define a set of textures in a similar manner that define your metal textures (based on heights and slopes), with the final blended metal texture named &amp;quot;final_metal_texture&amp;quot;.  Don&#039;t forget to give them different names than the wilderness texture names are.&lt;br /&gt;
&lt;br /&gt;
5) Create a new &amp;quot;final_texture&amp;quot; that is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  getTextureType &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    final_metal_texture]&lt;br /&gt;
    [1.00    final_nature_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures - like &amp;quot;Painted Rock&amp;quot;.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
The povray install also includes a number of nice example procedural textures.&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A transparent texture&lt;br /&gt;
#declare Transparent_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
	pigment {color rgbt&amp;lt;0,0,0,1&amp;gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the&lt;br /&gt;
// Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_EL*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18766</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18766"/>
		<updated>2008-02-27T19:52:58Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: /* Complex Texture Map Combinations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a texture for a Spring map using the freeware Povray program.  Povray is an excellent [http://en.wikipedia.org/wiki/Ray_tracing raytracing] application that generates &amp;quot;scene&amp;quot; images using a scene definition language in a text file.  We can use it to create a map&#039;s texture by creating a heightfield object, putting our &amp;quot;camera&amp;quot; directly over the object, setting the camera to orthographic, and rendering a bitmap at our map&#039;s dimension.  The steps below will give you an easy enough to follow process to generate a nice map, but if you want to create different maps you&#039;ll need to learn Povray&#039;s scene definition language.  This language is easy enough to follow, but depending on your tastes you could be better off using a tool that specialises in maps and map textures, such as the excellent [http://www.bundysoft.com/L3DT/ L3DT].  &lt;br /&gt;
&lt;br /&gt;
The guide does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
Please note that a lot of the maths used in the scene definition file has only been tested on a 16x16 map (8192x8192 pixels).&lt;br /&gt;
&lt;br /&gt;
Warning:  The base textures I use in this example are all mostly rubbish that I created in a couple of minutes.  I would suggest that you do not use them in your own maps :)&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like [http://www.gimp.org/ The GIMP], which is good, and it&#039;s free).  Here is the one we&#039;ll use for our map (I created this in a hurry and it was quite a mistake that it ended up so similar to Altered Divide):&lt;br /&gt;
&lt;br /&gt;
[http://img441.imageshack.us/my.php?image=povmapheightbp9.png http://img441.imageshack.us/img441/8862/povmapheightbp9.th.png]&lt;br /&gt;
&lt;br /&gt;
Your map will need to be named povmap_height.png, but if you want to use another name, just update the pov script below to use your heightmap&#039;s actual name.&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level1zd7.png http://img176.imageshack.us/img176/953/level1zd7.th.png]&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
[http://img170.imageshack.us/my.php?image=level2pf6.png http://img170.imageshack.us/img170/6473/level2pf6.th.png]&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level3wv7.png http://img176.imageshack.us/img176/6159/level3wv7.th.png]&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope1on6.png http://img411.imageshack.us/img411/2153/slope1on6.th.png]&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope2fk7.png http://img411.imageshack.us/img411/8908/slope2fk7.th.png]&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Setup some parameters that we will use within the script&lt;br /&gt;
#declare MAP_WIDTH=8192;&lt;br /&gt;
#declare MAP_HEIGHT=8192;&lt;br /&gt;
#declare MAP_EL=600; // elevation&lt;br /&gt;
&lt;br /&gt;
global_settings { &lt;br /&gt;
  // ambient light level&lt;br /&gt;
  ambient_light rgb&amp;lt;1,1,1&amp;gt; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set a directional light&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;100,-100,100&amp;gt; * 20, color rgb 1&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at &amp;lt;1, 0, 0&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set the background colour&lt;br /&gt;
background {rgb&amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
// Define our camera position, and set it to &amp;quot;orthographic&amp;quot; (important :)&lt;br /&gt;
camera {&lt;br /&gt;
  orthographic&lt;br /&gt;
  location &amp;lt;0,0,MAP_EL + 90&amp;gt;    // position &amp;amp; direction of view&lt;br /&gt;
  look_at  &amp;lt;0,0,0&amp;gt;&lt;br /&gt;
  right MAP_WIDTH*x            // horizontal size of view&lt;br /&gt;
  up MAP_HEIGHT*z               // vertical size of view&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Define our primary textures **&lt;br /&gt;
 &lt;br /&gt;
// lowest texture (512 x 512)&lt;br /&gt;
// Found in low lying areas of the heightfield&lt;br /&gt;
#declare level1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// middle texture (512 x 512)&lt;br /&gt;
// Found in the middle areas of the heightfield&lt;br /&gt;
#declare level2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// highest texture (512 x 512)&lt;br /&gt;
// Found in the peaks / hills / mountains of the heightfield&lt;br /&gt;
#declare level3_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level3.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one level&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare levels_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 level1_texture]  // from 0.0 to 0.1 we have just level1.png&lt;br /&gt;
    [0.10 level1_texture]&lt;br /&gt;
                    // from 0.1 to 0.2 we blend from level1.png to level2.png&lt;br /&gt;
    [0.30 level2_texture]  // from 0.2 to 0.5 we have just level2.png&lt;br /&gt;
    [0.40 level2_texture]&lt;br /&gt;
                    // from 0.5 to 0.6 we blend from level2.png to level3.png&lt;br /&gt;
    [0.60  level3_texture]  // from 0.6 to 1.0 we have just level2.png&lt;br /&gt;
    [1.00  level3_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** Define textures used on areas of slope&lt;br /&gt;
&lt;br /&gt;
// lower slope texture (512 x 512)&lt;br /&gt;
#declare slope1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// upper slope texture (512 x 512)&lt;br /&gt;
#declare slope2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one slope&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare slopes_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 slope1_texture]&lt;br /&gt;
    [0.30 slope1_texture]&lt;br /&gt;
    &lt;br /&gt;
    [0.65  slope2_texture]&lt;br /&gt;
    [1.00  slope2_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Now define the final texture blending between the height textures &lt;br /&gt;
// and the slope textures:&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  slope {&lt;br /&gt;
    &amp;lt;0,0,-1&amp;gt;, 0, 0.5&lt;br /&gt;
  } &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    levels_elevation_texture]&lt;br /&gt;
    [0.06    levels_elevation_texture]&lt;br /&gt;
    [0.40    slopes_elevation_texture]&lt;br /&gt;
    [1.00    slopes_elevation_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
// ***!! Now we declare our heightfield object that uses this texture&lt;br /&gt;
#declare primaryHF=&lt;br /&gt;
height_field {&lt;br /&gt;
  png &amp;quot;povmap_height.png&amp;quot;                                  &lt;br /&gt;
  smooth              // smooth the heightfield&lt;br /&gt;
  no_shadow           // you may want to remove this&lt;br /&gt;
  translate &amp;lt;-.5, -.5, -.5&amp;gt;&lt;br /&gt;
  rotate &amp;lt;90,0,0&amp;gt;     // rotate it so that the projection of the texture is correct&lt;br /&gt;
  scale &amp;lt;1,-1,1&amp;gt;      // invert the y axis&lt;br /&gt;
  translate &amp;lt;0.5, 0.5, 0.5&amp;gt;&lt;br /&gt;
  texture {&lt;br /&gt;
    final_texture&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // now scale to the maps height x width&lt;br /&gt;
  scale &amp;lt;MAP_WIDTH, MAP_HEIGHT, MAP_EL&amp;gt;    &lt;br /&gt;
  // and center it for the camera&lt;br /&gt;
  translate &amp;lt;-MAP_WIDTH/2, -MAP_HEIGHT/2, -MAP_EL/2&amp;gt;   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** If you&#039;re going to add the metal placement stuff&lt;br /&gt;
// ** described below, you need to put it here!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
object {primaryHF}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
What we&#039;re essentially doing above is:&lt;br /&gt;
&lt;br /&gt;
* Setting up scene parameters: lighting, the orthographic camera, etc.&lt;br /&gt;
&lt;br /&gt;
* Defining a set of textures to display at different elevations and different slopes; and&lt;br /&gt;
&lt;br /&gt;
* Defining a heightmap that uses our png image and applies our texture to this object&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
&lt;br /&gt;
9.1)	Drop down menu &amp;quot;Render&amp;quot; &amp;gt; &amp;quot;Edit Settings/Render&amp;quot; &amp;gt; Click &amp;quot;Edit&amp;quot; button&lt;br /&gt;
&lt;br /&gt;
9.2)	Add text at bottom of file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[8192x8192, No AA  Spring]&lt;br /&gt;
Width=8192&lt;br /&gt;
Height=8192&lt;br /&gt;
Antialias=Off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
9.3) Save file&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray so that it re-reads the ini-file&lt;br /&gt;
&lt;br /&gt;
11) Select your new render size and click Render.  This creates a bitmap file: gen_pov_texture.bmp&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps).  I personally use [http://www.imagemagick.org/ imagemagick] to do this as it has a simple command line program &amp;quot;convert.exe&amp;quot; that will convert an image from one format to another and it works well with the very large bitmap image that comes out of the above steps.&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures - like &amp;quot;Painted Rock&amp;quot;.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
The povray install also includes a number of nice example procedural textures.&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A transparent texture&lt;br /&gt;
#declare Transparent_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
	pigment {color rgbt&amp;lt;0,0,0,1&amp;gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the&lt;br /&gt;
// Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_EL*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18765</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18765"/>
		<updated>2008-02-27T19:38:46Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: /* Initial Steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a texture for a Spring map using the freeware Povray program.  Povray is an excellent [http://en.wikipedia.org/wiki/Ray_tracing raytracing] application that generates &amp;quot;scene&amp;quot; images using a scene definition language in a text file.  We can use it to create a map&#039;s texture by creating a heightfield object, putting our &amp;quot;camera&amp;quot; directly over the object, setting the camera to orthographic, and rendering a bitmap at our map&#039;s dimension.  The steps below will give you an easy enough to follow process to generate a nice map, but if you want to create different maps you&#039;ll need to learn Povray&#039;s scene definition language.  This language is easy enough to follow, but depending on your tastes you could be better off using a tool that specialises in maps and map textures, such as the excellent [http://www.bundysoft.com/L3DT/ L3DT].  &lt;br /&gt;
&lt;br /&gt;
The guide does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
Please note that a lot of the maths used in the scene definition file has only been tested on a 16x16 map (8192x8192 pixels).&lt;br /&gt;
&lt;br /&gt;
Warning:  The base textures I use in this example are all mostly rubbish that I created in a couple of minutes.  I would suggest that you do not use them in your own maps :)&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like [http://www.gimp.org/ The GIMP], which is good, and it&#039;s free).  Here is the one we&#039;ll use for our map (I created this in a hurry and it was quite a mistake that it ended up so similar to Altered Divide):&lt;br /&gt;
&lt;br /&gt;
[http://img441.imageshack.us/my.php?image=povmapheightbp9.png http://img441.imageshack.us/img441/8862/povmapheightbp9.th.png]&lt;br /&gt;
&lt;br /&gt;
Your map will need to be named povmap_height.png, but if you want to use another name, just update the pov script below to use your heightmap&#039;s actual name.&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level1zd7.png http://img176.imageshack.us/img176/953/level1zd7.th.png]&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
[http://img170.imageshack.us/my.php?image=level2pf6.png http://img170.imageshack.us/img170/6473/level2pf6.th.png]&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level3wv7.png http://img176.imageshack.us/img176/6159/level3wv7.th.png]&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope1on6.png http://img411.imageshack.us/img411/2153/slope1on6.th.png]&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope2fk7.png http://img411.imageshack.us/img411/8908/slope2fk7.th.png]&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Setup some parameters that we will use within the script&lt;br /&gt;
#declare MAP_WIDTH=8192;&lt;br /&gt;
#declare MAP_HEIGHT=8192;&lt;br /&gt;
#declare MAP_EL=600; // elevation&lt;br /&gt;
&lt;br /&gt;
global_settings { &lt;br /&gt;
  // ambient light level&lt;br /&gt;
  ambient_light rgb&amp;lt;1,1,1&amp;gt; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set a directional light&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;100,-100,100&amp;gt; * 20, color rgb 1&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at &amp;lt;1, 0, 0&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set the background colour&lt;br /&gt;
background {rgb&amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
// Define our camera position, and set it to &amp;quot;orthographic&amp;quot; (important :)&lt;br /&gt;
camera {&lt;br /&gt;
  orthographic&lt;br /&gt;
  location &amp;lt;0,0,MAP_EL + 90&amp;gt;    // position &amp;amp; direction of view&lt;br /&gt;
  look_at  &amp;lt;0,0,0&amp;gt;&lt;br /&gt;
  right MAP_WIDTH*x            // horizontal size of view&lt;br /&gt;
  up MAP_HEIGHT*z               // vertical size of view&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Define our primary textures **&lt;br /&gt;
 &lt;br /&gt;
// lowest texture (512 x 512)&lt;br /&gt;
// Found in low lying areas of the heightfield&lt;br /&gt;
#declare level1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// middle texture (512 x 512)&lt;br /&gt;
// Found in the middle areas of the heightfield&lt;br /&gt;
#declare level2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// highest texture (512 x 512)&lt;br /&gt;
// Found in the peaks / hills / mountains of the heightfield&lt;br /&gt;
#declare level3_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level3.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one level&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare levels_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 level1_texture]  // from 0.0 to 0.1 we have just level1.png&lt;br /&gt;
    [0.10 level1_texture]&lt;br /&gt;
                    // from 0.1 to 0.2 we blend from level1.png to level2.png&lt;br /&gt;
    [0.30 level2_texture]  // from 0.2 to 0.5 we have just level2.png&lt;br /&gt;
    [0.40 level2_texture]&lt;br /&gt;
                    // from 0.5 to 0.6 we blend from level2.png to level3.png&lt;br /&gt;
    [0.60  level3_texture]  // from 0.6 to 1.0 we have just level2.png&lt;br /&gt;
    [1.00  level3_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** Define textures used on areas of slope&lt;br /&gt;
&lt;br /&gt;
// lower slope texture (512 x 512)&lt;br /&gt;
#declare slope1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// upper slope texture (512 x 512)&lt;br /&gt;
#declare slope2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one slope&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare slopes_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 slope1_texture]&lt;br /&gt;
    [0.30 slope1_texture]&lt;br /&gt;
    &lt;br /&gt;
    [0.65  slope2_texture]&lt;br /&gt;
    [1.00  slope2_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Now define the final texture blending between the height textures &lt;br /&gt;
// and the slope textures:&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  slope {&lt;br /&gt;
    &amp;lt;0,0,-1&amp;gt;, 0, 0.5&lt;br /&gt;
  } &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    levels_elevation_texture]&lt;br /&gt;
    [0.06    levels_elevation_texture]&lt;br /&gt;
    [0.40    slopes_elevation_texture]&lt;br /&gt;
    [1.00    slopes_elevation_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
// ***!! Now we declare our heightfield object that uses this texture&lt;br /&gt;
#declare primaryHF=&lt;br /&gt;
height_field {&lt;br /&gt;
  png &amp;quot;povmap_height.png&amp;quot;                                  &lt;br /&gt;
  smooth              // smooth the heightfield&lt;br /&gt;
  no_shadow           // you may want to remove this&lt;br /&gt;
  translate &amp;lt;-.5, -.5, -.5&amp;gt;&lt;br /&gt;
  rotate &amp;lt;90,0,0&amp;gt;     // rotate it so that the projection of the texture is correct&lt;br /&gt;
  scale &amp;lt;1,-1,1&amp;gt;      // invert the y axis&lt;br /&gt;
  translate &amp;lt;0.5, 0.5, 0.5&amp;gt;&lt;br /&gt;
  texture {&lt;br /&gt;
    final_texture&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // now scale to the maps height x width&lt;br /&gt;
  scale &amp;lt;MAP_WIDTH, MAP_HEIGHT, MAP_EL&amp;gt;    &lt;br /&gt;
  // and center it for the camera&lt;br /&gt;
  translate &amp;lt;-MAP_WIDTH/2, -MAP_HEIGHT/2, -MAP_EL/2&amp;gt;   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** If you&#039;re going to add the metal placement stuff&lt;br /&gt;
// ** described below, you need to put it here!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
object {primaryHF}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
What we&#039;re essentially doing above is:&lt;br /&gt;
&lt;br /&gt;
* Setting up scene parameters: lighting, the orthographic camera, etc.&lt;br /&gt;
&lt;br /&gt;
* Defining a set of textures to display at different elevations and different slopes; and&lt;br /&gt;
&lt;br /&gt;
* Defining a heightmap that uses our png image and applies our texture to this object&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
&lt;br /&gt;
9.1)	Drop down menu &amp;quot;Render&amp;quot; &amp;gt; &amp;quot;Edit Settings/Render&amp;quot; &amp;gt; Click &amp;quot;Edit&amp;quot; button&lt;br /&gt;
&lt;br /&gt;
9.2)	Add text at bottom of file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[8192x8192, No AA  Spring]&lt;br /&gt;
Width=8192&lt;br /&gt;
Height=8192&lt;br /&gt;
Antialias=Off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
9.3) Save file&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray so that it re-reads the ini-file&lt;br /&gt;
&lt;br /&gt;
11) Select your new render size and click Render.  This creates a bitmap file: gen_pov_texture.bmp&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps).  I personally use [http://www.imagemagick.org/ imagemagick] to do this as it has a simple command line program &amp;quot;convert.exe&amp;quot; that will convert an image from one format to another and it works well with the very large bitmap image that comes out of the above steps.&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
Our blend function could actually be an image if you wanted finer control of a map&#039;s texture, by having sections of metal mixed with sections of wilderness, for example.  To do this, you would:&lt;br /&gt;
&lt;br /&gt;
1) Create a texture function:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getTextureType = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;texture_distribution.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
2) Create a png image the same size as your heightmap and paint sections of the map that are to use your wilderness textures in white, and the sections that are to use your metal texture in black.  For effect you could do a slight blur on the image to create grey coloured transitions where the two sections meet.&lt;br /&gt;
&lt;br /&gt;
3) Change the &amp;quot;final_texture&amp;quot; texture name in your script to &amp;quot;final_nature_texture&amp;quot;&lt;br /&gt;
&lt;br /&gt;
4) Define a set of textures in a similar manner that define your metal textures (based on heights and slopes), with the final blended metal texture named &amp;quot;final_metal_texture&amp;quot;.  Don&#039;t forget to give them different names than the wilderness texture names are.&lt;br /&gt;
&lt;br /&gt;
5) Create a new &amp;quot;final_texture&amp;quot; that is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  getTextureType &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    final_metal_texture]&lt;br /&gt;
    [1.00    final_nature_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures - like &amp;quot;Painted Rock&amp;quot;.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
The povray install also includes a number of nice example procedural textures.&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A transparent texture&lt;br /&gt;
#declare Transparent_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
	pigment {color rgbt&amp;lt;0,0,0,1&amp;gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the&lt;br /&gt;
// Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_EL*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18764</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18764"/>
		<updated>2008-02-27T19:35:45Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: /* Placing Metal Textures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a texture for a Spring map using the freeware Povray program.  Povray is an excellent [http://en.wikipedia.org/wiki/Ray_tracing raytracing] application that generates &amp;quot;scene&amp;quot; images using a scene definition language in a text file.  We can use it to create a map&#039;s texture by creating a heightfield object, putting our &amp;quot;camera&amp;quot; directly over the object, setting the camera to orthographic, and rendering a bitmap at our map&#039;s dimension.  The steps below will give you an easy enough to follow process to generate a nice map, but if you want to create different maps you&#039;ll need to learn Povray&#039;s scene definition language.  This language is easy enough to follow, but depending on your tastes you could be better off using a tool that specialises in maps and map textures, such as the excellent [http://www.bundysoft.com/L3DT/ L3DT].  &lt;br /&gt;
&lt;br /&gt;
The guide does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
Please note that a lot of the maths used in the scene definition file has only been tested on a 16x16 map (8192x8192 pixels).&lt;br /&gt;
&lt;br /&gt;
Warning:  The base textures I use in this example are all mostly rubbish that I created in a couple of minutes.  I would suggest that you do not use them in your own maps :)&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like [http://www.gimp.org/ The GIMP], which is good, and it&#039;s free).  Here is the one we&#039;ll use for our map (I created this in a hurry and it was quite a mistake that it ended up so similar to Altered Divide):&lt;br /&gt;
&lt;br /&gt;
[http://img441.imageshack.us/my.php?image=povmapheightbp9.png http://img441.imageshack.us/img441/8862/povmapheightbp9.th.png]&lt;br /&gt;
&lt;br /&gt;
Your map will need to be named povmap_height.png, but if you want to use another name, just update the pov script below to use your heightmap&#039;s actual name.&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level1zd7.png http://img176.imageshack.us/img176/953/level1zd7.th.png]&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
[http://img170.imageshack.us/my.php?image=level2pf6.png http://img170.imageshack.us/img170/6473/level2pf6.th.png]&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level3wv7.png http://img176.imageshack.us/img176/6159/level3wv7.th.png]&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope1on6.png http://img411.imageshack.us/img411/2153/slope1on6.th.png]&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope2fk7.png http://img411.imageshack.us/img411/8908/slope2fk7.th.png]&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Setup some parameters that we will use within the script&lt;br /&gt;
#declare MAP_WIDTH=8192;&lt;br /&gt;
#declare MAP_HEIGHT=8192;&lt;br /&gt;
#declare MAP_EL=600; // elevation&lt;br /&gt;
&lt;br /&gt;
global_settings { &lt;br /&gt;
  // ambient light level&lt;br /&gt;
  ambient_light rgb&amp;lt;1,1,1&amp;gt; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set a directional light&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;100,-100,100&amp;gt; * 20, color rgb 1&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at &amp;lt;1, 0, 0&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set the background colour&lt;br /&gt;
background {rgb&amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
// Define our camera position, and set it to &amp;quot;orthographic&amp;quot; (important :)&lt;br /&gt;
camera {&lt;br /&gt;
  orthographic&lt;br /&gt;
  location &amp;lt;0,0,MAP_EL + 90&amp;gt;    // position &amp;amp; direction of view&lt;br /&gt;
  look_at  &amp;lt;0,0,0&amp;gt;&lt;br /&gt;
  right MAP_WIDTH*x            // horizontal size of view&lt;br /&gt;
  up MAP_HEIGHT*z               // vertical size of view&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Define our primary textures **&lt;br /&gt;
 &lt;br /&gt;
// lowest texture (512 x 512)&lt;br /&gt;
// Found in low lying areas of the heightfield&lt;br /&gt;
#declare level1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// middle texture (512 x 512)&lt;br /&gt;
// Found in the middle areas of the heightfield&lt;br /&gt;
#declare level2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// highest texture (512 x 512)&lt;br /&gt;
// Found in the peaks / hills / mountains of the heightfield&lt;br /&gt;
#declare level3_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level3.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one level&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare levels_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 level1_texture]  // from 0.0 to 0.1 we have just level1.png&lt;br /&gt;
    [0.10 level1_texture]&lt;br /&gt;
                    // from 0.1 to 0.2 we blend from level1.png to level2.png&lt;br /&gt;
    [0.30 level2_texture]  // from 0.2 to 0.5 we have just level2.png&lt;br /&gt;
    [0.40 level2_texture]&lt;br /&gt;
                    // from 0.5 to 0.6 we blend from level2.png to level3.png&lt;br /&gt;
    [0.60  level3_texture]  // from 0.6 to 1.0 we have just level2.png&lt;br /&gt;
    [1.00  level3_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** Define textures used on areas of slope&lt;br /&gt;
&lt;br /&gt;
// lower slope texture (512 x 512)&lt;br /&gt;
#declare slope1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// upper slope texture (512 x 512)&lt;br /&gt;
#declare slope2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one slope&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare slopes_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 slope1_texture]&lt;br /&gt;
    [0.30 slope1_texture]&lt;br /&gt;
    &lt;br /&gt;
    [0.65  slope2_texture]&lt;br /&gt;
    [1.00  slope2_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Now define the final texture blending between the height textures &lt;br /&gt;
// and the slope textures:&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  slope {&lt;br /&gt;
    &amp;lt;0,0,-1&amp;gt;, 0, 0.5&lt;br /&gt;
  } &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    levels_elevation_texture]&lt;br /&gt;
    [0.06    levels_elevation_texture]&lt;br /&gt;
    [0.40    slopes_elevation_texture]&lt;br /&gt;
    [1.00    slopes_elevation_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
// ***!! Now we declare our heightfield object that uses this texture&lt;br /&gt;
height_field {&lt;br /&gt;
  png &amp;quot;povmap_height.png&amp;quot;                                  &lt;br /&gt;
  smooth              // smooth the heightfield&lt;br /&gt;
  no_shadow           // you may want to remove this&lt;br /&gt;
  translate &amp;lt;-.5, -.5, -.5&amp;gt;&lt;br /&gt;
  rotate &amp;lt;90,0,0&amp;gt;     // rotate it so that the projection of the texture is correct&lt;br /&gt;
  scale &amp;lt;1,-1,1&amp;gt;      // invert the y axis&lt;br /&gt;
  translate &amp;lt;0.5, 0.5, 0.5&amp;gt;&lt;br /&gt;
  texture {&lt;br /&gt;
    final_texture&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // now scale to the maps height x width&lt;br /&gt;
  scale &amp;lt;MAP_WIDTH, MAP_HEIGHT, MAP_EL&amp;gt;    &lt;br /&gt;
  // and center it for the camera&lt;br /&gt;
  translate &amp;lt;-MAP_WIDTH/2, -MAP_HEIGHT/2, -MAP_EL/2&amp;gt;   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
What we&#039;re essentially doing above is:&lt;br /&gt;
&lt;br /&gt;
* Setting up scene parameters: lighting, the orthographic camera, etc.&lt;br /&gt;
&lt;br /&gt;
* Defining a set of textures to display at different elevations and different slopes; and&lt;br /&gt;
&lt;br /&gt;
* Defining a heightmap that uses our png image and applies our texture to this object&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
&lt;br /&gt;
9.1)	Drop down menu &amp;quot;Render&amp;quot; &amp;gt; &amp;quot;Edit Settings/Render&amp;quot; &amp;gt; Click &amp;quot;Edit&amp;quot; button&lt;br /&gt;
&lt;br /&gt;
9.2)	Add text at bottom of file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[8192x8192, No AA  Spring]&lt;br /&gt;
Width=8192&lt;br /&gt;
Height=8192&lt;br /&gt;
Antialias=Off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
9.3) Save file&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray so that it re-reads the ini-file&lt;br /&gt;
&lt;br /&gt;
11) Select your new render size and click Render.  This creates a bitmap file: gen_pov_texture.bmp&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps).  I personally use [http://www.imagemagick.org/ imagemagick] to do this as it has a simple command line program &amp;quot;convert.exe&amp;quot; that will convert an image from one format to another and it works well with the very large bitmap image that comes out of the above steps.&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
Our blend function could actually be an image if you wanted finer control of a map&#039;s texture, by having sections of metal mixed with sections of wilderness, for example.  To do this, you would:&lt;br /&gt;
&lt;br /&gt;
1) Create a texture function:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getTextureType = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;texture_distribution.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
2) Create a png image the same size as your heightmap and paint sections of the map that are to use your wilderness textures in white, and the sections that are to use your metal texture in black.  For effect you could do a slight blur on the image to create grey coloured transitions where the two sections meet.&lt;br /&gt;
&lt;br /&gt;
3) Change the &amp;quot;final_texture&amp;quot; texture name in your script to &amp;quot;final_nature_texture&amp;quot;&lt;br /&gt;
&lt;br /&gt;
4) Define a set of textures in a similar manner that define your metal textures (based on heights and slopes), with the final blended metal texture named &amp;quot;final_metal_texture&amp;quot;.  Don&#039;t forget to give them different names than the wilderness texture names are.&lt;br /&gt;
&lt;br /&gt;
5) Create a new &amp;quot;final_texture&amp;quot; that is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  getTextureType &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    final_metal_texture]&lt;br /&gt;
    [1.00    final_nature_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures - like &amp;quot;Painted Rock&amp;quot;.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
The povray install also includes a number of nice example procedural textures.&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A transparent texture&lt;br /&gt;
#declare Transparent_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
	pigment {color rgbt&amp;lt;0,0,0,1&amp;gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the&lt;br /&gt;
// Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_EL*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Map_development&amp;diff=13265</id>
		<title>Map development</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Map_development&amp;diff=13265"/>
		<updated>2008-02-27T09:59:18Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: /* Specific Guides */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Map making SM3=&lt;br /&gt;
&lt;br /&gt;
SM3 (Spring Mapformat 3) is getting allong nicely and maps using this format can be made. The following is documented so far.&lt;br /&gt;
&lt;br /&gt;
*[[SM3_Map_Format|jcnossen&#039;s brief description on how this mapformat works.]]&lt;br /&gt;
*[[SM3_FAQ|The first FAQ for the new mapformat.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:sm3-minimap-thumb.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Map making, SMF=&lt;br /&gt;
Maps, are a complex mixture of heightmaps and textures.&lt;br /&gt;
Fortunately, there are several people who share their knowledge with us.&lt;br /&gt;
There few tutorials will make your life as mapper a lot better.&lt;br /&gt;
&lt;br /&gt;
=Skyboxes=&lt;br /&gt;
*[[Skyboxcreation|Notes about skyboxes]] notes on a prerendered sky box or cube map.&lt;br /&gt;
&lt;br /&gt;
== Full Guides For Map Making ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[Create_maps|aGorm&#039;s map creating Guide]]&lt;br /&gt;
*[[Map_Making_Guide|aGorms Ultimate Map Making Guide(unfinished)]]&lt;br /&gt;
*[[IceXuick_Map_Design_Help|IceXuicks Map creating Guide]]&lt;br /&gt;
*[http://taspring.clan-sy.com/phpbb/viewtopic.php?t=3941 Forboding Angel&#039;s map creating Tutorial]&lt;br /&gt;
*[[Maps:Tutorial|Another tutorial from a designing point of view]]&lt;br /&gt;
*[[A_Complete_Map_Making_Tutorial|A Complete Map Making Tutorial (under construction)]]&lt;br /&gt;
*[[Runecrafter|Runecrafter&#039;s Map Tutorial]]&lt;br /&gt;
*[[Zorbawic%27s_Map_Design_Help_in_Polish_language_%28Jak_zrobi%C4%87_mape_do_Springa_-_po_Polsku%29| Zorbawic&#039;s Map Design Help in Polish language (Jak zrobiÃ„â€¡ mape do Springa - po Polsku)]]&lt;br /&gt;
&lt;br /&gt;
== Specific Guides ==&lt;br /&gt;
&lt;br /&gt;
*[[Quanto_OTAMAP_Guide|Quanto&#039;s Guide to OTA Porting and Small Maps]]&lt;br /&gt;
*[[Maps:SMD|Everything about .SMD]]&lt;br /&gt;
*[[Maps:Compiling|Everything about Compiling your map]]&lt;br /&gt;
*[[MapsBalance|Some things about map balance]]&lt;br /&gt;
*[[MapSizes|Map sizes in pixels]] and memory information about map sizes&lt;br /&gt;
*[[Height Map Tutorial|RogerN&#039;s height map tutorial]]&lt;br /&gt;
*[[Create_map_texture_with_povray|Basic howto: create map texture with Povray]]&lt;br /&gt;
&lt;br /&gt;
Features. Stones, rocks, trees, for your map can be found in [http://taspring.clan-sy.com/phpbb/viewtopic.php?t=4047 This thread]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Tools ==&lt;br /&gt;
&lt;br /&gt;
*[http://taspring.clan-sy.com/phpbb/viewtopic.php?t=2420 Maelstrom&#039;s SMD Generator]&lt;br /&gt;
*[http://www.fileuniverse.com/?p=show&amp;amp;a=it&amp;amp;id=1507 Mother&#039;s Mapconv]&lt;br /&gt;
*[http://user.supradigital.org/jcnossen/FeaturePlacer.zip Jnossen&#039;s SM3 feature placer]&lt;br /&gt;
*[[Maps:Map Designer]] Hugh&#039;s 3D map designer.  Splatting, heightmap editing, splat painting, SM3&lt;br /&gt;
*[http://modinfo.unknown-files.net/coord/mapcoords.php Online starting position creator]&lt;br /&gt;
: You can always find out which x/y coordinates are good while starting spring and having a look at the mouse cursor coordinates.&lt;br /&gt;
&lt;br /&gt;
== Mappers Clan ==&lt;br /&gt;
[[Map Making Guild]]: That weird fish aGorm set up a clan for poor mappers that can&#039;t get into a clan on there gaming merit... (Mainly for himself therefor...)&lt;br /&gt;
&lt;br /&gt;
== Reference and FAQs ==&lt;br /&gt;
&lt;br /&gt;
* [[Maps:Noob Mistakes]]&lt;br /&gt;
* [[Water Height: Mapconv vs. Heightmap]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
TIPS:&lt;br /&gt;
&lt;br /&gt;
A useful tip, on almost every map in a 1v1 you will start opposite your opponent unless you choose your position. this is because random order simply randomly distributes players at the default start points which in almost every map are opposite each other. One exception that I know of is flooded desert where you both start on the left hand island.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039; [[Main_Page|&amp;lt;- Back to Main page]]&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[Category:Map development]]&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18763</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18763"/>
		<updated>2008-02-27T09:53:41Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: /* Howto: Create a map&amp;#039;s texture using Povray to generate the texture */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a texture for a Spring map using the freeware Povray program.  Povray is an excellent [http://en.wikipedia.org/wiki/Ray_tracing raytracing] application that generates &amp;quot;scene&amp;quot; images using a scene definition language in a text file.  We can use it to create a map&#039;s texture by creating a heightfield object, putting our &amp;quot;camera&amp;quot; directly over the object, setting the camera to orthographic, and rendering a bitmap at our map&#039;s dimension.  The steps below will give you an easy enough to follow process to generate a nice map, but if you want to create different maps you&#039;ll need to learn Povray&#039;s scene definition language.  This language is easy enough to follow, but depending on your tastes you could be better off using a tool that specialises in maps and map textures, such as the excellent [http://www.bundysoft.com/L3DT/ L3DT].  &lt;br /&gt;
&lt;br /&gt;
The guide does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
Please note that a lot of the maths used in the scene definition file has only been tested on a 16x16 map (8192x8192 pixels).&lt;br /&gt;
&lt;br /&gt;
Warning:  The base textures I use in this example are all mostly rubbish that I created in a couple of minutes.  I would suggest that you do not use them in your own maps :)&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like [http://www.gimp.org/ The GIMP], which is good, and it&#039;s free).  Here is the one we&#039;ll use for our map (I created this in a hurry and it was quite a mistake that it ended up so similar to Altered Divide):&lt;br /&gt;
&lt;br /&gt;
[http://img441.imageshack.us/my.php?image=povmapheightbp9.png http://img441.imageshack.us/img441/8862/povmapheightbp9.th.png]&lt;br /&gt;
&lt;br /&gt;
Your map will need to be named povmap_height.png, but if you want to use another name, just update the pov script below to use your heightmap&#039;s actual name.&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level1zd7.png http://img176.imageshack.us/img176/953/level1zd7.th.png]&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
[http://img170.imageshack.us/my.php?image=level2pf6.png http://img170.imageshack.us/img170/6473/level2pf6.th.png]&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
[http://img176.imageshack.us/my.php?image=level3wv7.png http://img176.imageshack.us/img176/6159/level3wv7.th.png]&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope1on6.png http://img411.imageshack.us/img411/2153/slope1on6.th.png]&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
[http://img411.imageshack.us/my.php?image=slope2fk7.png http://img411.imageshack.us/img411/8908/slope2fk7.th.png]&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Setup some parameters that we will use within the script&lt;br /&gt;
#declare MAP_WIDTH=8192;&lt;br /&gt;
#declare MAP_HEIGHT=8192;&lt;br /&gt;
#declare MAP_EL=600; // elevation&lt;br /&gt;
&lt;br /&gt;
global_settings { &lt;br /&gt;
  // ambient light level&lt;br /&gt;
  ambient_light rgb&amp;lt;1,1,1&amp;gt; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set a directional light&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;100,-100,100&amp;gt; * 20, color rgb 1&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at &amp;lt;1, 0, 0&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set the background colour&lt;br /&gt;
background {rgb&amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
// Define our camera position, and set it to &amp;quot;orthographic&amp;quot; (important :)&lt;br /&gt;
camera {&lt;br /&gt;
  orthographic&lt;br /&gt;
  location &amp;lt;0,0,MAP_EL + 90&amp;gt;    // position &amp;amp; direction of view&lt;br /&gt;
  look_at  &amp;lt;0,0,0&amp;gt;&lt;br /&gt;
  right MAP_WIDTH*x            // horizontal size of view&lt;br /&gt;
  up MAP_HEIGHT*z               // vertical size of view&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Define our primary textures **&lt;br /&gt;
 &lt;br /&gt;
// lowest texture (512 x 512)&lt;br /&gt;
// Found in low lying areas of the heightfield&lt;br /&gt;
#declare level1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// middle texture (512 x 512)&lt;br /&gt;
// Found in the middle areas of the heightfield&lt;br /&gt;
#declare level2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// highest texture (512 x 512)&lt;br /&gt;
// Found in the peaks / hills / mountains of the heightfield&lt;br /&gt;
#declare level3_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level3.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one level&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare levels_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 level1_texture]  // from 0.0 to 0.1 we have just level1.png&lt;br /&gt;
    [0.10 level1_texture]&lt;br /&gt;
                    // from 0.1 to 0.2 we blend from level1.png to level2.png&lt;br /&gt;
    [0.30 level2_texture]  // from 0.2 to 0.5 we have just level2.png&lt;br /&gt;
    [0.40 level2_texture]&lt;br /&gt;
                    // from 0.5 to 0.6 we blend from level2.png to level3.png&lt;br /&gt;
    [0.60  level3_texture]  // from 0.6 to 1.0 we have just level2.png&lt;br /&gt;
    [1.00  level3_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** Define textures used on areas of slope&lt;br /&gt;
&lt;br /&gt;
// lower slope texture (512 x 512)&lt;br /&gt;
#declare slope1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// upper slope texture (512 x 512)&lt;br /&gt;
#declare slope2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one slope&#039;s texture to the next, &lt;br /&gt;
// depending on elevation:&lt;br /&gt;
#declare slopes_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 slope1_texture]&lt;br /&gt;
    [0.30 slope1_texture]&lt;br /&gt;
    &lt;br /&gt;
    [0.65  slope2_texture]&lt;br /&gt;
    [1.00  slope2_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Now define the final texture blending between the height textures &lt;br /&gt;
// and the slope textures:&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  slope {&lt;br /&gt;
    &amp;lt;0,0,-1&amp;gt;, 0, 0.5&lt;br /&gt;
  } &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    levels_elevation_texture]&lt;br /&gt;
    [0.06    levels_elevation_texture]&lt;br /&gt;
    [0.40    slopes_elevation_texture]&lt;br /&gt;
    [1.00    slopes_elevation_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
// ***!! Now we declare our heightfield object that uses this texture&lt;br /&gt;
height_field {&lt;br /&gt;
  png &amp;quot;povmap_height.png&amp;quot;                                  &lt;br /&gt;
  smooth              // smooth the heightfield&lt;br /&gt;
  no_shadow           // you may want to remove this&lt;br /&gt;
  translate &amp;lt;-.5, -.5, -.5&amp;gt;&lt;br /&gt;
  rotate &amp;lt;90,0,0&amp;gt;     // rotate it so that the projection of the texture is correct&lt;br /&gt;
  scale &amp;lt;1,-1,1&amp;gt;      // invert the y axis&lt;br /&gt;
  translate &amp;lt;0.5, 0.5, 0.5&amp;gt;&lt;br /&gt;
  texture {&lt;br /&gt;
    final_texture&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // now scale to the maps height x width&lt;br /&gt;
  scale &amp;lt;MAP_WIDTH, MAP_HEIGHT, MAP_EL&amp;gt;    &lt;br /&gt;
  // and center it for the camera&lt;br /&gt;
  translate &amp;lt;-MAP_WIDTH/2, -MAP_HEIGHT/2, -MAP_EL/2&amp;gt;   &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
What we&#039;re essentially doing above is:&lt;br /&gt;
&lt;br /&gt;
* Setting up scene parameters: lighting, the orthographic camera, etc.&lt;br /&gt;
&lt;br /&gt;
* Defining a set of textures to display at different elevations and different slopes; and&lt;br /&gt;
&lt;br /&gt;
* Defining a heightmap that uses our png image and applies our texture to this object&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
&lt;br /&gt;
9.1)	Drop down menu &amp;quot;Render&amp;quot; &amp;gt; &amp;quot;Edit Settings/Render&amp;quot; &amp;gt; Click &amp;quot;Edit&amp;quot; button&lt;br /&gt;
&lt;br /&gt;
9.2)	Add text at bottom of file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[8192x8192, No AA  Spring]&lt;br /&gt;
Width=8192&lt;br /&gt;
Height=8192&lt;br /&gt;
Antialias=Off&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
9.3) Save file&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray so that it re-reads the ini-file&lt;br /&gt;
&lt;br /&gt;
11) Select your new render size and click Render.  This creates a bitmap file: gen_pov_texture.bmp&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps).  I personally use [http://www.imagemagick.org/ imagemagick] to do this as it has a simple command line program &amp;quot;convert.exe&amp;quot; that will convert an image from one format to another and it works well with the very large bitmap image that comes out of the above steps.&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
Our blend function could actually be an image if you wanted finer control of a map&#039;s texture, by having sections of metal mixed with sections of wilderness, for example.  To do this, you would:&lt;br /&gt;
&lt;br /&gt;
1) Create a texture function:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getTextureType = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;texture_distribution.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
2) Create a png image the same size as your heightmap and paint sections of the map that are to use your wilderness textures in white, and the sections that are to use your metal texture in black.  For effect you could do a slight blur on the image to create grey coloured transitions where the two sections meet.&lt;br /&gt;
&lt;br /&gt;
3) Change the &amp;quot;final_texture&amp;quot; texture name in your script to &amp;quot;final_nature_texture&amp;quot;&lt;br /&gt;
&lt;br /&gt;
4) Define a set of textures in a similar manner that define your metal textures (based on heights and slopes), with the final blended metal texture named &amp;quot;final_metal_texture&amp;quot;.  Don&#039;t forget to give them different names than the wilderness texture names are.&lt;br /&gt;
&lt;br /&gt;
5) Create a new &amp;quot;final_texture&amp;quot; that is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  getTextureType &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    final_metal_texture]&lt;br /&gt;
    [1.00    final_nature_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures - like &amp;quot;Painted Rock&amp;quot;.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
The povray install also includes a number of nice example procedural textures.&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A transparent texture&lt;br /&gt;
#declare Transparent_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
	pigment {color rgbt&amp;lt;0,0,0,1&amp;gt;}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the&lt;br /&gt;
// Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:90%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_EL*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18762</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18762"/>
		<updated>2008-02-26T10:53:55Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: /* Initial Steps */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a Spring map&#039;s texture using the freeware Povray program.  It does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like The GIMP).  Here is the one we&#039;ll use for our map:&lt;br /&gt;
[http://img441.imageshack.us/my.php?image=povmapheightbp9.png http://img441.imageshack.us/img441/8862/povmapheightbp9.th.png]&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Setup some parameters that we will use within the script&lt;br /&gt;
#declare MAP_WIDTH=8192;&lt;br /&gt;
#declare MAP_HEIGHT=8192;&lt;br /&gt;
#declare MAP_ELEVATION=600;&lt;br /&gt;
&lt;br /&gt;
global_settings { &lt;br /&gt;
  // ambient light level&lt;br /&gt;
  ambient_light rgb&amp;lt;1,1,1&amp;gt; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set a directional light&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;100,-100,100&amp;gt; * 20, color rgb 1&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at &amp;lt;1, 0, 0&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set the background colour&lt;br /&gt;
background {rgb&amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
// Define our camera position, and set it to &amp;quot;orthographic&amp;quot; (important :)&lt;br /&gt;
camera {&lt;br /&gt;
  orthographic&lt;br /&gt;
  location &amp;lt;0,0,MAP_ELEVATION + 90&amp;gt;    // position &amp;amp; direction of view&lt;br /&gt;
  look_at  &amp;lt;0,0,0&amp;gt;&lt;br /&gt;
  right MAP_WIDTH*x            // horizontal size of view&lt;br /&gt;
  up MAP_HEIGHT*z               // vertical size of view&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Define our primary textures **&lt;br /&gt;
 &lt;br /&gt;
// lowest texture (512 x 512)&lt;br /&gt;
// Found in low lying areas of the heightfield&lt;br /&gt;
#declare level1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// middle texture (512 x 512)&lt;br /&gt;
// Found in the middle areas of the heightfield&lt;br /&gt;
#declare level2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// highest texture (512 x 512)&lt;br /&gt;
// Found in the peaks / hills / mountains of the heightfield&lt;br /&gt;
#declare level3_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level3.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one level&#039;s texture to the next, depending on elevation:&lt;br /&gt;
#declare levels_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 level1_texture]  // from 0.0 to 0.1 we have just level1.png&lt;br /&gt;
    [0.10 level1_texture]&lt;br /&gt;
                           // from 0.1 to 0.2 we blend from level1.png to level2.png&lt;br /&gt;
    [0.30 level2_texture]  // from 0.2 to 0.5 we have just level2.png&lt;br /&gt;
    [0.40 level2_texture]&lt;br /&gt;
                           // from 0.5 to 0.6 we blend from level2.png to level3.png&lt;br /&gt;
    [0.60  level3_texture]  // from 0.6 to 1.0 we have just level2.png&lt;br /&gt;
    [1.00  level3_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** Define textures used on areas of slope&lt;br /&gt;
&lt;br /&gt;
// lower slope texture (512 x 512)&lt;br /&gt;
#declare slope1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// upper slope texture (512 x 512)&lt;br /&gt;
#declare slope2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one slope&#039;s texture to the next, depending on elevation:&lt;br /&gt;
#declare slopes_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 slope1_texture]&lt;br /&gt;
    [0.30 slope1_texture]&lt;br /&gt;
    &lt;br /&gt;
    [0.65  slope2_texture]&lt;br /&gt;
    [1.00  slope2_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Now define the final texture blending between the height textures and the slope textures:&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  slope {&lt;br /&gt;
    &amp;lt;0,0,-1&amp;gt;, 0, 0.5&lt;br /&gt;
  } &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    levels_elevation_texture]&lt;br /&gt;
    [0.06    levels_elevation_texture]&lt;br /&gt;
    [0.40    slopes_elevation_texture]&lt;br /&gt;
    [1.00    slopes_elevation_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
// ***!! Now we declare our heightfield object that uses this texture&lt;br /&gt;
height_field {&lt;br /&gt;
  png &amp;quot;povmap_height.png&amp;quot;                                  &lt;br /&gt;
  smooth              // smooth the heightfield&lt;br /&gt;
  no_shadow           // you may want to remove this&lt;br /&gt;
  translate &amp;lt;-.5, -.5, -.5&amp;gt;&lt;br /&gt;
  rotate &amp;lt;90,0,0&amp;gt;     // rotate it so that the projection of the texture is correct&lt;br /&gt;
  scale &amp;lt;1,-1,1&amp;gt;      // invert the y axis&lt;br /&gt;
  translate &amp;lt;0.5, 0.5, 0.5&amp;gt;&lt;br /&gt;
  texture {&lt;br /&gt;
    final_texture&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  scale &amp;lt;MAP_WIDTH, MAP_HEIGHT, MAP_ELEVATION&amp;gt;    // now scale to the maps height x width&lt;br /&gt;
  translate &amp;lt;-MAP_WIDTH/2, -MAP_HEIGHT/2, -MAP_ELEVATION/2&amp;gt;   // and center it for the camera&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
9.1)&lt;br /&gt;
9.2)&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray&lt;br /&gt;
&lt;br /&gt;
11) Select your new reder size Click Render&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps)&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18761</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18761"/>
		<updated>2008-02-26T09:42:42Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a Spring map&#039;s texture using the freeware Povray program.  It does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like The GIMP).  Here is the one we&#039;ll use for our map:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Setup some parameters that we will use within the script&lt;br /&gt;
#declare MAP_WIDTH=8192;&lt;br /&gt;
#declare MAP_HEIGHT=8192;&lt;br /&gt;
#declare MAP_ELEVATION=600;&lt;br /&gt;
&lt;br /&gt;
global_settings { &lt;br /&gt;
  // ambient light level&lt;br /&gt;
  ambient_light rgb&amp;lt;1,1,1&amp;gt; &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set a directional light&lt;br /&gt;
light_source {&lt;br /&gt;
  &amp;lt;100,-100,100&amp;gt; * 20, color rgb 1&lt;br /&gt;
  parallel&lt;br /&gt;
  point_at &amp;lt;1, 0, 0&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Set the background colour&lt;br /&gt;
background {rgb&amp;lt;1,1,1&amp;gt;}&lt;br /&gt;
&lt;br /&gt;
// Define our camera position, and set it to &amp;quot;orthographic&amp;quot; (important :)&lt;br /&gt;
camera {&lt;br /&gt;
  orthographic&lt;br /&gt;
  location &amp;lt;0,0,MAP_ELEVATION + 90&amp;gt;    // position &amp;amp; direction of view&lt;br /&gt;
  look_at  &amp;lt;0,0,0&amp;gt;&lt;br /&gt;
  right MAP_WIDTH*x            // horizontal size of view&lt;br /&gt;
  up MAP_HEIGHT*z               // vertical size of view&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Define our primary textures **&lt;br /&gt;
 &lt;br /&gt;
// lowest texture (512 x 512)&lt;br /&gt;
// Found in low lying areas of the heightfield&lt;br /&gt;
#declare level1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// middle texture (512 x 512)&lt;br /&gt;
// Found in the middle areas of the heightfield&lt;br /&gt;
#declare level2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// highest texture (512 x 512)&lt;br /&gt;
// Found in the peaks / hills / mountains of the heightfield&lt;br /&gt;
#declare level3_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;level3.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one level&#039;s texture to the next, depending on elevation:&lt;br /&gt;
#declare levels_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 level1_texture]  // from 0.0 to 0.1 we have just level1.png&lt;br /&gt;
    [0.10 level1_texture]&lt;br /&gt;
                           // from 0.1 to 0.2 we blend from level1.png to level2.png&lt;br /&gt;
    [0.30 level2_texture]  // from 0.2 to 0.5 we have just level2.png&lt;br /&gt;
    [0.40 level2_texture]&lt;br /&gt;
                           // from 0.5 to 0.6 we blend from level2.png to level3.png&lt;br /&gt;
    [0.60  level3_texture]  // from 0.6 to 1.0 we have just level2.png&lt;br /&gt;
    [1.00  level3_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// ** Define textures used on areas of slope&lt;br /&gt;
&lt;br /&gt;
// lower slope texture (512 x 512)&lt;br /&gt;
#declare slope1_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope1.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// upper slope texture (512 x 512)&lt;br /&gt;
#declare slope2_texture =&lt;br /&gt;
texture {&lt;br /&gt;
  pigment {&lt;br /&gt;
    image_map {&lt;br /&gt;
      png &amp;quot;slope2.png&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  finish {ambient 1 diffuse 0}&lt;br /&gt;
  scale &amp;lt;512/MAP_WIDTH, 512/MAP_WIDTH, 512/MAP_WIDTH&amp;gt;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Define a texture that blends from one slope&#039;s texture to the next, depending on elevation:&lt;br /&gt;
#declare slopes_elevation_texture=&lt;br /&gt;
texture {&lt;br /&gt;
  gradient z&lt;br /&gt;
  &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00 slope1_texture]&lt;br /&gt;
    [0.30 slope1_texture]&lt;br /&gt;
    &lt;br /&gt;
    [0.65  slope2_texture]&lt;br /&gt;
    [1.00  slope2_texture]&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ** Now define the final texture blending between the height textures and the slope textures:&lt;br /&gt;
#declare final_texture = &lt;br /&gt;
texture {&lt;br /&gt;
  slope {&lt;br /&gt;
    &amp;lt;0,0,-1&amp;gt;, 0, 0.5&lt;br /&gt;
  } &lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.00    levels_elevation_texture]&lt;br /&gt;
    [0.06    levels_elevation_texture]&lt;br /&gt;
    [0.40    slopes_elevation_texture]&lt;br /&gt;
    [1.00    slopes_elevation_texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&lt;br /&gt;
// ***!! Now we declare our heightfield object that uses this texture&lt;br /&gt;
height_field {&lt;br /&gt;
  png &amp;quot;povmap_height.png&amp;quot;                                  &lt;br /&gt;
  smooth              // smooth the heightfield&lt;br /&gt;
  no_shadow           // you may want to remove this&lt;br /&gt;
  translate &amp;lt;-.5, -.5, -.5&amp;gt;&lt;br /&gt;
  rotate &amp;lt;90,0,0&amp;gt;     // rotate it so that the projection of the texture is correct&lt;br /&gt;
  scale &amp;lt;1,-1,1&amp;gt;      // invert the y axis&lt;br /&gt;
  translate &amp;lt;0.5, 0.5, 0.5&amp;gt;&lt;br /&gt;
  texture {&lt;br /&gt;
    final_texture&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  scale &amp;lt;MAP_WIDTH, MAP_HEIGHT, MAP_ELEVATION&amp;gt;    // now scale to the maps height x width&lt;br /&gt;
  translate &amp;lt;-MAP_WIDTH/2, -MAP_HEIGHT/2, -MAP_ELEVATION/2&amp;gt;   // and center it for the camera&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
9.1)&lt;br /&gt;
9.2)&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray&lt;br /&gt;
&lt;br /&gt;
11) Select your new reder size Click Render&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps)&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18760</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18760"/>
		<updated>2008-02-26T06:12:59Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a Spring map&#039;s texture using the freeware Povray program.  It does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like The GIMP).  Here is the one we&#039;ll use for our map:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
9.1)&lt;br /&gt;
9.2)&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray&lt;br /&gt;
&lt;br /&gt;
11) Select your new reder size Click Render&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps)&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18759</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18759"/>
		<updated>2008-02-26T06:12:35Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: /* Howto: Create a map&amp;#039;s texture using Povray to generate the texture */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
=== Intro ===&lt;br /&gt;
This guide will take you through creating a Spring map&#039;s texture using the freeware Povray program.  It does not cover other aspects of map creation (heighmaps, features, metal, compiling, etc), but there are a few excellent guides within the Wiki that already cover those steps.&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux.  I have only tested these steps under Windows, but they should work under Linux.&lt;br /&gt;
&lt;br /&gt;
=== Initial Steps ===&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like The GIMP).  Here is the one we&#039;ll use for our map:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
6) Create an empty text file in your C:\Povmap folder named gen_pov_texture.pov&lt;br /&gt;
&lt;br /&gt;
7) Copy the following povray scene code into the above file:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
8) Double click on your gen_pov_texture.pov file so that it opens up in Povray.&lt;br /&gt;
&lt;br /&gt;
9) Add a new render size (8192 x 8192):&lt;br /&gt;
9.1)&lt;br /&gt;
9.2)&lt;br /&gt;
&lt;br /&gt;
10) Restart Povray&lt;br /&gt;
&lt;br /&gt;
11) Select your new reder size Click Render&lt;br /&gt;
&lt;br /&gt;
12) Convert to gen_pov_texture.bmp to a png file if you&#039;re using the new mapconv (it doesn&#039;t seem to like bitmaps)&lt;br /&gt;
&lt;br /&gt;
13) Do all the other map stuff: metal placement bitmap, feature placement bitmap, smd file&lt;br /&gt;
&lt;br /&gt;
14) Compile your map with mapconv&lt;br /&gt;
&lt;br /&gt;
15) Test it :)&lt;br /&gt;
&lt;br /&gt;
== Advanced stuff ==&lt;br /&gt;
Check out your help file that came with Povray.  There is a LOT that you can do!&lt;br /&gt;
&lt;br /&gt;
=== Complex Texture Map Combinations ===&lt;br /&gt;
As you can see from the pov code above, a &amp;quot;texture&amp;quot; declaration can be an image (called an &amp;quot;image_map&amp;quot;), but it can also be a definition of a blend between any number of earlier defined textures (called a &amp;quot;texture_map&amp;quot;), which is based on a function.  In the above example, it uses the &amp;quot;gradient&amp;quot; function for changes in elevation, and the &amp;quot;slope&amp;quot; function for changes in slope.  It is possible to define much more complex sets of textures than those defined above, such as mixing different combination of slope mapings with combinations of elevation mapings.&lt;br /&gt;
&lt;br /&gt;
=== Procedural Textures ===&lt;br /&gt;
It is also possible to use &amp;quot;procedural textures&amp;quot; instead of image_map textures.  These can be quite useful for areas on your map that have a high slope as they can create a better looking texture, including effects such as the layered rock textures.  Unfortunately these types of textures can result in larger map sizes, but if you just use them on the high slope areas of your map it should not be too bad.&lt;br /&gt;
&lt;br /&gt;
Some good examples used in terrains can be found at the [http://geomorph.sourceforge.net/povray/en/Geomorph%20-%20Predefined%20Povray%20Scripts.html Geomorph website].&lt;br /&gt;
&lt;br /&gt;
=== Placing Metal Textures ===&lt;br /&gt;
There are quite a few posible ways to have Povray place metal textures for you.  One approach that I have used is:&lt;br /&gt;
&lt;br /&gt;
1) Define a function that will return the current metal locations in a pov kind of way:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  #declare getMetal = function {&lt;br /&gt;
    pigment {&lt;br /&gt;
      image_map {&lt;br /&gt;
        png &amp;quot;metallocations.png&amp;quot;&lt;br /&gt;
      }&lt;br /&gt;
      scale &amp;lt;1,-1,1&amp;gt;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function, when called for a given coordinate (0 to 1), returns a vector of the three colours for that point.&lt;br /&gt;
&lt;br /&gt;
2) We now define a texture that we&#039;ll use for our metal (this is made up of a number of subcomponent textures):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// A simple brownish texture&lt;br /&gt;
#declare dirt_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  pigment { rgb &amp;lt;0.75,0.55,0.35&amp;gt;*0.7 }&lt;br /&gt;
  normal {&lt;br /&gt;
    granite 0.5  // for use with normal{} (0...1 or more)&lt;br /&gt;
    //scale MAP_WIDTH&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.5&lt;br /&gt;
    diffuse .9&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A shiny metalish texture&lt;br /&gt;
#declare metal_TextureBase = &lt;br /&gt;
texture { &lt;br /&gt;
  pigment {&lt;br /&gt;
    rgb&amp;lt;1,1,1&amp;gt;    &lt;br /&gt;
  }&lt;br /&gt;
  normal {&lt;br /&gt;
      granite 0.9  // for use with normal{} (0...1 or more)&lt;br /&gt;
    scale 80/5&lt;br /&gt;
  }&lt;br /&gt;
  finish {&lt;br /&gt;
    ambient 0.6&lt;br /&gt;
    brilliance 4&lt;br /&gt;
    diffuse 1&lt;br /&gt;
    specular 0.90&lt;br /&gt;
    roughness 1/80&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// A combination of the metal_TextureBase, the dirt_Texture and the Transparent_Texture&lt;br /&gt;
#declare metal_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  bozo              // very smooth, random noise function&lt;br /&gt;
  turbulence 0.3  // turbulence often useful&lt;br /&gt;
&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  metal_TextureBase]  //T_Silver_3B&lt;br /&gt;
    [0.42  metal_TextureBase]&lt;br /&gt;
    [0.47  dirt_Texture]&lt;br /&gt;
    [0.50  dirt_Texture]&lt;br /&gt;
    [0.55  Transparent_Texture]&lt;br /&gt;
    [1.0  Transparent_Texture]&lt;br /&gt;
  }&lt;br /&gt;
  //scale &amp;lt;16, 16, 16&amp;gt; //even&lt;br /&gt;
  scale &amp;lt;7, 32, 16&amp;gt; //stretched &lt;br /&gt;
  rotate z*40  //set it at an angle so it looks betterer ;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#declare blob_Texture=&lt;br /&gt;
texture {&lt;br /&gt;
  slope { z, 0.0, 0.5 }&lt;br /&gt;
  texture_map {&lt;br /&gt;
    [0.0  Transparent_Texture]&lt;br /&gt;
    [0.6  Transparent_Texture]&lt;br /&gt;
    [1.0  metal_Texture]&lt;br /&gt;
  }&lt;br /&gt;
}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3) Finally, we define a &amp;quot;blob&amp;quot; object that adds a sphere object to the master blob object for each point in the metal map: &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:1px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
&amp;lt;pre&amp;gt;  #declare metalBlob=&lt;br /&gt;
  blob {&lt;br /&gt;
  #declare geos=0;&lt;br /&gt;
  #declare ix=4.0;&lt;br /&gt;
  #declare num=0;&lt;br /&gt;
  #while (ix &amp;lt; MAP_WIDTH)&lt;br /&gt;
    #declare iy=0.0;&lt;br /&gt;
    #while (iy &amp;lt; MAP_WIDTH)&lt;br /&gt;
      #declare metal=getMetal(ix/MAP_WIDTH, iy/MAP_WIDTH, 0);&lt;br /&gt;
      #if (metal.red)&lt;br /&gt;
        #declare Pos = trace(primaryHF,&amp;lt;ix-MAP_WIDTH/2, -iy+MAP_WIDTH/2, MAP_ELEVATION*2&amp;gt;,-z);&lt;br /&gt;
        sphere {&lt;br /&gt;
            //Pos-&amp;lt;0,0,5&amp;gt;, 8*6, 8  &lt;br /&gt;
            Pos-&amp;lt;0,0,5&amp;gt;, 8*2, 8  &lt;br /&gt;
        }&lt;br /&gt;
      #end &lt;br /&gt;
      #declare iy=iy+8;&lt;br /&gt;
    #end&lt;br /&gt;
    #declare ix=ix+8;&lt;br /&gt;
  #end&lt;br /&gt;
  &lt;br /&gt;
    texture {&lt;br /&gt;
      blob_Texture&lt;br /&gt;
    }&lt;br /&gt;
    scale &amp;lt;1,1,0.5&amp;gt;  &lt;br /&gt;
  }  //metalBlob&lt;br /&gt;
&lt;br /&gt;
  object {metalBlob}&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
This all adds some time to the rendering time, but seems to work well enough (although it could be nicer).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-style:italic; font-size:120%; border:3px dashed red;background-color:white&amp;quot;&lt;br /&gt;
|+Multiplication table&lt;br /&gt;
|-&lt;br /&gt;
! &amp;amp;times; !! 1 !! 2 !! 3&lt;br /&gt;
|-&lt;br /&gt;
! 1&lt;br /&gt;
| 1 || 2 || 3&lt;br /&gt;
|-&lt;br /&gt;
! 2&lt;br /&gt;
| 2 || 4 || 6&lt;br /&gt;
|-&lt;br /&gt;
! 3&lt;br /&gt;
| 3 || 6 || 9&lt;br /&gt;
|-&lt;br /&gt;
! 4&lt;br /&gt;
| 4 || 8 || 12&lt;br /&gt;
|-&lt;br /&gt;
! 5&lt;br /&gt;
| 5 || 10 || 15&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
http://meta.wikimedia.org/wiki/Help:Table&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
	<entry>
		<id>https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18758</id>
		<title>Tutorial:MapWithPOVRay(Tinnut)</title>
		<link rel="alternate" type="text/html" href="https://springrts-wiki.p2004a.com/mediawiki/index.php?title=Tutorial:MapWithPOVRay(Tinnut)&amp;diff=18758"/>
		<updated>2008-02-25T10:04:29Z</updated>

		<summary type="html">&lt;p&gt;Tinnut: New page: == Howto: Create a map&amp;#039;s texture using Povray to generate the texture ==   !! This is currently a work in progress and make take some time to complete. !!   Povray is available for both Wi...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Howto: Create a map&#039;s texture using Povray to generate the texture ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
!! This is currently a work in progress and make take some time to complete. !!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Povray is available for both Windows and Linux so in theory these steps should work for both systems.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
1) Download and install Povray: [http://www.povray.org/ Povray Site]&lt;br /&gt;
&lt;br /&gt;
2) Create a working folder for your map, for this example, we&#039;ll make C:\PovMap&lt;br /&gt;
&lt;br /&gt;
3) Create a heightmap using whatever program (I like The GIMP).  Here is the one we&#039;ll use for our map:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4) For our example, we&#039;ll be defining three different elevation levels for which there are different terrain textures, these will be (each at 512x512):&lt;br /&gt;
&lt;br /&gt;
4.1) Lowest elevation (low lying areas):&lt;br /&gt;
&lt;br /&gt;
4.2) Middle elevation (main map surface):&lt;br /&gt;
&lt;br /&gt;
4.3) Highest elevation (mountains):&lt;br /&gt;
&lt;br /&gt;
5) Now also for our example, we&#039;ll be defining two different textures to be used by sloping areas, one for slopes in the lower elevation areas of the map, and another for slopes in the higher elevations:&lt;br /&gt;
&lt;br /&gt;
5.1) Lower elevations:&lt;br /&gt;
&lt;br /&gt;
5.2) Higher elevations:&lt;br /&gt;
&lt;br /&gt;
6)&lt;/div&gt;</summary>
		<author><name>Tinnut</name></author>
	</entry>
</feed>