home *** CD-ROM | disk | FTP | other *** search
/ Maximum 3D 3 / m3d-p3.iso / 3DS_MAX / 3DSMAX.2_0 / SCRIPTS / PLNETGEN.MS < prev    next >
Text File  |  1997-10-19  |  10KB  |  307 lines

  1. -- Planet Generator Script By Frederic Moreau
  2. -- Started to write on 15/09/1997 at 22h10.
  3.  
  4. utility planet_g "Planet Generator"
  5. (
  6.     group "Planet Geometry"
  7.     (
  8.     spinner planet_radius "Planet Radius" type:#float range:[0,1000,50]
  9.     spinner planet_segs "Planet Segments" type:#float range:[0,100,32]
  10.     spinner planet_disp "Continent Height" type:#float range:[0,1000,50]
  11.     spinner edge_n "EdgeNess" type:#float range:[0,10,3]
  12.     checkbox smooth_wl "Smooth Water/Land" enabled:false    
  13.     label ct "Continent Type" offset:[0,10]
  14.     radiobuttons cont_type labels:#("Flat", "Rounded", "Mountainous", "Fortress") offset:[0,0] enabled:true
  15.     )
  16.     
  17.     group "Planet Maps"
  18.     (
  19.     spinner cont_size "Continent Size" type:#float range:[0,100,20]
  20.     spinner island_f "Island Factor" type:#float range:[0,100,2]
  21.     spinner ocean_b "Ocean %" type:#float range:[0,100,60]
  22.     )
  23.     
  24.     group "Water Parameters"
  25.     (
  26.     label wm "Water Material"
  27.     radiobuttons water_m labels:#("Built In", "Own") offset:[10,0] enabled:false
  28.     button pick_wm "NONE" Width:90 enabled:false
  29.     )
  30.     
  31.     group "Continent Parameters"
  32.     (
  33.     label cm "Continent Material"
  34.     radiobuttons cont_m labels:#("Built In", "Own") offset:[10,0] enabled:false
  35.     button pick_cm "NONE" Width:90 enabled:false
  36.     )
  37.     
  38.     group "Create Planet"
  39.     (
  40.     spinner p_seed "Random Seed" type:#integer range: [0,99999,12345]
  41.     edittext p_name "Planet Name" text:"Earth" width:140
  42.     checkbox collapse "Collapse Stack ?"
  43.     Button create_p "Create Planet"
  44.     )
  45.     
  46.     group "Animation"
  47.     (
  48.     Button C_key "Create Key"
  49.     label warn_k1 "Note that you have to work"
  50.     label warn_k2 "on a planet at once."
  51.     label warn_k3 "The Animate button MUST be lit"
  52.     )
  53.     
  54.     group "More ..."
  55.     (
  56.     button help_b "HELP"
  57.     button credits "Credits"
  58.     )
  59.     
  60.     on create_p pressed do
  61.     (
  62. -- // Creating the base planet geosphere
  63.     planett = (geosphere Radius: planet_radius.value Segs: planet_segs.value mapCoords: true)
  64.     
  65. -- // Adding the Displace Modifier
  66.     AddModifier planett (displace strength:(planet_disp.value) decay:(edge_n.value) maptype:2 lumCenterEnable: TRUE)
  67.     planett.name = p_name.text
  68.     
  69. -- // Defining Flat Displace Map
  70.     d_map_n = (planet continent_size:(cont_size.value) island_factor:(island_f.value) Ocean_percent:(ocean_b.value*100) Random_Seed:(p_seed.value))    
  71.     d_map_n.color_1 = [0,0,0]
  72.     d_map_n.color_2 = [0,0,0]
  73.     d_map_n.color_3 = [0,0,0]
  74.     d_map_n.color_4 = [255,255,255]
  75.     d_map_n.color_5 = [255,255,255]
  76.     d_map_n.color_6 = [255,255,255]
  77.     d_map_n.color_7 = [255,255,255]
  78.     d_map_n.color_8 = [255,255,255]
  79.     
  80. -- // Defining Flat Texture Map
  81.     t_map_n = (planet continent_size:(cont_size.value) island_factor:(island_f.value) Ocean_percent:(ocean_b.value*100) Random_Seed:(p_seed.value))    
  82.     t_map_n.color_1 = [0,0,0]
  83.     t_map_n.color_2 = [0,0,0]
  84.     t_map_n.color_3 = [0,0,0]
  85.     t_map_n.color_4 = [237,235,75]
  86.     t_map_n.color_5 = [130,99,44]
  87.     t_map_n.color_6 = [130,99,44]
  88.     t_map_n.color_7 = [56,47,31]
  89.     t_map_n.color_8 = [33,25,11]
  90.     
  91. -- // Defining Rounded Displace Map
  92.     d_map_r = (planet continent_size:(cont_size.value) island_factor:(island_f.value) Ocean_percent:(ocean_b.value*100) Random_Seed:(p_seed.value))    
  93.     d_map_r.color_1 = [0,0,0]
  94.     d_map_r.color_2 = [0,0,0]
  95.     d_map_r.color_3 = [0,0,0]
  96.     d_map_r.color_4 = [128,128,128]
  97.     d_map_r.color_5 = [170,170,170]
  98.     d_map_r.color_6 = [230,230,230]
  99.     d_map_r.color_7 = [255,255,255]
  100.     d_map_r.color_8 = [255,255,255]
  101.     
  102. -- // Defining Rounded Texture Map
  103.     t_map_r = (planet continent_size:(cont_size.value) island_factor:(island_f.value) Ocean_percent:(ocean_b.value*100) Random_Seed:(p_seed.value))    
  104.     t_map_r.color_1 = [0,0,0]
  105.     t_map_r.color_2 = [0,0,0]
  106.     t_map_r.color_3 = [0,0,0]
  107.     t_map_r.color_4 = [237,235,75]
  108.     t_map_r.color_5 = [130,99,44]
  109.     t_map_r.color_6 = [130,99,44]
  110.     t_map_r.color_7 = [56,47,31]
  111.     t_map_r.color_8 = [33,25,11]
  112.  
  113. -- // Defining Montainous Displace Map
  114.     d_map_m = (planet continent_size:(cont_size.value) island_factor:(island_f.value) Ocean_percent:(ocean_b.value*100) Random_Seed:(p_seed.value))    
  115.     d_map_m.color_1 = [0,0,0]
  116.     d_map_m.color_2 = [0,0,0]
  117.     d_map_m.color_3 = [0,0,0]
  118.     d_map_m.color_4 = [64,64,64]
  119.     d_map_m.color_5 = [92,92,92]
  120.     d_map_m.color_6 = [112,112,112]
  121.     d_map_m.color_7 = [150,150,150]
  122.     d_map_m.color_8 = [255,255,255]
  123.     
  124. -- // Defining Mountainous Texture Map
  125.     t_map_m = (planet continent_size:(cont_size.value) island_factor:(island_f.value) Ocean_percent:(ocean_b.value*100) Random_Seed:(p_seed.value))    
  126.     t_map_m.color_1 = [0,0,0]
  127.     t_map_m.color_2 = [0,0,0]
  128.     t_map_m.color_3 = [0,0,0]
  129.     t_map_m.color_4 = [237,235,75]
  130.     t_map_m.color_5 = [130,99,44]
  131.     t_map_m.color_6 = [130,99,44]
  132.     t_map_m.color_7 = [56,47,31]
  133.     t_map_m.color_8 = [240,240,240]
  134.  
  135. -- // Defining Fortress Displace Map
  136.     d_map_f = (planet continent_size:(cont_size.value) island_factor:(island_f.value) Ocean_percent:(ocean_b.value*100) Random_Seed:(p_seed.value))    
  137.     d_map_f.color_1 = [0,0,0]
  138.     d_map_f.color_2 = [0,0,0]
  139.     d_map_f.color_3 = [0,0,0]
  140.     d_map_f.color_4 = [255,255,255]
  141.     d_map_f.color_5 = [255,255,255]
  142.     d_map_f.color_6 = [0,0,0]
  143.     d_map_f.color_7 = [0,0,0]
  144.     d_map_f.color_8 = [0,0,0]
  145.     
  146. -- // Defining Fortress Texture Map
  147.     t_map_f = (planet continent_size:(cont_size.value) island_factor:(island_f.value) Ocean_percent:(ocean_b.value*100) Random_Seed:(p_seed.value))    
  148.     t_map_f.color_1 = [0,0,0]
  149.     t_map_f.color_2 = [0,0,0]
  150.     t_map_f.color_3 = [0,0,0]
  151.     t_map_f.color_4 = [237,235,75]
  152.     t_map_f.color_5 = [130,99,44]
  153.     t_map_f.color_6 = [130,99,44]
  154.     t_map_f.color_7 = [237,235,75]
  155.     t_map_f.color_8 = [33,25,11]
  156.  
  157. -- // Defining Blend Material Map
  158.     b_map = (planet continent_size:(cont_size.value) island_factor:(island_f.value) Ocean_percent:(ocean_b.value*100) Random_Seed:(p_seed.value))    
  159.     b_map.color_1 = [0,0,0]
  160.     b_map.color_2 = [0,0,0]
  161.     b_map.color_3 = [0,0,0]
  162.     b_map.color_4 = [255,255,255]
  163.     b_map.color_5 = [255,255,255]
  164.     b_map.color_6 = [255,255,255]
  165.     b_map.color_7 = [255,255,255]
  166.     b_map.color_8 = [255,255,255]
  167.     b_map.name = (planett.name + "_Blend_Map")
  168.  
  169. -- // Set the type of continent
  170.     case cont_type.state of
  171.         (
  172.         1: d_map = d_map_n
  173.         2: d_map = d_map_r
  174.         3: d_map = d_map_m
  175.         4: d_map = d_map_f
  176.         )
  177.     d_map.name = (planett.name + "_Disp_Map")
  178.     
  179. -- // Set the type of continent material map
  180.     case cont_type.state of
  181.         (
  182.         1: t_map = t_map_n
  183.         2: t_map = t_map_r
  184.         3: t_map = t_map_m
  185.         4: t_map = t_map_f
  186.         )
  187.     t_map.name = (planett.name + "_cont_Map")
  188.     
  189. -- // Adding the displace map to Displace modifier
  190.     planett.displace.map = d_map
  191.     if collapse.checked then
  192.         (
  193.         convertToMesh planett
  194.         )
  195.     
  196. -- // Defining Water Built In
  197.     watmat_b = Standardmaterial ambiant:[40,38,55] diffuse:[79,127,181] specular:[249,245,229]
  198.     watmat_b.shininess = 65
  199.     watmat_b.shinestrength = 90
  200.     watmat_b.bumpmap = cellular size:0.5 fractal:1 iterations:5.0
  201.     watmat_b.bumpmapamount = -30
  202.     watmat_b.bumpmap.name = (planett.name + "_Water_Bump")
  203.  
  204. -- // Defining Water Material
  205.     watmat = watmat_b
  206.     watmat.name = (planett.name + "_Water_Mat")
  207.  
  208. -- // Defining Continent Built In
  209.     contmat_b = Standardmaterial ambiant:[51,28,14] diffuse:[124,89,68] specular:[199,172,155]
  210.     contmat_b.shininess = 7
  211.     contmat_b.shinestrength = 9
  212.     contmat_b.bumpmap = splat size:20 color_1:[0,0,0] color_2:[255,255,255]
  213.     contmat_b.bumpmapamount = 60
  214.     contmat_b.bumpmap.name = (planett.name + "_Cont_Bump")
  215.     contmat_b.diffusemap = t_map
  216.     contmat_b.diffusemapamount = 50
  217.  
  218. -- // Defining Continent Material
  219.     contmat = contmat_b
  220.     contmat.name = (planett.name + "_Cont_Mat")
  221.  
  222. -- // Defining Planet Material
  223.     planetmat = blend material1:watmat material2:contmat
  224.     planetmat.material1Enabled = true
  225.     planetmat.material2Enabled = true
  226.     planetmat.mask = b_map
  227.     planetmat.maskEnabled = true
  228.     planetmat.name = (planett.name + "_Material")
  229.     
  230. -- // Assign the material to the planet
  231.     planett.material = planetmat
  232.     
  233.     )
  234.  
  235. on C_key pressed do
  236.     (
  237.     
  238. -- // Animating the base planet geosphere
  239.     planett.Radius = planet_radius.value
  240.     planett.Segs = planet_segs.value
  241.     
  242. -- // Animating the Displace Modifier
  243.     planett.displace.strength = planet_disp.value
  244.     planett.displace.decay = edge_n.value
  245.     
  246. -- // Animating Blend Material Map
  247.     planetmat.mask.continent_size = cont_size.value
  248.     planetmat.mask.island_factor = island_f.value
  249.     planetmat.mask.Ocean_percent = ocean_b.value*100
  250.     planetmat.mask.Random_Seed = p_seed.value
  251.  
  252. -- // Animating Displace Map
  253.     d_map.continent_size = cont_size.value
  254.     d_map.island_factor = island_f.value
  255.     d_map.Ocean_percent = ocean_b.value*100
  256.     d_map.Random_Seed = p_seed.value
  257.  
  258.     )
  259.  
  260. on credits pressed do messagebox \
  261.     (
  262.     "Planet Generator Scripted Plug-In
  263.     
  264.     written by Frederic Moreau
  265.     for Kinetix : a division of Autodesk
  266.     FredericMoreau@Compuserve.com
  267.     or
  268.     www.ktx.com/French_tutorial
  269.     
  270.     Special Thanks To :
  271.     Randy Kreitzman
  272.     Ravi Karra"
  273.     )
  274.     
  275. on help_b pressed do messagebox \
  276.     (
  277.     "Planet Generator Help !
  278.     
  279.     Planet Radius : radius of planet (Animatable)
  280.     Planet Segments : # of segments as GeoSphere (Anim)
  281.     Continent Height : Height of continents (Anim)
  282.     EdgeNess : Decay of continent height (Anim)
  283.     
  284.     Smooth Water/Land : Auto (Not available yet)
  285.     Continent Type : Gradient of continent
  286.     
  287.     Continent Size : % of planet size (Anim)
  288.     Island Factor : Iterations of island (Anim)
  289.     Ocean % : % of water on planet (Anim)
  290.     
  291.     Water & Continent Material :
  292.     Not Available Yet
  293.     
  294.     Create Planet : Self Explain
  295.     Random Seed : Seed of Maps & geometry
  296.     Planet Name : Name of Object Generated
  297.     
  298.     Collapse Stack ? : Collapsing the stack
  299.     Note that you won't be able to animate !
  300.     
  301.     Create Key : Just modify the current planet,
  302.     Without create a new one.
  303.     
  304.     Written by Frederic Moreau
  305.     For Kinetix, a division of Autodesk..."
  306.     )
  307. )