Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
Italiano Italiano
Français français
Deutsch Deutsch

Home
- POV-Ray Tutorial

  Coordinate Systems
  and 2D Functions

  - Squared Paper
  - Coordinate Systems
      with Axes
  > Macro for Grids
      with 2 Levels
  - 2D Functions
      Samples
  - Math Functions
      in POV-Ray
                                           
Grid with 2 Levels
The construction of a grid with 2 levels
(i.e. 1m and 0.1m) for systems of coordinates.
Objects:   plane, cylinder, cone                    .
Methods: color_map, layered textures, #macro
        

Construction in details:
We use a first macro to creat stripes of a given distance in one direction.
In a second macro we add the twice in the first scale (i.e. 1 unit) one of them rotate by 90° around y. Then we add the second grid (i.e. 0.1 unit) in the same way.


//------------------------------------- ////////////
#macro Raster_Lines (RScale, LineW, Intensity_)
 pigment{ gradient x scale RScale
          color_map{
           [0.000   color rgbt<1,1,1,0>*Intensity_]
           [0+LineW color rgbt<1,1,1,0>*Intensity_]
           [0+LineW color rgbt<1,1,1,1>]
           [1-LineW color rgbt<1,1,1,1>]
           [1-LineW color rgbt<1,1,1,0>*Intensity_]
           [1.000   color rgbt<1,1,1,0>*Intensity_]
           } // end color_map
         } // end pigment
 #end// of Raster(RScale, HLine)-macro
//------------------------------------- ////////////
//------------------------------------- ////////////
#macro Raster_Plate(
    RD1, Width1,//primary raster distance/width,
    RD2, Width2,//secondary raster distance/width,
    Base_Texture, //  non = pigment { Clear }
    Intensity, // Line gray intensity
    Start_Box, End_Box, // vectors
  ) //------------------------------------------
//----------------------------------------------
box{ Start_Box,End_Box
     texture{ Base_Texture }
  #if (RD1 > 0 ) // raster big  RD1, Width1,
    texture { Raster_Lines(RD1,Width1,Intensity) }
    texture { Raster_Lines(RD1,Width1,Intensity)
              rotate<0,90,0>}
  #end
  #if (RD2 > 0 ) // raster small RD2, Width2,
    texture { Raster_Lines(RD2,Width2,Intensity) }
    texture { Raster_Lines(RD2,Width2,Intensity)
              rotate<0,90,0>}
  #end
} // end box -----------------------------------
#end // ------------------------------ end of macro
//------------------------------------- ////////////

// How to use:  ------------------------------------
#declare B_Tex =
  texture{ pigment{ color rgb<1,1,1<*1.2}}
//--------------------------------------------------
object{ Raster_Plate(
    1.0, 0.010,// RD1, Width1,// 1st distance/width,
    0.1, 0.045,// RD2, Width2,// 2nd distance/width,
    B_Tex, // Base_Texture, // non = pigment{Clear}
    0.6, // Intensity, // Line gray intensity
    <-2,-0.05,-2>, <2,0,2>, //Start/End
  ) //----------------------------------------------
  rotate<0,0,0>
  translate<0,0.001,0>
} //------------------------------------------------

Grid with 2 Levels
Grid with 2 levels.
This scene in POV-Ray:
raster_plate_2.pov
Grid with 2 Levels
Grid with 2 levels with base level.




Grids with 2 Levels
Grids 3D with 2 levels.
This scene in POV-Ray:
raster_plate_4.pov

top

© Friedrich A. Lohmüller, 2011
www.f-lohmueller.de