home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Maximum 3D 3
/
m3d-p3.iso
/
3DS_MAX
/
3DSMAX.2_0
/
SCRIPTS
/
PLNETGEN.MS
< prev
next >
Wrap
Text File
|
1997-10-19
|
10KB
|
307 lines
-- Planet Generator Script By Frederic Moreau
-- Started to write on 15/09/1997 at 22h10.
utility planet_g "Planet Generator"
(
group "Planet Geometry"
(
spinner planet_radius "Planet Radius" type:#float range:[0,1000,50]
spinner planet_segs "Planet Segments" type:#float range:[0,100,32]
spinner planet_disp "Continent Height" type:#float range:[0,1000,50]
spinner edge_n "EdgeNess" type:#float range:[0,10,3]
checkbox smooth_wl "Smooth Water/Land" enabled:false
label ct "Continent Type" offset:[0,10]
radiobuttons cont_type labels:#("Flat", "Rounded", "Mountainous", "Fortress") offset:[0,0] enabled:true
)
group "Planet Maps"
(
spinner cont_size "Continent Size" type:#float range:[0,100,20]
spinner island_f "Island Factor" type:#float range:[0,100,2]
spinner ocean_b "Ocean %" type:#float range:[0,100,60]
)
group "Water Parameters"
(
label wm "Water Material"
radiobuttons water_m labels:#("Built In", "Own") offset:[10,0] enabled:false
button pick_wm "NONE" Width:90 enabled:false
)
group "Continent Parameters"
(
label cm "Continent Material"
radiobuttons cont_m labels:#("Built In", "Own") offset:[10,0] enabled:false
button pick_cm "NONE" Width:90 enabled:false
)
group "Create Planet"
(
spinner p_seed "Random Seed" type:#integer range: [0,99999,12345]
edittext p_name "Planet Name" text:"Earth" width:140
checkbox collapse "Collapse Stack ?"
Button create_p "Create Planet"
)
group "Animation"
(
Button C_key "Create Key"
label warn_k1 "Note that you have to work"
label warn_k2 "on a planet at once."
label warn_k3 "The Animate button MUST be lit"
)
group "More ..."
(
button help_b "HELP"
button credits "Credits"
)
on create_p pressed do
(
-- // Creating the base planet geosphere
planett = (geosphere Radius: planet_radius.value Segs: planet_segs.value mapCoords: true)
-- // Adding the Displace Modifier
AddModifier planett (displace strength:(planet_disp.value) decay:(edge_n.value) maptype:2 lumCenterEnable: TRUE)
planett.name = p_name.text
-- // Defining Flat Displace Map
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))
d_map_n.color_1 = [0,0,0]
d_map_n.color_2 = [0,0,0]
d_map_n.color_3 = [0,0,0]
d_map_n.color_4 = [255,255,255]
d_map_n.color_5 = [255,255,255]
d_map_n.color_6 = [255,255,255]
d_map_n.color_7 = [255,255,255]
d_map_n.color_8 = [255,255,255]
-- // Defining Flat Texture Map
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))
t_map_n.color_1 = [0,0,0]
t_map_n.color_2 = [0,0,0]
t_map_n.color_3 = [0,0,0]
t_map_n.color_4 = [237,235,75]
t_map_n.color_5 = [130,99,44]
t_map_n.color_6 = [130,99,44]
t_map_n.color_7 = [56,47,31]
t_map_n.color_8 = [33,25,11]
-- // Defining Rounded Displace Map
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))
d_map_r.color_1 = [0,0,0]
d_map_r.color_2 = [0,0,0]
d_map_r.color_3 = [0,0,0]
d_map_r.color_4 = [128,128,128]
d_map_r.color_5 = [170,170,170]
d_map_r.color_6 = [230,230,230]
d_map_r.color_7 = [255,255,255]
d_map_r.color_8 = [255,255,255]
-- // Defining Rounded Texture Map
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))
t_map_r.color_1 = [0,0,0]
t_map_r.color_2 = [0,0,0]
t_map_r.color_3 = [0,0,0]
t_map_r.color_4 = [237,235,75]
t_map_r.color_5 = [130,99,44]
t_map_r.color_6 = [130,99,44]
t_map_r.color_7 = [56,47,31]
t_map_r.color_8 = [33,25,11]
-- // Defining Montainous Displace Map
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))
d_map_m.color_1 = [0,0,0]
d_map_m.color_2 = [0,0,0]
d_map_m.color_3 = [0,0,0]
d_map_m.color_4 = [64,64,64]
d_map_m.color_5 = [92,92,92]
d_map_m.color_6 = [112,112,112]
d_map_m.color_7 = [150,150,150]
d_map_m.color_8 = [255,255,255]
-- // Defining Mountainous Texture Map
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))
t_map_m.color_1 = [0,0,0]
t_map_m.color_2 = [0,0,0]
t_map_m.color_3 = [0,0,0]
t_map_m.color_4 = [237,235,75]
t_map_m.color_5 = [130,99,44]
t_map_m.color_6 = [130,99,44]
t_map_m.color_7 = [56,47,31]
t_map_m.color_8 = [240,240,240]
-- // Defining Fortress Displace Map
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))
d_map_f.color_1 = [0,0,0]
d_map_f.color_2 = [0,0,0]
d_map_f.color_3 = [0,0,0]
d_map_f.color_4 = [255,255,255]
d_map_f.color_5 = [255,255,255]
d_map_f.color_6 = [0,0,0]
d_map_f.color_7 = [0,0,0]
d_map_f.color_8 = [0,0,0]
-- // Defining Fortress Texture Map
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))
t_map_f.color_1 = [0,0,0]
t_map_f.color_2 = [0,0,0]
t_map_f.color_3 = [0,0,0]
t_map_f.color_4 = [237,235,75]
t_map_f.color_5 = [130,99,44]
t_map_f.color_6 = [130,99,44]
t_map_f.color_7 = [237,235,75]
t_map_f.color_8 = [33,25,11]
-- // Defining Blend Material Map
b_map = (planet continent_size:(cont_size.value) island_factor:(island_f.value) Ocean_percent:(ocean_b.value*100) Random_Seed:(p_seed.value))
b_map.color_1 = [0,0,0]
b_map.color_2 = [0,0,0]
b_map.color_3 = [0,0,0]
b_map.color_4 = [255,255,255]
b_map.color_5 = [255,255,255]
b_map.color_6 = [255,255,255]
b_map.color_7 = [255,255,255]
b_map.color_8 = [255,255,255]
b_map.name = (planett.name + "_Blend_Map")
-- // Set the type of continent
case cont_type.state of
(
1: d_map = d_map_n
2: d_map = d_map_r
3: d_map = d_map_m
4: d_map = d_map_f
)
d_map.name = (planett.name + "_Disp_Map")
-- // Set the type of continent material map
case cont_type.state of
(
1: t_map = t_map_n
2: t_map = t_map_r
3: t_map = t_map_m
4: t_map = t_map_f
)
t_map.name = (planett.name + "_cont_Map")
-- // Adding the displace map to Displace modifier
planett.displace.map = d_map
if collapse.checked then
(
convertToMesh planett
)
-- // Defining Water Built In
watmat_b = Standardmaterial ambiant:[40,38,55] diffuse:[79,127,181] specular:[249,245,229]
watmat_b.shininess = 65
watmat_b.shinestrength = 90
watmat_b.bumpmap = cellular size:0.5 fractal:1 iterations:5.0
watmat_b.bumpmapamount = -30
watmat_b.bumpmap.name = (planett.name + "_Water_Bump")
-- // Defining Water Material
watmat = watmat_b
watmat.name = (planett.name + "_Water_Mat")
-- // Defining Continent Built In
contmat_b = Standardmaterial ambiant:[51,28,14] diffuse:[124,89,68] specular:[199,172,155]
contmat_b.shininess = 7
contmat_b.shinestrength = 9
contmat_b.bumpmap = splat size:20 color_1:[0,0,0] color_2:[255,255,255]
contmat_b.bumpmapamount = 60
contmat_b.bumpmap.name = (planett.name + "_Cont_Bump")
contmat_b.diffusemap = t_map
contmat_b.diffusemapamount = 50
-- // Defining Continent Material
contmat = contmat_b
contmat.name = (planett.name + "_Cont_Mat")
-- // Defining Planet Material
planetmat = blend material1:watmat material2:contmat
planetmat.material1Enabled = true
planetmat.material2Enabled = true
planetmat.mask = b_map
planetmat.maskEnabled = true
planetmat.name = (planett.name + "_Material")
-- // Assign the material to the planet
planett.material = planetmat
)
on C_key pressed do
(
-- // Animating the base planet geosphere
planett.Radius = planet_radius.value
planett.Segs = planet_segs.value
-- // Animating the Displace Modifier
planett.displace.strength = planet_disp.value
planett.displace.decay = edge_n.value
-- // Animating Blend Material Map
planetmat.mask.continent_size = cont_size.value
planetmat.mask.island_factor = island_f.value
planetmat.mask.Ocean_percent = ocean_b.value*100
planetmat.mask.Random_Seed = p_seed.value
-- // Animating Displace Map
d_map.continent_size = cont_size.value
d_map.island_factor = island_f.value
d_map.Ocean_percent = ocean_b.value*100
d_map.Random_Seed = p_seed.value
)
on credits pressed do messagebox \
(
"Planet Generator Scripted Plug-In
written by Frederic Moreau
for Kinetix : a division of Autodesk
FredericMoreau@Compuserve.com
or
www.ktx.com/French_tutorial
Special Thanks To :
Randy Kreitzman
Ravi Karra"
)
on help_b pressed do messagebox \
(
"Planet Generator Help !
Planet Radius : radius of planet (Animatable)
Planet Segments : # of segments as GeoSphere (Anim)
Continent Height : Height of continents (Anim)
EdgeNess : Decay of continent height (Anim)
Smooth Water/Land : Auto (Not available yet)
Continent Type : Gradient of continent
Continent Size : % of planet size (Anim)
Island Factor : Iterations of island (Anim)
Ocean % : % of water on planet (Anim)
Water & Continent Material :
Not Available Yet
Create Planet : Self Explain
Random Seed : Seed of Maps & geometry
Planet Name : Name of Object Generated
Collapse Stack ? : Collapsing the stack
Note that you won't be able to animate !
Create Key : Just modify the current planet,
Without create a new one.
Written by Frederic Moreau
For Kinetix, a division of Autodesk..."
)
)