// Vers: 3.6
// Auth: Leroy Whetstone Email llrwii@joplin.com

These files will help you make Image Maps for moons.
And you can make Image Maps for a feild of craters 
 for use as an height feild.

This zip should have:
 CRAT.INI-- setup
 Craters.inc-- makes the craters
 Planet.pov --an example of planet map making
 Plane.pov --an example of plane map making
 Crater_M_view.pov--- preview Moon image map or Make Moon Mesh from map 
 Crater_P_view.pov--- preview Plane image map  
 BackGround.pov------Testing background textures
 LRshapes.inc--- I modifided 'HF_Sphere' macro from 'shapes.inc'  
               in the standard Include folder to do pigment functions
               and changed the name to 'HF_SpherePig'. It's here
               along with 'HFCreate_()' from the 'shapes.inc'.

  The way Crator works is with a pigment on a square polygon. The pigment 
 is the crator with 'Clear'(from colors.inc) edges. For Moon Crators
 that polygon is rotated, then place at the +z direction, then rotated 
 into place. For Plane Crators that polygon is rotated, then place at 
 the location. In order not to get a buch of coinciding surfaces the older
 a crater is the father in the +z direction it goes.

  In order to make things eazier for you get 4 macros in Craters.inc.
   Moon_Craters, Moon_Crater, Plane_Craters and Plane_Crater

  'Moon_Craters' and 'Plane_Craters' lets you place craters randomly
 while 'Moon_Crater' and 'Plane_Crater' lets you place a single crater.
               More details on these are below!

 There are 6 basic types of craters. See 'Crater_Color' below
 And each type can have ages  ranging from 0-new to 100-very old.
 (from very small to very Big also from very smooth to very rough)
 Add to this the Peak and Depth along with the turbulence values can 
 be adjusted and you get a lot of different crators. You'll need 'em.  
 Oh lets not forget rotate and scale just to add spice!             
   
============  Crat.ini =================
 This is the INI file I use for my craters. You WILL need to set it up
 for your system. I didn't need to put this in the zip. But it's in the 
 folder and you can have it.
 
 THE FIRST THING YOU NEED TO DO AFTER GET SET UPPED IS
     render both  Plane.pov and Planet.pov
       as TestPlane.tga and TestPlanet.tga
        each is used in the preview pov files 
     
============  Craters.inc ===============
  The Work Horse this is where everything is!
         
 These seeds are used with using 'Moon_Craters' and 'Plane_Craters' macros

 CrS0=seed(18573)-- deform (octaves lambda omega)
 CrS1=seed(42194)-- Latitude
 CrS2=seed(13258)-- Longitude
 CrS3=seed(25737)-- Age(size & crater type)
 CrS4=seed(5746) -- Depth & peek
 CrS5=seed(1955) -- rotate polygon


     ------- Moon craters--------------

... Place a bunch of craters for a planet....
 #macro Moon_Craters(N,MinAge ,MaxAge )
  N---- todle number of craters  interger>0
  MinAge -- minamal age of craters   Float>=0;
  MaxAge -- maximal age of craters   Float=<100

.... Place a single crater for planet.....
 
 #macro Moon_Crater(Long,Lat,IAge,Cm,Pv,Dv,Turb,Rot)
  Long - Longitude -east / +west   Float
  Lat - Latitude +north / -south   Float
  IAge -- age of crater   Int 0-100
  Cm ---  color_map  Int 0-5
  Pv ---- Peak value Float 0-1  1= highest
  Dv ---- Depth value Float 0-1 1= deepest
  Turb ---- Turb(octaves,lambda,omega) values Vector <0-1,0-1,0-1>
  Rot --- rotate crater

 ------------Craters for plane feild---------------

    ____a bunch of crators____
 #macro Plane_Craters(N,MinAge ,MaxAge ,Sad)
   N---- todle number of craters  interger>0
   MinAge -- minimal age of craters  Float>=0;
   MaxAge -- maximal age of craters  Float=<100
   Sad-- scale polygon  0<Float<1

   ____ a single crater ____
 #macro  Plane_Crater(pLong,pLat,CAge,Cm,Pv,Dv,Turb,Rot,Sad)
  pLong -- Longitude +east / -west   -1<=Float<=1
  pLat  -- Latitude +north / -south   -1<=Float<=1
  CAge -- age of crater   Float=<100
  Cm  -- color_map  Interger 0-5
  Pv  -- crater Peek   Float 0-1  1=highest point
  Dv  -- crater Depth   float 0-1 1= Lowest point
  Turb -- turbulence(octaves,lambda,omega) values Vector <0-1,0-1,0-1>
  Rot --- rotate crater  Float 
  Sad --- scale polygon        0<Float 1=normal

 You may have noticed two things while reading over the macros above.
  One is that the 'Turb' vector that holds the octaves,lambda and omega
 values show a limit of 0 to 1 that is because those values have
 built in limits based on the age of a crater.
  The other is that there is 'Sad'(scale polygon) for the Plane macros
 but not for the Moon macros. The Moon is a sphere and the Plane is
 well a plane. In the Moon macros AGE determines SCALE. I've set it up
 so that each age has its own sphere on which it is placed. And if you 
 scaled the polygon(the crater is on) it can cause it to cut off another
 Polygon of a different age. You still can have the same age craters
 cut each other off. Some times it not noticable. But other times you
 get a distinct line where the two polygons meet. As of now I don't
 know how to fix it causing the rendering times to blow up. If you have
 a problem change the 'CrS' seeds or place them with 'Moon_Crater' macro.
  
 

The 6 styles of Craters that use these Crater_Color maps:

0- single wall flat interior [3-points] 
   Loc 0,.2,.4   Color .5,Pk,Dp
 color_map{[0 Clear][0 White*.5][.2 White*Pk][.4 White*Dp]}

1- single wall peaked interior  [4-points]
   Loc 0,.2,.4,.6,1  Color  .5,Pk,Dp,Dp,.7*Pk
 color_map{[0 Clear][0 White*.5][.2 White*Pk][.4 White*Dp][.6 White*Dp][1 White*.7*Pk]} 

2- double wall .6Pk peaked interior .7Pk [6-points]
   Loc 0,.2,.4,.6,.8,1  Color .5,Pk,Dp,.6,Dp,.7*Pk
 color_map{[0 Clear][0 White*.5][.2 White*Pk][.4 White*Dp][.6 White*.6][.8 White*Dp][1 White*.7*Pk]}

3- steep double wall .5Pk peaked interior .7Pk [7-points]
   Loc 0,.1,.2,.4,.6,.8,1  Color .5,Pk,Dp,Dp,.5,Dp,.7*Pk
 color_map{[0 Clear][0 White*.5][.1 White*Pk][.2 White*Dp][.4 White*Dp][.6 White*.5][.8 White*Dp][1 White*.7*Pk]}

4- steep single wall peaked interior .8Pk [5-points]
   Loc 0,.1,.2,.6,1 Color .5,Pk,Dp,Dp,.8*Pk
 color_map{[0 Clear][0 White*.5][.1 White*Pk][.2 White*Dp][.6 White*Dp][1 White*.8*Pk]}

5- steep single wall peaked interior .7Pk [5-points]
   Loc 0,.1,.2,.6,1 Color .5,Pk,Dp,.5*Dp,.7*Pk
 color_map{[0 Clear][0 White*.5][.1 White*Pk][.2 White*Dp][.6 White*.5*Dp][1 White*.7*Pk]} 


================== Plane.pov =================================
  an example of plane map making using 'Plane_Craters' and 'Plane_Crater'
    You will notice that there is two lines of craters that run
    from far left to the far right, the first line is has the shows
    the 6 basic craters styles from 0 to 5 on very young craters(age=0)
    I've scaled them up a bit so you could see them better.
    The second line above the first shows the same crater styles but
    on craters that are age=40 and with no scale. 
  
  This a template, Copy it and Rename it and Play with it!
  { 
   In the 'global_settings' I have the basic stuff plus the
   'noise_generator' set 1 and 'hf_gray_16' commented out

   Its uses #default {finish{ambient 1}} We need it, you could 
   change the ambient value if you like but don't loose it! 
   
   The Camera Should stay put.

  } applies to Planet.pov also

  It has a plane with a background pigment. This very useful. You can
   use far less craters with a good background. 
   
================== Planet.pov ================================
  an example of planet map making using 'Moon_Craters' and 'Moon_Crater'

  This a template also, Copy it and Rename it and Play with it!

  Every thing from here to the background is the same as 'Planet.pov'
  {}
   
  It has a sphere used as a background pigment. Just as useful. 
        

================== Crater_M_view.pov =========================
  preview Moon image map or Make Moon Mesh from map 

 There are afew ways to use this file. You can view a sphere
 with a few pigments with color_maps to chose from. You can veiw
 a 'HF_Sphere' already saved. Finally You can make the 'HF_Sphere'
 that you can view or use somewhere else. 
   
  The main variable is Mesh;//(yes)for show mesh (no)for show sphere
   if 'Mesh' is yes then these other variables come in to play
       'Mesh_Name' string (File to save Mesh)
       'Load_Mesh_Name' string( show saved Mesh)
      if the 'Load_Mesh_Name' string is Not empty then it will load
       a mesh and display it. if 'Mesh_Name' string also has something
       in it then no file is saved.
      if 'Mesh_Name' string alone has something in it then a mesh is
       made and save before displaying it.

   if 'Mesh' is no then the a sphere with an image map using 'Map'
       will be displayed


================== Crater_P_view.pov =========================
                preview Plane image map

   This is just simple height_field with camera and lights
   You'll defintly want to change the camrea position
   and you may want to change the Lights and the scale of the
   height_feild.

================== BackGround.pov =========================
      Testing background pigments for a planet
  Basicly me playing around with different pigments.
  Most aren't very good. The last one 'PigY' was made to
  see if I could put a equtoral bulge on the mesh.
   
================== Crater_M_view.pov =========================

================== LRshapes.inc =========================
  My modifed version of 'HF_Sphere' in shapes                   
   With 'HFCreate_()' to help it do its thing.
 I put this in its own little file to keep the over head low. 
     

===========================================
I hope this Helps you make Great Moonscapes.

Have Fun!