Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
Design of Surfaces by "texture" with POV-Ray -
Deutsch Deutsch
Italiano Italiano
Français français

Home
- POV-Ray Tutorial

  Design of Surfaces
  - Colors and Textures
    Index

    texture Syntax
    Ready-made Textures
    Do-it-yourself Colors
    Patterns
    - pattern types
      Regular patterns
    - checker, hexagon
      square, triangular
    - brick
    - object pattern (1)
    - object pattern (2)
    - object pattern (3)
    - tiling
    - pavement
      Stripes pattern
    > color_map{...}
      Patterns by pigments
    - pigment_pattern (1)
    - pigment_pattern (2)
    Patterns Lists
    - Regular Patterns
    - Random Patterns
    - Fractal Patterns
    - Other Patterns
    Warps
    uv_mapping
    Mapping
    - Mapping Methods
    > color_map{...}
    - pigment_map{ ... }
    - texture_map{ ... }
    - normal_map{ ... }
    - average
    - material_map{ ... }
    - image_map{ ... }
    - image_map+gif 1
    - image_map+gif 2
    - image_map+gamma
    - transparency maps 1
    - transparency maps 2
    - transparency maps 3
    - bump_map{ ... }
    Superpositions

    Your own Textures
 
                                           
Sample color_map
  "color_map { ... }" - Color Tables
  Patterns for Pigments and Normals.

A "color_map { ... }" is a table of colors, which were assign to numbers between 0.00 an 1.00. These color_maps we can use to colorate a variety of pattern.
The fastest way to understand this is by using the gradient pattern:
pigment{
gradient <0,1,0>
color_map {[0.0 color rgb<1,1,1>] // White
           [0.5 color rgb<1,0,0.2>] // red wine
           [1.0 color rgb<1,1,1>] // White
          } // end of color_map
} // end of pigment
Sample color_map

In a height of 1 unit this pattern is repeated. If we want a smaller or an increased pattern, we can add after (or before!) color_map a statement like "scale 0.25" to "pigment".
In this way also turning ("rotate") and moving ("translate") is possible!

pigment{
gradient <0,1,0>
color_map {[0.0 color rgb<1,1,1>] // White
           [0.5 color rgb<1,0,0.2>] // red wine
           [1.0 color rgb<1,1,1>] // White
          } // end of color_map
 scale 0.25 
} // end of pigment
Sample color_map

Some examples of this color_map with patterns (see also: 'Pattern Lists')

Sample color_map
gradient <0,1,0> turbulence 1.0

Sample color_map
bozo

Sample color_map
crackle


The change from one color to the other
- floating soft or sharp and hard:

If we want the colors change sharp we need to repeat the colors at their borderlines:
gradient <0,1,0>
color_map {[0.0 color White]
           [0.5 color White]
           [0.5 color Red  ]  // hard
           [1.0 color Red  ] } 
Sample color_map
Mixing hard and soft is also possible:
gradient <0,1,0>
color_map {[0.0 color White]
           [0.3 color White]   // hard
           [0.3 color Red  ]
           [1.0 color White] } // soft to White  at the beginning  
Sample color_map
gradient <0,1,0>
color_map {[0.0 color White] 
[0.5 color Red ] // soft [1.0 color White] } // soft to White at the beginning
Sample color_map


Example:



sphere{<0,0,0>,1
       texture{pigment{gradient <0,1,0> //
                       color_map{[0.0 color Blue ]
                                 [0.2 color Navy ]
                                 [0.5 color White]
                                 [0.8 color Navy ]
                                 [1.0 color Blue ]
                                }// end of color_map
                       scale 2 translate<0,-1,0>
                       }//  end of pigment
               finish{ diffuse 0.9 phong 1.0 }
              }// end of texture
       scale <1.3,0.75,1.3> translate<0,1.2,-0.3>
      }// end of sphere

For a blue sky sphere with a diameter of 10000 units and a color floating from white at the horizon to blue in zenit, we need a sphere with the above color_map all together with "scale 10 000" -- Here we should put a "finish { ambient 1 diffuse 0}" because the sky is never shaded by anything (I hope so!:-)

sphere{ <0,0,0>, 1
        texture{
         pigment{
           gradient <0,1,0>
           color_map{[0.0 color White]
                     [1.0 color Blue ]
                    }
           } // end of pigment
         finish{ ambient 1 diffuse 0 }
         }// end of texture
 scale 10000
 }// end of sphere 

Example of "color_map{...}":


sphere{ <0,0,0> , 1
        texture{
          pigment{ crackle
                   scale 1.5 turbulence 0.35
                   color_map{
                     [0.04 color Black]
                     [0.08 color Black]
                     [0.32 color rgb<1,0.65,0>]
                     [1.00 color rgb<1,1.0,0.5>]
                     } // end of color_map
                    scale 0.2
                 } // end of pigment
          normal { bumps 0.75 scale 0.02}
          finish { diffuse 0.9 phong 1}
          rotate<0,-30,0>
          translate<0.01, 0.04, 0.00>
        } // end of texture -----------------------
   scale<1,1,1>  rotate<0,0,0>
   translate<0.40,1, 0.25>
 } // end of sphere -------------------------------
top

© Friedrich A. Lohmüller, 2013
http://www.f-lohmueller.de