20/01/2004-UPDATE - CGKit - Terrain_Tool v1.2

CGKIT - Terrain_Tool v1.2 UPDATED (20/01/2004)

_ CGKit Terrain_Tool v1.2 Turbulence/fBm/Noise/Cellnoise

_ Jimmy Hazevoet Januari/2004

##***********************************************************

1_ You have to download CGKit 1.0+ (by: Matthias Baas)

----------

from : www.sourceforge.net

-------------------

2_ Install CGKit…

##(3)_(step 3 only for Blender 2.27/2.28)

copy “noise.pyd” and “cgtypes.pyd”

(from: \Python\Lib\site-packages)

and paste to your Blender 2.27/2.28 directory.

##***********************************************************

_ To start…Alt-P

_

_ Set noise ‘Height’ parameter(s)

_ " ‘other’ "

_ Write formula (string input)

_ there are 2 simple preset example’s ,string1 and string2

_ falloff = flatten edges

_ FX,FY = falloff center position

_ floor/plateau = flat floor / flat plateau level

#***************************************************
#***************************************************

v1.2 UPDATE

New:

_ Auto update on/off switch,

__ falloff button for string input,

___ save and load terrain file’s.

(set path to directory)

#***************************************************
#***************************************************

UPDATED VERSION:

##***********************************************************
## _ CGKit Terrain_Tool v.2   Turbulence/fBm/Noise/Cellnoise
##
##***********************************************************
## _ Jimmy Hazevoet    Januari/2004
##
##***********************************************************
##
## 1_ You have to download CGKit 1.0+ (by: Matthias Baas) 
##                         ----------
##    from : www.sourceforge.net 
##           -------------------
##
## 2_ Install CGKit...
## 
##(3)_(step 3 only for Blender 2.27/2.28)
##    copy "noise.pyd" and "cgtypes.pyd"
##    (from: \Python\Lib\site-packages\)
##    and paste to your Blender 2.27/2.28 directory.
##
##***********************************************************
##
## _ To start...Alt-P
## _
## _ Set noise 'Height' parameter(s)
## _  "        'other'      " 
##
## _ Write formula (string input)
## _ there are 2 simple preset example's ,string1 and string2
##
## _ falloff       = flatten edges 
## _ FX,FY         = falloff center position
## _ floor/plateau = flat floor / flat plateau level
##
#**************************************************************
#**************************************************************
# v2:
# New: 
#   _ Auto update on/off switch,
#  __ falloff button for string input,
# ___ save and load terrain file's.
#                                        #*********************
##____ Set path to defaultdir :         #/////////////////////

 
Path = "/Blender 2.30/terrasettings/Blendscape 01.txt"  
      

#///////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
 ##############################################################
  #



import Blender
from Blender import *
from Blender.Draw import *
from Blender.BGL import *
from math import *
from whrandom import *
import noise



 #####################################
# save/load
###########

message = "Terrain_Tool."
curversion = 0
filename = Create(Path)
#
def writeln(f,x):
  f.write(str(x))
  f.write("
")

def readint(f):
  return int(f.readline())
def readfloat(f):
  return float(f.readline())
def readstr(f):
  s = (f.readline())
  return s[0:len(s)-1]
#
###
def do_file(save):
  fname = filename.val

  global filename, message
  global xres, yres, tfrq, ffrq, hght, shft, rand
  global ua, ub, uc, ud, zstring, z2string, sfall
  global fbO,fbL, fbG, fbfall, fbz, fpox, fpoy
  global tuO,tuL, tuG, tufall, tuz, tpox, tpoy
  global ptx, pty, pfx, pfy, pnx, pny, pcx, pcy
  global nofall, cefall, noz, cez
  global plev, flev, plno, flno
  global nfrqx, nfrqy, cfrqx, cfrqy
  global npox, npoy, cpox, cpoy

###
  if save:  message = "  file saved."
  else:     message = " file loaded."
  if save:
    try:
      f = open(fname,'w')
    except:
      message = "unable to save file."
      return
  else:
    try:
      f = open(fname,'r')
    except:
      message = "file not found."
      return
  if save:  writeln(f,curversion)
  else:
    version = readint(f)
    if version != curversion:
      message = "wrong file version"

###
#
  if save:  writeln(f,xres.val)
  else:     xres.val = readint(f)
  if save:  writeln(f,yres.val)
  else:     yres.val = readint(f)
#
  if save:  writeln(f,zstring.val)
  else:     zstring.val = readstr(f)
  if save:  writeln(f,z2string.val)
  else:     z2string.val = readstr(f)
  if save:  writeln(f,ua.val)
  else:     ua.val = readfloat(f)
  if save:  writeln(f,ub.val)
  else:     ub.val = readfloat(f)
  if save:  writeln(f,uc.val)
  else:     uc.val = readint(f)
  if save:  writeln(f,ud.val)
  else:     ud.val = readint(f)
#
  if save:  writeln(f,sfall.val)
  else:     sfall.val = readfloat(f)
  if save:  writeln(f,plev.val)
  else:     plev.val = readfloat(f)
  if save:  writeln(f,plno.val)
  else:     plno.val = readfloat(f)
  if save:  writeln(f,flev.val)
  else:     flev.val = readfloat(f)
  if save:  writeln(f,flno.val)
  else:     flno.val = readfloat(f)
#
  if save:  writeln(f,hght.val)
  else:     hght.val = readfloat(f)
  if save:  writeln(f,rand.val)
  else:     rand.val = readfloat(f)
  if save:  writeln(f,shft.val)
  else:     shft.val = readint(f)
#
  if save:  writeln(f,tfrq.val)
  else:     tfrq.val = readfloat(f)
  if save:  writeln(f,tuO.val)
  else:     tuO.val = readint(f)
  if save:  writeln(f,tuL.val)
  else:     tuL.val = readfloat(f)
  if save:  writeln(f,tuG.val)
  else:     tuG.val = readfloat(f)
  if save:  writeln(f,tpox.val)
  else:     tpox.val = readfloat(f)
  if save:  writeln(f,tpoy.val)
  else:     tpoy.val = readfloat(f)
  if save:  writeln(f,tuz.val)
  else:     tuz.val = readfloat(f)
  if save:  writeln(f,tufall.val)
  else:     tufall.val = readfloat(f)
  if save:  writeln(f,ptx.val)
  else:     ptx.val = readfloat(f)
  if save:  writeln(f,pty.val)
  else:     pty.val = readfloat(f)
#
  if save:  writeln(f,ffrq.val)
  else:     ffrq.val = readfloat(f)
  if save:  writeln(f,fbO.val)
  else:     fbO.val = readint(f)
  if save:  writeln(f,fbL.val)
  else:     fbL.val = readfloat(f)
  if save:  writeln(f,fbG.val)
  else:     fbG.val = readfloat(f)
  if save:  writeln(f,fpox.val)
  else:     fpox.val = readfloat(f)
  if save:  writeln(f,fpoy.val)
  else:     fpoy.val = readfloat(f)
  if save:  writeln(f,fbz.val)
  else:     fbz.val = readfloat(f)
  if save:  writeln(f,fbfall.val)
  else:     fbfall.val = readfloat(f)
  if save:  writeln(f,pfx.val)
  else:     pfx.val = readfloat(f)
  if save:  writeln(f,pfy.val)
  else:     pfy.val = readfloat(f)
#
  if save:  writeln(f,nfrqx.val)
  else:     nfrqx.val = readfloat(f)
  if save:  writeln(f,nfrqy.val)
  else:     nfrqy.val = readfloat(f)
  if save:  writeln(f,npox.val)
  else:     npox.val = readfloat(f)
  if save:  writeln(f,npoy.val)
  else:     npoy.val = readfloat(f)
  if save:  writeln(f,noz.val)
  else:     noz.val = readfloat(f)
  if save:  writeln(f,nofall.val)
  else:     nofall.val = readfloat(f)
  if save:  writeln(f,pnx.val)
  else:     pnx.val = readfloat(f)
  if save:  writeln(f,pny.val)
  else:     pny.val = readfloat(f)
#
  if save:  writeln(f,cfrqx.val)
  else:     cfrqx.val = readfloat(f)
  if save:  writeln(f,cfrqy.val)
  else:     cfrqy.val = readfloat(f)
  if save:  writeln(f,cpox.val)
  else:     cpox.val = readfloat(f)
  if save:  writeln(f,cpoy.val)
  else:     cpoy.val = readfloat(f)
  if save:  writeln(f,cez.val)
  else:     cez.val = readfloat(f)
  if save:  writeln(f,cefall.val)
  else:     cefall.val = readfloat(f)
  if save:  writeln(f,pcx.val)
  else:     pcx.val = readfloat(f)
  if save:  writeln(f,pcy.val)
  else:     pcy.val = readfloat(f)
#
  f.close()
  Register(draw,event,bevent)

#


   ###########################################
  #//////////////////////////////////////////
 ###########################################
# initialize
############

#-mesh
xres    =Create(32)
yres    =Create(32)

#-floor and plateau
plev    =Create(10.0)
plno    =Create(0.0)
flev    =Create(-10.0)
flno    =Create(0.0)

#-extra
zstring  =Create("z2*A")
z2string =Create("0.0")
ua       =Create(0.0)
ub       =Create(0.0)
uc       =Create(0)
ud       =Create(0)
sfall   =Create(0.0)
realt   =Create(0)
hght    =Create(1.0)
rand    =Create(0.0)
shft    =Create(0)

#-turbulence = nt
tfrq    =Create(1.0)
tuO     =Create(3)
tuL     =Create(1.0)
tuG     =Create(0.5)
tpox    =Create(0.0)
tpoy    =Create(0.0)
tuz     =Create(0.0)
tufall  =Create(0.0)
ptx     =Create(0.0)
pty     =Create(0.0)

#-fBm = nf
ffrq    =Create(1.0)
fbO     =Create(12)
fbL     =Create(1.6)
fbG     =Create(0.6)
fpox    =Create(0.0)
fpoy    =Create(0.0)
fbz     =Create(0.0)
fbfall  =Create(0.0)
pfx     =Create(0.0)
pfy     =Create(0.0)

#-noise = nn
nfrqx   =Create(1.0)
nfrqy   =Create(1.0)
npox    =Create(0.0)
npoy    =Create(0.0)
noz     =Create(0.0)
nofall  =Create(0.0)
pnx     =Create(0.0)
pny     =Create(0.0)

#-cellnoise = nc
cfrqx   =Create(1.0)
cfrqy   =Create(1.0)
cpox    =Create(0.0)
cpoy    =Create(0.0)
cez     =Create(0.0)
cefall  =Create(0.0)
pcx     =Create(0.0)
pcy     =Create(0.0)



   ############################################## 
  #/////////////////////////////////////////////
 ##############################################
# reset - preset
################

###
def reset():
  global xres, yres, tfrq, ffrq, hght, shft, rand
  global ua, ub, uc, ud, zstring, z2string, sfall
  global fbO,fbL, fbG, fbfall, fbz, fpox, fpoy
  global tuO,tuL, tuG, tufall, tuz, tpox, tpoy
  global ptx, pty, pfx, pfy, pnx, pny, pcx, pcy
  global nofall, cefall, noz, cez
  global plev, flev, plno, flno
  global nfrqx, nfrqy, cfrqx, cfrqy
  global npox, npoy, cpox, cpoy

  #-mesh
  xres    =Create(32)
  yres    =Create(32)

  #-floor and plateau
  plev    =Create(10.0)
  plno    =Create(0.0)
  flev    =Create(-10.0)
  flno    =Create(0.0)

  #-extra
  zstring  =Create("0.0")
  z2string =Create("0.0")
  ua       =Create(0.0)
  ub       =Create(0.0)
  uc       =Create(0)
  ud       =Create(0)
  sfall    =Create(0.0)
  realt    =Create(0)
  hght     =Create(1.0)
  rand     =Create(0.0)
  shft     =Create(0)

  #-turbulence = nt
  tfrq    =Create(1.0)
  tuO     =Create(3)
  tuL     =Create(1.0)
  tuG     =Create(0.5)
  tpox    =Create(0.0)
  tpoy    =Create(0.0)
  tuz     =Create(0.0)
  tufall  =Create(0.0)
  ptx     =Create(0.0)
  pty     =Create(0.0)

  #-fBm = nf
  ffrq    =Create(1.0)
  fbO     =Create(10)
  fbL     =Create(1.5)
  fbG     =Create(0.60)
  fpox    =Create(0.0)
  fpoy    =Create(0.0)
  fbz     =Create(0.0)
  fbfall  =Create(0.0)
  pfx     =Create(0.0)
  pfy     =Create(0.0)

  #-noise = nn
  nfrqx   =Create(1.0)
  nfrqy   =Create(1.0)
  npox    =Create(0.0)
  npoy    =Create(0.0)
  noz     =Create(0.0)
  nofall  =Create(0.0)
  pnx     =Create(0.0)
  pny     =Create(0.0)

  #-cellnoise = nc
  cfrqx   =Create(1.0)
  cfrqy   =Create(1.0)
  cpox    =Create(0.0)
  cpoy    =Create(0.0)
  cez     =Create(0.0)
  cefall  =Create(0.0)
  pcx     =Create(0.0)
  pcy     =Create(0.0)


######################
#
###
def presetstring1():
  global ua, ub, uc, ud, zstring, z2string, sfall,plev, flev

  zstring  =Create("sin(A*z2)*sqrt(A*z2)*C")
  z2string =Create("sqrt((x-xmax/8)**2+(y-ymax/8)**2)")
  ua       =Create(0.8)
  ub       =Create(0.0)
  uc       =Create(2)
  ud       =Create(0)
  sfall    =Create(0.32)
  plev     =Create(10.0)
  flev     =Create(-0.1)

#
###
def presetstring2():
  global ua, ub, uc, ud, zstring, z2string, sfall,plev, flev

  zstring  =Create("z2*A")
  z2string =Create("sin(y*0.5-ymax/4)*2")
  ua       =Create(2.0)
  ub       =Create(0.0)
  uc       =Create(0)
  ud       =Create(0)
  sfall    =Create(0.0)
  plev     =Create(10.0)
  flev     =Create(-0.0)

#
###
def clearstring():
  global ua, ub, uc, ud, zstring, z2string, sfall

  zstring  =Create("z2")
  z2string =Create("0.0")
  ua       =Create(0.0)
  ub       =Create(0.0)
  uc       =Create(0)
  ud       =Create(0)
  sfall    =Create(0.0)





   ############################################################# 
  #////////////////////////////////////////////////////////////
 ############################################################# 
# create
###########

def create():
  global xres, yres, tfrq, ffrq, hght, shft, rand
  global ua, ub, uc, ud, zstring, z2string, sfall
  global fbO,fbL, fbG, fbfall, fbz, fpox, fpoy
  global tuO,tuL, tuG, tufall, tuz, tpox, tpoy
  global ptx, pty, pfx, pfy, pnx, pny, pcx, pcy
  global nofall, cefall, noz, cez
  global plev, flev, plno, flno
  global nfrqx, nfrqy, cfrqx, cfrqy
  global npox, npoy, cpox, cpoy


###
  me=NMesh.GetRaw() 

  #
  x=0.0
  y=0.0
  z=0.0

  xmax = xres.val+1
  ymax = yres.val+1

  zfunc  =zstring.val
  z2func =z2string.val

  A = ua.val
  B = ub.val
  C = uc.val
  D = ud.val

  ra= rand.val

###
  #
  for x in range(0, xmax, 1):
    x = x*0.25

    #
    for y in range(0, ymax, 1):
        y = y*0.25

        #
        xt = (x-xmax/2.0)/5.0
        yt = (y-ymax/2.0)/5.0

        #
        xu=(xt*tfrq.val)+tpox.val
        yu=(yt*tfrq.val)+tpoy.val
        zu=2.0+shft.val
        xf=(xt*ffrq.val)+fpox.val
        yf=(yt*ffrq.val)+fpoy.val
        zf=2.0-shft.val
        xno=(xt*nfrqx.val)+npox.val+shft.val
        yno=(yt*nfrqy.val)+npoy.val-shft.val
        xce=(xt*cfrqx.val)+cpox.val+shft.val
        yce=(yt*cfrqy.val)+cpoy.val-shft.val
        xfp=(xt)
        yfp=(yt)
        zfp=1.0+shft.val

        #
        nt=noise.turbulence((xu,yu,zu),tuO.val,tuL.val,tuG.val)
        nt*=tuz.val+ra*random()
        nf=noise.fBm((xf,yf,zf),fbO.val,fbL.val,fbG.val)
        nf*=fbz.val+ra*random()
        nn=noise.noise(xno,yno)
        nn*=noz.val+ra*random()
        nc=noise.cellnoise(xce,yce)
        nc*=cez.val+ra*random()

        #
        nflo=noise.fBm((xfp,yfp,zfp), 9, 2.0, 0.71)
        nplat=noise.fBm((xfp,yfp,zfp), 11, 2.1, 0.73)

        #
        pt= sqrt((x-xmax/8-ptx.val)**4+(y-ymax/8-pty.val)**4)
        pf= sqrt((x-xmax/8-pfx.val)**4+(y-ymax/8-pfy.val)**4)
        pn= sqrt((x-xmax/8-pnx.val)**4+(y-ymax/8-pny.val)**4)
        pc= sqrt((x-xmax/8-pcx.val)**4+(y-ymax/8-pcy.val)**4)
        ps= sqrt((x-xmax/8)**4+(y-ymax/8)**4)

        #
        z2= eval(z2func)
        z= eval(zfunc) * exp(-ps/2*sfall.val)

        z+= nt * exp(-pt/2*tufall.val)
        z+= nf * exp(-pf/2*fbfall.val)
        z+= nn * exp(-pn/2*nofall.val)
        z+= nc * exp(-pc/2*cefall.val)
        z*= hght.val

        #
        if (z < flev.val): z = flev.val+flno.val*nflo
        if (z > plev.val): z = plev.val+plno.val*nplat

        #
        ###

        v=NMesh.Vert(x, y, z)
        me.verts.append(v)

###
  #
  for x in range(0,xmax-1):
    for y in range(0,ymax-1):
        #
        a=y+x*ymax
        f= NMesh.Face()
        f.v.append(me.verts[a])
        f.v.append(me.verts[a+ymax])
        f.v.append(me.verts[a+ymax+1])
        f.v.append(me.verts[a+1])
        me.faces.append(f)

  #
  NMesh.PutRaw(me, "Plane", 1)
  Blender.Redraw()



   ############################################################# 
  #////////////////////////////////////////////////////////////
 ############################################################# 
# Gui
###########

#
###
def aply_1():
  global message

  message = "   created"
#
def aply_0():
  global message

  message = ""
#
def aply_2():
  global message

  message = "preset formula"

#
###########
def draw():
  global filename, realt, message
  global xres, yres, tfrq, ffrq, hght, shft, rand
  global ua, ub, uc, ud, zstring, z2string, sfall
  global fbO,fbL, fbG, fbfall, fbz, fpox, fpoy
  global tuO,tuL, tuG, tufall, tuz, tpox, tpoy
  global ptx, pty, pfx, pfy, pnx, pny, pcx, pcy
  global nofall, cefall, noz, cez
  global plev, flev, plno, flno
  global nfrqx, nfrqy, cfrqx, cfrqy
  global npox, npoy, cpox, cpoy

###
  #
  BGL.glClearColor(0.6, 0.6, 0.6, 1)
  BGL.glColor3f(1,1,1)
  BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)
  #
  glColor3f(0.5, 0.5, 0.5)
  glRectf(0, 0, 310, 550)
  glColor3f(0.7, 0.7, 0.7)
  glRectf(5, 465, 305, 545)
  glColor3f(0.7, 0.7, 0.7)
  glRectf(7.5, 152.5, 152.5, 330)
  glColor3f(0.7, 0.7, 0.7)
  glRectf(157.5, 152.5, 300, 330)
  glColor3f(0.7, 0.7, 0.7)
  glRectf(7.5, 10, 152.5, 147.2)
  glColor3f(0.7, 0.7, 0.7)
  glRectf(157.5, 10, 300, 147.2)
  #
  glColor3f(0.0, 0.0, 0.0)
  glRasterPos2d(20, 318)
  Text("nt = Turbulence")
  glRasterPos2d(215, 318)
  Text("nf = fBm")
  glRasterPos2d(20, 138)
  Text("nn = Noise")
  glRasterPos2d(170, 138)
  Text("nc = Cellnoise")
  #
  #
  BGL.glColor3f(1.0, 1.0, 1.0)
  BGL.glRasterPos2i(120,500)
  Text(message)

#
###

  filename = String("path= ",20,10,520,290,20,filename.val,50)
  Button("Load",18,10,495,35,20)
  Button("Save",19,65,495,35,20)

  realt=Toggle("Auto update",11, 10,470,90,15, realt.val)
  Button("Update",3,110,470,90,25)
  reset=Button("Reset",4, 260,470,40,15)

  prestring1=Button("string1",5,205,483,50,12)
  prestring2=Button("string2",6,205,470,50,12)

  xres=Number("xmax ",2,10,435,145,25,xres.val,2,256,"xmax")
  yres=Number("ymax ",2,155,435,145,25,yres.val,2,256,"ymax")

  flno=Number("F noise",2,10,422.5,100,10,flno.val,-10.0,10.0)
  plno=Number("P noise",2,200,422.5,100,10,plno.val,-10.0,10.0)
  flev=Number("Floor",2,10,395,100,25,flev.val,-50.0,50.0)
  plev=Number("Plateau",2,200,395,100,25,plev.val,-50.0,50.0)

  rand=Number("Rndm",2,110,422.5,90,10,rand.val,-16.0,16.0)
  hght=Number("Height",2,110,395,90,25,hght.val,-32.0,32.0)
  shft=Number("Shift",2,110,300,90,15,shft.val,-9999,9999,)

  clearstr=Button("Clear",7, 260,372,40,15)
  z2string=String("z2 = ",2,10,372,248,15,z2string.val,200)
  zstring=String("z = ",2,10,355,217,15,zstring.val,200)
  sfall=Number("fallof",2,230,355,70,15,sfall.val,0.0,1.0)

  ua=Number("A= ",2,10,338,70,15,ua.val,-99.0,99.0)
  ub=Number("B= ",2,82.5,338,70,15,ub.val,-99.0,99.0)
  uc=Number("C= ",2,157.5,338,70,15,uc.val,-99.0,99.0)
  ud=Number("D= ",2,230,338,70,15,ud.val,-99.0,99.0)

  tfrq=Number("Turb.",2,15,300,85,15,tfrq.val,0.0,32.0,"freq.")
  tuO=Number("Octaves",2,15,280,130,15,tuO.val,0.0,32.0)
  tuL=Number("Lacunarity",2,15,260,130,15,tuL.val,0.0,100.0)
  tuG=Number("Gain",2,15,240,130,15,tuG.val,-16.0,16.0)
  tpox=Number("X",2,15,220,65,15,tpox.val,-99.0,99.0,"x pos.")
  tpoy=Number("Y",2,80,220,65,15,tpoy.val,-99.0,99.0,"y pos.")
  tuz=Number("Turb.Height",2,15,200,130,15,tuz.val,-64.0,64.0)
  tufall=Number("Falloff",2,15,180,130,15,tufall.val,0.0,1.0)
  ptx=Number("FX",2,15,160,65,15,ptx.val,-64.0,64.0,"x Loc.")
  pty=Number("FY",2,80,160,65,15,pty.val,-64.0,64.0,"y Loc.")

  ffrq=Number("fBm",2,210,300,85,15,ffrq.val,0.0,32.0,"freq.")
  fbO=Number("Octaves",2,165,280,130,15,fbO.val,0.0,32.0)
  fbL=Number("Lacunarity",2,165,260,130,15,fbL.val,0.0,100.0)
  fbG=Number("Gain",2,165,240,130,15,fbG.val,-16.0,16.0)
  fpox=Number("X",2,165,220,65,15,fpox.val,-99.0,99.0,"x pos.")
  fpoy=Number("Y",2,230,220,65,15,fpoy.val,-99.0,99.0,"y pos.")
  fbz=Number("fBm Height",2,165,200,130,15,fbz.val,-64.0,64.0)
  fbfall=Number("Falloff",2,165,180,130,15,fbfall.val,0.0,1.0)
  pfx=Number("FX",2,165,160,65,15,pfx.val,-64.0,64.0,"x Loc.")
  pfy=Number("FY",2,230,160,65,15,pfy.val,-64.0,64.0,"y Loc.")

  nfrqx=Number("X freq",2,15,120,130,15,nfrqx.val,0.0,64.0)
  nfrqy=Number("Y freq",2,15,100,130,15,nfrqy.val,0.0,64.0)
  npox=Number("X",2,15,80,65,15,npox.val,-99.0,99.0,"x pos.")
  npoy=Number("Y",2,80,80,65,15,npoy.val,-99.0,99.0,"y pos.")
  noz=Number("Noise Height",2,15,60,130,15,noz.val,-64.0,64.0)
  nofall=Number("Falloff",2,15,40,130,15,nofall.val,0.0,1.0)
  pnx=Number("FX",2,15,20,65,15,pnx.val,-64.0,64.0,"x Loc.")
  pny=Number("FY",2,80,20,65,15,pny.val,-64.0,64.0,"y Loc.")

  cfrqx=Number("X freq",2,165,120,130,15,cfrqx.val,0.0,64.0)
  cfrqy=Number("Y freq",2,165,100,130,15,cfrqy.val,0.0,64.0)
  cpox=Number("X",2,165,80,65,15,cpox.val,-99.0,99.0,"x pos.")
  cpoy=Number("Y",2,230,80,65,15,cpoy.val,-99.0,99.0,"y pos.")
  cez=Number("Cell Height",2,165,60,130,15,cez.val,-64.0,64.0)
  cefall=Number("Falloff",2,165,40,130,15,cefall.val,0.0,1.0)
  pcx=Number("FX",2,165,20,65,15,pcx.val,-64.0,64.0,"x Loc.")
  pcy=Number("FY",2,230,20,65,15,pcy.val,-64.0,64.0,"y Loc.")

  #
  Button("Exit",1,260,495,40,20)

  ##############################
#
###

def event(evt, val):
  if (evt== QKEY and not val):
      Exit()
#
###

def bevent(evt):
  if   (evt== 1):
     Exit()

#
  elif (evt== 2):
     aply_0()
     Draw()
     if realt.val == 1:
       aply_1()
       create()

  elif (evt== 3):
     aply_1()
     create()
     Redraw()

  elif (evt== 4):
     aply_0()
     reset()
     Draw()
     if realt.val == 1:
       create()

#
  elif (evt== 5):
     aply_2()
     presetstring1()
     Draw()
     if realt.val == 1:
       aply_1()
       create()

  elif (evt== 6):
     aply_2()
     presetstring2()
     Draw()
     if realt.val == 1:
       aply_1()
       create()

  elif (evt== 7):
     aply_0()
     clearstring()
     Draw()
     if realt.val == 1:
       create()

#
  elif (evt == 18):
     do_file(0)
     Draw()
     if realt.val == 1:
       create()
       aply_1()

  elif (evt == 19):
     do_file(1)
     Draw()

  elif (evt == 21):
     new = 1
     Draw()

 #
###


create()
Register(draw, event, bevent)
Blender.Redraw()


############################################################# 
 #\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  ############################################################# 

%| Please post some images :slight_smile:

Hey, Jimmy,

As creator of the product, why don’t YOU post some of the images you ccreated while testing the script?
Also, how does this differ form S68’s WordForge?

(Can’t see for myself, 'cause CGKit isn’t too linux friendly… )

Anyways, thanks for the script! The more the merrier!

Hi Jimmy,

first off A really great script, I have been playing with it nearly all night, hey Uglymike, one of the differences from Worldforge, is that you can see the changes in real time,on the same mesh :o :smiley: .

Jimmy, one of the things I have used this script for (really need some documentation :slight_smile: please) is trying to produce moving waves on water :o and it nearly works great, forget terrain, OK what I did was, on frame 1, I changed the turb hight to 1, then did a I (Insert) Mesh-absolute keys,(only this I (insert) seems to work?) went to frame 250, changed Y setting in nt=turbulance, to something higher, then did another I (insert) mesh, and played the animation (alt - a), and it moved in a sort of wave fashion, I don’t really know enough about Blender yet, but maybe you or others could do better than me, because the animation only seemed to affect the first hundred frames (my lack of knowledge).

Any way loads of playing still to do, I may even be able to fit in a bit of sleep :o .

To everyone else TRY THIS SCRIPT :smiley: :o its fun and usefull.

Ken

My Duvet is calling me

CGKit won’t compile for OS X.

Would love to use some of these terrain tools but…

sigh

-Bischofftep

Cool, another terrain tool :slight_smile:

I’ll try it soon.

We definitely need a noise python module built INTO blender

/me goes suggesting it to developers

Stefano

I’ve suggested a rendertime python hook on the functionality board that would allow scripts to generate noise or whatever they want at render time.

Nice…

but you must document it! I have written the other Blender Terrain Generator
http://www.selleri.org/Blender/scripts/BWF-0.0.9.zip which uses CGKit too
so I have a grasp on what all your buttons mean… but… hehe… well…
it is not user friendly :wink:

Stefano

Hey Jimmy,

Will you be doing any more work on yer script, docs etc.

Ken

Great script, still playing with it. :smiley: :o

I will not document this script because i realy have no time for that (i have a new job). And i have no webspace (at this time) to post images on,
so i still hope that someone post a nice terain/mountain image.

Here is a simple tutorial:


Simple mountain tutorial for Terrain_Tool

_First set Turb.Height -5 and fBm Height +15,
set both Turbulence and fBm Falloff value’s to 0.3,
Change the Plateau value to 5.0 and you have a flat “table” mountain,
to add some roughnes back to the plateau set P noise to 0.5 .
Set Floor to +0.5 .
Now you have created a simple mountain object.

_use freq.,Octaves,Lacunarity and Gain for more/less roughnes,
X,Y and/or Shift for noise’s offset,
FX and FY for falloff center positions.

_Try different settings for various results.


I suggest that you play a litle time with the Terain_Tool
to find out how it works .

Been using your script, and am really starting to get the hang of it, I really like it because of the realtime feedback, great work :smiley: .

Maybe in the future you will have time to develop this further. :slight_smile:

Ken

:wink:

Hey Jimmy Haze,

I like it even more, I like using his script to create terrains, realtime feedback, the fall of settings, cellnoise, all of that great work, :o :smiley:

Hope to put a few renders on my website when I get it sorted.

Thanks :smiley: :Z :Z

Ken

:smiley: 20/01/2004 Update to v1.2

Jimmy Haze : you still out there ? :smiley:

Should Terrain Tool work with Blender 2.33a and python 2.3? or am I doing somthing wrong?

Ken

Edit : OK scratch that, seems to be a problen with Tuhopuu! :smiley: :expressionless:

I’m upgrading BWF to get rid of CGkit, now that Blender has its ow noises :wink:

Stay tuned

Stefano

Great news, Stephano!!
I would love to play around with it…