A.N.T. ( Another Noise Tool )

This tool makes a deformed(noise) copy of the mesh you sellected .


#!BPY

"""
Name: 'A.N.T. ( Another Noise Tool )'
Blender: 233
Group: 'Misc'
"""

########################################
##
#  A.N.T. ( Another Noise Tool )
##
#  Jim Hazevoet  june-2004
##
#  This tool create's a deformed copy of sellected mesh
##
########################################


#---------------------------------------

import Blender
from Blender import *
from Blender.Noise import *
from Blender.Draw import *
from Blender.BGL import *
from math import *
#---------------------------------------

curscene = Scene.GetCurrent()
undo = []


VGname = Create("Sphere")	#= Vertex group name

NFunc = Create(1)			#= Noise function

Sx = Create(1.0)			#= Scale X
Sy = Create(1.0)			#= Scale Y
Sz = Create(1.0)			#= Scale Z
Lx = Create(0.0)			#= Loc. X
Ly = Create(0.0)			#= Loc. Y
Lz = Create(0.0)			#= Loc. Z

NSize = Create(1.0)			#= Noise size
iSca = Create(1.0)			#= Intensity scale

NType = Create(1)			#= Musgrave noise
BType = Create(1)			#= Basis noise

Oc = Create(2.0)			#= Octaves
La = Create(2.0)			#= Lacunarity
Ga = Create(1.0)			#= Gain
Ha = Create(1.0)			#= H
Of = Create(1.0)			#= Offset

BDist1 = Create(1)			#= Basis Distortion noise 1
BDist2 = Create(1)			#= Basis Distortion noise 2
DAmnt  = Create(1.0)		#= Distortion Amount

BTurb = Create(1)			#= Basis Turbulence Noise
TDep  = Create(2)			#= Depth
TSH   = Create(0)			#= Soft/Hard
Tamp  = Create(0.5)			#= Ampscale
Tfrq  = Create(2.0)			#= Freqscale

plev    =Create(10.0)
flev    =Create(-10.0)

#---------------------------------------
def reset():
	global NType, BType, BDist1, BDist2, DAmnt, BTurb, TDep, TSH, Tamp, Tfrq
	global iSca, NSize, Sx, Sy, Sz, Lx, Ly, Lz
	global Oc, La, Ga, Ha, Of
	global plev, flev

	plev    =Create(10.0)
	flev    =Create(-10.0)


	Sx = Create(1.0)
	Sy = Create(1.0)
	Sz = Create(1.0)
	Lx = Create(0.0)
	Ly = Create(0.0) 
	Lz = Create(0.0)
	NSize = Create(1.0)
	iSca = Create(1.0)
	DAmnt = Create(1.0)
	BDist1 = Create(1)
	BDist2 = Create(1)	
	NType = Create(1)
	BType = Create(1)
	Oc = Create(2.0)
	La = Create(2.0)
	Ga = Create(1.0)
	Ha = Create(1.0)
	Of = Create(1.0)
	BTurb = Create(1)
	TDep  = Create(2)
	TSH   = Create(0)
	Tamp   = Create(0.5)
	Tfrq   = Create(2.0)


#---------------------------------------
def Trans(v):
	x,y,z = v
	x2 = (x*Sx.val+Lx.val)/NSize.val
	y2 = (y*Sy.val+Ly.val)/NSize.val
	z2 = (z*Sz.val+Lz.val)/NSize.val
	return x2,y2,z2

#-----------------------------------
def function():
	global VGname, NType, BType, NFunc, BDist1, TDep, TSH, Tamp, Tfrq
	global iSca, NSize, Sx, Sy, Sz, Lx, Ly, Lz, DAmnt
	global Oc, La, Ga, Ha, Of
	global plev, flev

	#o=Blender.Object.GetSelected()[0]
	#m=o.getData()
	#n=m.name
	#
	#
	obj = Blender.Object.GetSelected()
	if obj !=[] and len(obj) == 1:
		obj = obj[0]
		#
		m = Blender.NMesh.GetRawFromObject(obj.name)
	else:
		m = NMesh.GetRawFromObject(VGname.val)

	normals = []
	coordinates = []

	for v in m.verts:

		i = m.verts.index(v)

		normals.append([v.no[0],v.no[1],v.no[2]])
		coordinates.append([v.co[0],v.co[1],v.co[2]])

		#	
		P = Trans((v.co[0],v.co[1],v.co[2]))

		B  = BType.val-1
		B1 = BDist1.val-1

		if (NFunc.val == 1):
			if (NType.val == 1):
				h = multiFractal((P),Ha.val,La.val,Oc.val,B)
			if (NType.val == 2):
				h = ridgedMFractal((P),Ha.val,La.val,Oc.val,Of.val,Ga.val,B)
			if (NType.val == 3):
				h = hybridMFractal((P),Ha.val,La.val,Oc.val,Of.val,Ga.val,B)
			if (NType.val == 4):
				h = heteroTerrain((P),Ha.val,La.val,Oc.val,Of.val,B)
			if (NType.val == 5):
				h = fBm((P),Ha.val,La.val,Oc.val,B)

		if (NFunc.val == 2):
			h = vlNoise((P),DAmnt.val,B1,B)

		if (NFunc.val == 3):
			h = turbulence((P),TDep.val,TSH.val,B,Tamp.val,Tfrq.val)

		if (NFunc.val == 4):
			h = cellNoise((P))


		it = h*iSca.val/5

		if (it < flev.val): it = flev.val
		if (it > plev.val): it = plev.val

		for z in range(3): 
			v.co[z] = coordinates[i][z] + (it * normals[i][z])


	ob = Blender.NMesh.PutRaw(m)
	undo.append(ob)
	ob=1

#---------------------------------------
def gui():
	global VGname, NType, BType, NFunc, BDist1, TDep, TSH, Tamp, Tfrq
	global iSca, NSize, Sx, Sy, Sz, Lx, Ly, Lz, DAmnt
	global Oc, La, Ga, Ha, Of
	global plev, flev

	BGL.glClearColor(0.6, 0.6, 0.6, 1) 
	BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)

	glColor3f(0.0,0.0,0.0) 
	glRasterPos2d(80, 375) 
	Text("A.N.T. ( Another Noise Tool )") 

	VGname = String("NMesh.GetRawFromObject  =  ", 3,10,325,300,20, VGname.val,200)

	Nn = "NoiseType's%t|Musgrave%x1|DistortedNoise%x2|Turbulence%x3|CellNoise%x4"
	NFunc = Menu(Nn, 3, 10,275,300,30, NFunc.val)

	Sx = Number("Sx = ", 3, 160,115,150,20, Sx.val,0.0,10.0)
	Sy = Number("Sy = ", 3, 160,95,150,20, Sy.val,0.0,10.0)
	Sz = Number("Sz = ", 3, 160,75,150,20, Sz.val,0.0,10.0)
	Lx = Number("Lx = ", 3, 10,115,150,20, Lx.val,-1000.0,1000.0)
	Ly = Number("Ly = ", 3, 10,95,150,20, Ly.val,-1000.0,1000.0)
	Lz = Number("Lz = ", 3, 10,75,150,20, Lz.val,-1000.0,1000.0)

	iSca = Number("iScale = ", 3, 10,145,150,20, iSca.val,-10.0,10.0)
	NSize = Number("NoiseSize = ", 3, 160,145,150,20, NSize.val,0.001,20.0)


	if (NFunc.val == 1):
		Bn = "Noise Basis%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
			|Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
			|Voronoi Crackle%x9|CellNoise%x10"
		BType = Menu(Bn, 3, 160,175,150,20, BType.val)

		Fn = "Musgrave Type's%t|MultiFractal%x1|RidgedMF%x2\
		|HybridMF%x3|HTerrain%x4|fBm%x5"
		NType = Menu(Fn, 3, 10,175,150,20, NType.val)

		Oc = Slider("Oct = ", 3, 10,205,150,20, Oc.val,0.0,8.0 ,0)
		La = Slider("Lac = ", 3, 160,205,150,20, La.val,0.0,6.0 ,0)
		Ha = Slider("H = ", 3, 10,225,150,20, Ha.val,0.0,2.0 ,0)

		if (NType.val == 2):
			Of = Slider("Ofst = ", 3, 160,225,150,20, Of.val,0.0,6.0 ,0)
			Ga = Slider("Gain = ", 3, 10,245,150,20, Ga.val,0.0,6.0 ,0)

		if (NType.val == 3):
			Of = Slider("Ofst = ", 3, 160,225,150,20, Of.val,0.0,6.0 ,0)
			Ga = Slider("Gain = ", 3, 10,245,150,20, Ga.val,0.0,6.0 ,0)

		if (NType.val == 4):
			Of = Slider("Ofst = ", 3, 160,225,150,20, Of.val,0.0,6.0 ,0)


	if (NFunc.val == 2):
		Bn = "Noise Basis%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
			|Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
			|Voronoi Crackle%x9|CellNoise%x10"
		BType = Menu(Bn, 3, 160,175,150,20, BType.val)

		Bd1 = "Distortion Noise%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
			|Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
			|Voronoi Crackle%x9|CellNoise%x10"
		BDist1 = Menu(Bd1, 3, 10,175,150,20, BDist1.val)

		DAmnt = Slider("Distortion Amount = ", 3, 10,205,300,20, DAmnt.val,0.0,10.0, 0)


	if (NFunc.val == 3):
		Bn = "Noise Basis%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
			|Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
			|Voronoi Crackle%x9|CellNoise%x10"
		BType = Menu(Bn, 3, 160,175,150,20, BType.val)

		TDep = Number("Depth = ", 3, 10,175,100,20, TDep.val,0.0,10.0)
		TSH = Toggle("S/H", 3, 110,175,50,20, TSH.val)
		Tamp = Number("Amp = ", 3, 10,205,150,20, Tamp.val,0.0,10.0)
		Tfrq = Number("Frq = ", 3, 160,205,150,20, Tfrq.val,0.0,10.0)


	flev=Number("Min.(Sealevel)",3,10,45,150,20,flev.val,-50.0,50.0)
	plev=Number("Max.(Plateau)",3,160,45,150,20,plev.val,-50.0,50.0)

	Button("Create", 2, 10,10,150,25," Create ( Space key ) ")
	Button("Delete", 10, 160,10,50,25," Delete ( X key ) ")
	Button("Reset", 4, 210,10,50,25)
	Button("Exit", 1, 260,10,50,25," Exit ( Esc. key ) ")


#---------------------------------------
def event(evt, val):
	global undo

	if (evt == ESCKEY and not val):
		name = "EXIT SCRIPT ?%t|YES %x1|NO %x2"
		result = Blender.Draw.PupMenu(name)
		if result == 1:
			Exit()
	if (evt== SPACEKEY and not val):
		function()
		Blender.Redraw()

	if (evt== XKEY and not val):
		for ob in undo:
			curscene.unlink(ob)
			curscene.update()
		undo = []
		Blender.Redraw()

#---------------------------------------
def bevent(evt):
	global undo

	if evt == 1:
		Exit()
	if evt == 2:
		function()
		Blender.Redraw()
	if evt == 3:
		Draw()
	if evt == 4:
		reset()
		Blender.Redraw()
	if (evt == 10):
		for ob in undo:
			curscene.unlink(ob)
			curscene.update()
		undo = []
		Blender.Redraw()
#
Register(gui, event, bevent)

can you post it as a file ?

I get this after a copy paste clean up
File “awr.py”, line 193
VGname = String(Name = ", 3,10,325,300,20, VGname.val,200)
^
SyntaxError: EOL while scanning single-quoted string
File “awr.py”, line 193
VGname = String(Name = ", 3,10,325,300,20, VGname.val,200)
^
SyntaxError: EOL while scanning single-quoted string

No i cant post as file at this time(sorry),
maybe you or someone else can .
I write scripts just for fun,i know almost nothing about programming stuff.
Now i have copied and pasted my script to my pc into Blender, and yes
the same error as you mentioned. I have fixed some problems , and it works fine now on my pc.
The script above is fixed ( i hope ).

  • problems are the spaces behind the slash \

OK, I got it working after removing the spaces. Haven’t done anything but the sphere and a cube but it works!

%<

when you post as code it seems like a good idea to convert tabs to spaces and strip whitespace before you post and convert spaces to tabs and strip whitespace after you copy code from web.

anyway Blender would benefit from python code autoformatter like flash has for actionscript.

I like this, Instant rocks! :smiley: and stone blocks! :smiley:

I like it and your array py too, thanks :smiley:

Ken

It will be fine if you could include a picture preview
like the Ripsting’s “Color2.py” script saw in this post:
http://www.elysiun.com/forum/viewtopic.php?t=25941&highlight=
:wink:
++
Ph
http://hp.home.chez.tiscali.fr/re_illusion/index.htm

You forget the tooltip in the header of the script:

“”"
Name: ‘Another Noise Tool’
Blender: 233
Group: ‘Mesh’
Tip: ‘creates a deformed copy of the mesh you sellected’
“”"

You want something, just do it yourself !

So i permit myself to append a previewer to Jimmy Haze’s ‘A.T.N.’ script .

here is the code :



#!BPY

"""
Name: 'A.N.T. ( Another Noise Tool )'
Blender: 233
Group: 'Misc'
"""

########################################
##
#  A.N.T. ( Another Noise Tool )
##
#  Jim Hazevoet  june-2004
##
#  This tool create's a deformed copy of sellected mesh
##
########################################


#---------------------------------------

import Blender
from Blender import *
from Blender.Noise import *
from Blender.Draw import *
from Blender.BGL import *
from math import *
#---------------------------------------

curscene = Scene.GetCurrent()
undo = []


VGname = Create("Sphere")   #= Vertex group name

NFunc = Create(1)         #= Noise function

Sx = Create(1.0)         #= Scale X
Sy = Create(1.0)         #= Scale Y
Sz = Create(1.0)         #= Scale Z
Lx = Create(0.0)         #= Loc. X
Ly = Create(0.0)         #= Loc. Y
Lz = Create(0.0)         #= Loc. Z

NSize = Create(1.0)         #= Noise size
iSca = Create(1.0)         #= Intensity scale

NType = Create(1)         #= Musgrave noise
BType = Create(1)         #= Basis noise

Oc = Create(2.0)         #= Octaves
La = Create(2.0)         #= Lacunarity
Ga = Create(1.0)         #= Gain
Ha = Create(1.0)         #= H
Of = Create(1.0)         #= Offset

BDist1 = Create(1)         #= Basis Distortion noise 1
BDist2 = Create(1)         #= Basis Distortion noise 2
DAmnt  = Create(1.0)      #= Distortion Amount

BTurb = Create(1)         #= Basis Turbulence Noise
TDep  = Create(2)         #= Depth
TSH   = Create(0)         #= Soft/Hard
Tamp  = Create(0.5)         #= Ampscale
Tfrq  = Create(2.0)         #= Freqscale

plev    =Create(10.0)
flev    =Create(-10.0)

#---------------------------------------
def reset():
   global NType, BType, BDist1, BDist2, DAmnt, BTurb, TDep, TSH, Tamp, Tfrq
   global iSca, NSize, Sx, Sy, Sz, Lx, Ly, Lz
   global Oc, La, Ga, Ha, Of
   global plev, flev

   plev    =Create(10.0)
   flev    =Create(-10.0)



   Sx = Create(1.0)
   Sy = Create(1.0)
   Sz = Create(1.0)
   Lx = Create(0.0)
   Ly = Create(0.0)
   Lz = Create(0.0)
   NSize = Create(1.0)
   iSca = Create(1.0)
   DAmnt = Create(1.0)
   BDist1 = Create(1)
   BDist2 = Create(1)   
   NType = Create(1)
   BType = Create(1)
   Oc = Create(2.0)
   La = Create(2.0)
   Ga = Create(1.0)
   Ha = Create(1.0)
   Of = Create(1.0)
   BTurb = Create(1)
   TDep  = Create(2)
   TSH   = Create(0)
   Tamp   = Create(0.5)
   Tfrq   = Create(2.0)


#---------------------------------------
def Trans(v):
   x,y,z = v
   x2 = (x*Sx.val+Lx.val)/NSize.val
   y2 = (y*Sy.val+Ly.val)/NSize.val
   z2 = (z*Sz.val+Lz.val)/NSize.val
   return x2,y2,z2

#-----------------------------------
def function():
   global VGname, NType, BType, NFunc, BDist1, TDep, TSH, Tamp, Tfrq
   global iSca, NSize, Sx, Sy, Sz, Lx, Ly, Lz, DAmnt
   global Oc, La, Ga, Ha, Of
   global plev, flev

   #o=Blender.Object.GetSelected()[0]
   #m=o.getData()
   #n=m.name
   #
   #
   obj = Blender.Object.GetSelected()
   if obj !=[] and len(obj) == 1:
      obj = obj[0]
      #
      m = Blender.NMesh.GetRawFromObject(obj.name)
   else:
      m = NMesh.GetRawFromObject(VGname.val)

   normals = []
   coordinates = []

   for v in m.verts:

      i = m.verts.index(v)

      normals.append([v.no[0],v.no[1],v.no[2]])
      coordinates.append([v.co[0],v.co[1],v.co[2]])

      #   
      P = Trans((v.co[0],v.co[1],v.co[2]))

      B  = BType.val-1
      B1 = BDist1.val-1

      if (NFunc.val == 1):
         if (NType.val == 1):
            h = multiFractal((P),Ha.val,La.val,Oc.val,B)
         if (NType.val == 2):
            h = ridgedMFractal((P),Ha.val,La.val,Oc.val,Of.val,Ga.val,B)
         if (NType.val == 3):
            h = hybridMFractal((P),Ha.val,La.val,Oc.val,Of.val,Ga.val,B)
         if (NType.val == 4):
            h = heteroTerrain((P),Ha.val,La.val,Oc.val,Of.val,B)
         if (NType.val == 5):
            h = fBm((P),Ha.val,La.val,Oc.val,B)

      if (NFunc.val == 2):
         h = vlNoise((P),DAmnt.val,B1,B)

      if (NFunc.val == 3):
         h = turbulence((P),TDep.val,TSH.val,B,Tamp.val,Tfrq.val)

      if (NFunc.val == 4):
         h = cellNoise((P))


      it = h*iSca.val/5

      if (it &lt; flev.val): it = flev.val
      if (it &gt; plev.val): it = plev.val

      for z in range(3):
         v.co[z] = coordinates[i][z] + (it * normals[i][z])


   ob = Blender.NMesh.PutRaw(m)
   undo.append(ob)
   ob=1

#---------------------------------------
def gui():
   global VGname, NType, BType, NFunc, BDist1, TDep, TSH, Tamp, Tfrq
   global iSca, NSize, Sx, Sy, Sz, Lx, Ly, Lz, DAmnt
   global Oc, La, Ga, Ha, Of
   global plev, flev

   BGL.glClearColor(0.6, 0.6, 0.6, 1)
   BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)

   glColor3f(0.0,0.0,0.0)
   glRasterPos2d(80, 375)
   Text("A.N.T. ( Another Noise Tool )")

   VGname = String("NMesh.GetRawFromObject  =  ", 3,10,325,300,20, VGname.val,200)

   Nn = "NoiseType's%t|Musgrave%x1|DistortedNoise%x2|Turbulence%x3|CellNoise%x4"
   NFunc = Menu(Nn, 3, 10,275,300,30, NFunc.val)

   Sx = Number("Sx = ", 3, 160,115,150,20, Sx.val,0.0,10.0)
   Sy = Number("Sy = ", 3, 160,95,150,20, Sy.val,0.0,10.0)
   Sz = Number("Sz = ", 3, 160,75,150,20, Sz.val,0.0,10.0)
   Lx = Number("Lx = ", 3, 10,115,150,20, Lx.val,-1000.0,1000.0)
   Ly = Number("Ly = ", 3, 10,95,150,20, Ly.val,-1000.0,1000.0)
   Lz = Number("Lz = ", 3, 10,75,150,20, Lz.val,-1000.0,1000.0)

   iSca = Number("iScale = ", 3, 10,145,150,20, iSca.val,-10.0,10.0)
   NSize = Number("NoiseSize = ", 3, 160,145,150,20, NSize.val,0.001,20.0)


   if (NFunc.val == 1):
      Bn = "Noise Basis%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
         |Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
         |Voronoi Crackle%x9|CellNoise%x10"
      BType = Menu(Bn, 3, 160,175,150,20, BType.val)

      Fn = "Musgrave Type's%t|MultiFractal%x1|RidgedMF%x2\
      |HybridMF%x3|HTerrain%x4|fBm%x5"
      NType = Menu(Fn, 3, 10,175,150,20, NType.val)

      Oc = Slider("Oct = ", 3, 10,205,150,20, Oc.val,0.0,8.0 ,0)
      La = Slider("Lac = ", 3, 160,205,150,20, La.val,0.0,6.0 ,0)
      Ha = Slider("H = ", 3, 10,225,150,20, Ha.val,0.0,2.0 ,0)

      if (NType.val == 2):
         Of = Slider("Ofst = ", 3, 160,225,150,20, Of.val,0.0,6.0 ,0)
         Ga = Slider("Gain = ", 3, 10,245,150,20, Ga.val,0.0,6.0 ,0)

      if (NType.val == 3):
         Of = Slider("Ofst = ", 3, 160,225,150,20, Of.val,0.0,6.0 ,0)
         Ga = Slider("Gain = ", 3, 10,245,150,20, Ga.val,0.0,6.0 ,0)

      if (NType.val == 4):
         Of = Slider("Ofst = ", 3, 160,225,150,20, Of.val,0.0,6.0 ,0)


   if (NFunc.val == 2):
      Bn = "Noise Basis%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
         |Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
         |Voronoi Crackle%x9|CellNoise%x10"
      BType = Menu(Bn, 3, 160,175,150,20, BType.val)

      Bd1 = "Distortion Noise%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
         |Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
         |Voronoi Crackle%x9|CellNoise%x10"
      BDist1 = Menu(Bd1, 3, 10,175,150,20, BDist1.val)

      DAmnt = Slider("Distortion Amount = ", 3, 10,205,300,20, DAmnt.val,0.0,10.0, 0)


   if (NFunc.val == 3):
      Bn = "Noise Basis%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
         |Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
         |Voronoi Crackle%x9|CellNoise%x10"
      BType = Menu(Bn, 3, 160,175,150,20, BType.val)

      TDep = Number("Depth = ", 3, 10,175,100,20, TDep.val,0.0,10.0)
      TSH = Toggle("S/H", 3, 110,175,50,20, TSH.val)
      Tamp = Number("Amp = ", 3, 10,205,150,20, Tamp.val,0.0,10.0)
      Tfrq = Number("Frq = ", 3, 160,205,150,20, Tfrq.val,0.0,10.0)


   flev=Number("Min.(Sealevel)",3,10,45,150,20,flev.val,-50.0,50.0)
   plev=Number("Max.(Plateau)",3,160,45,150,20,plev.val,-50.0,50.0)

   Button("Create", 2, 10,10,150,25," Create ( Space key ) ")
   Button("Delete", 10, 160,10,50,25," Delete ( X key ) ")
   Button("Reset", 4, 210,10,50,25)
   Button("Exit", 1, 260,10,50,25," Exit ( Esc. key ) ")

   previewer()

def previewer():

   contrast = iSca.val * 1.0
   zoom = (20 * NSize.val) * 3

   sx = 96 + 60
   sy = 397 + 60
   for x in range(-60, 60):
        for y in range(-60, 60):


            B  = BType.val-1
            B1 = BDist1.val-1

            if (NFunc.val == 1):
               if (NType.val == 1):
                  pointCol = multiFractal(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),Ha.val,La.val,Oc.val,B)

               if (NType.val == 2):
                  pointCol = ridgedMFractal(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),Ha.val,La.val,Oc.val,Of.val,Ga.val,B)

               if (NType.val == 3):
                  pointCol = hybridMFractal(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),Ha.val,La.val,Oc.val,Of.val,Ga.val,B)

               if (NType.val == 4):
                  pointCol = heteroTerrain(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),Ha.val,La.val,Oc.val,Of.val,B)

               if (NType.val == 5):
                  pointCol = fBm(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),Ha.val,La.val,Oc.val,B)

            if (NFunc.val == 2):
               pointCol = vlNoise(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),DAmnt.val,B1,B)

            if (NFunc.val == 3):
               pointCol = turbulence(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),TDep.val,TSH.val,B,Tamp.val,Tfrq.val)

            if (NFunc.val == 4):
               pointCol = cellNoise(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val))


            pointCol = pointCol * contrast


            r = pointCol
            g = pointCol
            b = pointCol

            if iSca.val &lt; 0 :
                r = 1+pointCol
                g = 1+pointCol
                b = 1+pointCol

            glColor3f(r,g,b)
            glRecti(sx + x, sy + y, sx + x + 1, sy + y + 1)



#---------------------------------------
def event(evt, val):
   global undo

   if (evt == ESCKEY and not val):
      name = "EXIT SCRIPT ?%t|YES %x1|NO %x2"
      result = Blender.Draw.PupMenu(name)
      if result == 1:
         Exit()
   if (evt== SPACEKEY and not val):
      function()
      Blender.Redraw()

   if (evt== XKEY and not val):
      for ob in undo:
         curscene.unlink(ob)
         curscene.update()
      undo = []
      Blender.Redraw()

#---------------------------------------
def bevent(evt):
   global undo

   if evt == 1:
      Exit()
   if evt == 2:
      function()
      Blender.Redraw()
   if evt == 3:
      Draw()
   if evt == 4:
      reset()
      Blender.Redraw()
   if (evt == 10):
      for ob in undo:
         curscene.unlink(ob)
         curscene.update()
      undo = []
      Blender.Redraw()
#
Register(gui, event, bevent) 

:wink:
++
Ph
http://hp.home.chez.tiscali.fr/re_illusion/index.htm

Sorry for this alterate version :


#!BPY

"""
Name: 'A.N.T. ( Another Noise Tool )'
Blender: 233
Group: 'Misc'
"""

########################################
##
#  A.N.T. ( Another Noise Tool )
##
#  Jim Hazevoet  june-2004
##
#  This tool create's a deformed copy of sellected mesh
##
########################################


#---------------------------------------

import Blender
from Blender import *
from Blender.Noise import *
from Blender.Draw import *
from Blender.BGL import *
from math import *
#---------------------------------------

curscene = Scene.GetCurrent()
undo = []


VGname = Create("Sphere")   #= Vertex group name

NFunc = Create(1)         #= Noise function

Sx = Create(1.0)         #= Scale X
Sy = Create(1.0)         #= Scale Y
Sz = Create(1.0)         #= Scale Z
Lx = Create(0.0)         #= Loc. X
Ly = Create(0.0)         #= Loc. Y
Lz = Create(0.0)         #= Loc. Z

NSize = Create(1.0)         #= Noise size
iSca = Create(1.0)         #= Intensity scale

NType = Create(1)         #= Musgrave noise
BType = Create(1)         #= Basis noise

Oc = Create(2.0)         #= Octaves
La = Create(2.0)         #= Lacunarity
Ga = Create(1.0)         #= Gain
Ha = Create(1.0)         #= H
Of = Create(1.0)         #= Offset

BDist1 = Create(1)         #= Basis Distortion noise 1
BDist2 = Create(1)         #= Basis Distortion noise 2
DAmnt  = Create(1.0)      #= Distortion Amount

BTurb = Create(1)         #= Basis Turbulence Noise
TDep  = Create(2)         #= Depth
TSH   = Create(0)         #= Soft/Hard
Tamp  = Create(0.5)         #= Ampscale
Tfrq  = Create(2.0)         #= Freqscale

plev    =Create(10.0)
flev    =Create(-10.0)

#---------------------------------------
def reset():
   global NType, BType, BDist1, BDist2, DAmnt, BTurb, TDep, TSH, Tamp, Tfrq
   global iSca, NSize, Sx, Sy, Sz, Lx, Ly, Lz
   global Oc, La, Ga, Ha, Of
   global plev, flev

   plev    =Create(10.0)
   flev    =Create(-10.0)



   Sx = Create(1.0)
   Sy = Create(1.0)
   Sz = Create(1.0)
   Lx = Create(0.0)
   Ly = Create(0.0)
   Lz = Create(0.0)
   NSize = Create(1.0)
   iSca = Create(1.0)
   DAmnt = Create(1.0)
   BDist1 = Create(1)
   BDist2 = Create(1)   
   NType = Create(1)
   BType = Create(1)
   Oc = Create(2.0)
   La = Create(2.0)
   Ga = Create(1.0)
   Ha = Create(1.0)
   Of = Create(1.0)
   BTurb = Create(1)
   TDep  = Create(2)
   TSH   = Create(0)
   Tamp   = Create(0.5)
   Tfrq   = Create(2.0)


#---------------------------------------
def Trans(v):
   x,y,z = v
   x2 = (x*Sx.val+Lx.val)/NSize.val
   y2 = (y*Sy.val+Ly.val)/NSize.val
   z2 = (z*Sz.val+Lz.val)/NSize.val
   return x2,y2,z2

#-----------------------------------
def function():
   global VGname, NType, BType, NFunc, BDist1, TDep, TSH, Tamp, Tfrq
   global iSca, NSize, Sx, Sy, Sz, Lx, Ly, Lz, DAmnt
   global Oc, La, Ga, Ha, Of
   global plev, flev

   #o=Blender.Object.GetSelected()[0]
   #m=o.getData()
   #n=m.name
   #
   #
   obj = Blender.Object.GetSelected()
   if obj !=[] and len(obj) == 1:
      obj = obj[0]
      #
      m = Blender.NMesh.GetRawFromObject(obj.name)
   else:
      m = NMesh.GetRawFromObject(VGname.val)

   normals = []
   coordinates = []

   for v in m.verts:

      i = m.verts.index(v)

      normals.append([v.no[0],v.no[1],v.no[2]])
      coordinates.append([v.co[0],v.co[1],v.co[2]])

      #   
      P = Trans((v.co[0],v.co[1],v.co[2]))

      B  = BType.val-1
      B1 = BDist1.val-1

      if (NFunc.val == 1):
         if (NType.val == 1):
            h = multiFractal((P),Ha.val,La.val,Oc.val,B)
         if (NType.val == 2):
            h = ridgedMFractal((P),Ha.val,La.val,Oc.val,Of.val,Ga.val,B)
         if (NType.val == 3):
            h = hybridMFractal((P),Ha.val,La.val,Oc.val,Of.val,Ga.val,B)
         if (NType.val == 4):
            h = heteroTerrain((P),Ha.val,La.val,Oc.val,Of.val,B)
         if (NType.val == 5):
            h = fBm((P),Ha.val,La.val,Oc.val,B)

      if (NFunc.val == 2):
         h = vlNoise((P),DAmnt.val,B1,B)

      if (NFunc.val == 3):
         h = turbulence((P),TDep.val,TSH.val,B,Tamp.val,Tfrq.val)

      if (NFunc.val == 4):
         h = cellNoise((P))


      it = h*iSca.val/5

      if (it &lt; flev.val): it = flev.val
      if (it &gt; plev.val): it = plev.val

      for z in range(3):
         v.co[z] = coordinates[i][z] + (it * normals[i][z])


   ob = Blender.NMesh.PutRaw(m)
   undo.append(ob)
   ob=1

#---------------------------------------
def gui():
   global VGname, NType, BType, NFunc, BDist1, TDep, TSH, Tamp, Tfrq
   global iSca, NSize, Sx, Sy, Sz, Lx, Ly, Lz, DAmnt
   global Oc, La, Ga, Ha, Of
   global plev, flev

   BGL.glClearColor(0.6, 0.6, 0.6, 1)
   BGL.glClear(BGL.GL_COLOR_BUFFER_BIT)

   glColor3f(0.0,0.0,0.0)
   glRasterPos2d(80, 375)
   Text("A.N.T. ( Another Noise Tool )")

   VGname = String("NMesh.GetRawFromObject  =  ", 3,10,325,300,20, VGname.val,200)

   Nn = "NoiseType's%t|Musgrave%x1|DistortedNoise%x2|Turbulence%x3|CellNoise%x4"
   NFunc = Menu(Nn, 3, 10,275,300,30, NFunc.val)

   Sx = Number("Sx = ", 3, 160,115,150,20, Sx.val,0.0,10.0)
   Sy = Number("Sy = ", 3, 160,95,150,20, Sy.val,0.0,10.0)
   Sz = Number("Sz = ", 3, 160,75,150,20, Sz.val,0.0,10.0)
   Lx = Number("Lx = ", 3, 10,115,150,20, Lx.val,-1000.0,1000.0)
   Ly = Number("Ly = ", 3, 10,95,150,20, Ly.val,-1000.0,1000.0)
   Lz = Number("Lz = ", 3, 10,75,150,20, Lz.val,-1000.0,1000.0)

   iSca = Number("iScale = ", 3, 10,145,150,20, iSca.val,-10.0,10.0)
   NSize = Number("NoiseSize = ", 3, 160,145,150,20, NSize.val,0.001,20.0)


   if (NFunc.val == 1):
      Bn = "Noise Basis%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
         |Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
         |Voronoi Crackle%x9|CellNoise%x10"
      BType = Menu(Bn, 3, 160,175,150,20, BType.val)

      Fn = "Musgrave Type's%t|MultiFractal%x1|RidgedMF%x2\
      |HybridMF%x3|HTerrain%x4|fBm%x5"
      NType = Menu(Fn, 3, 10,175,150,20, NType.val)

      Oc = Slider("Oct = ", 3, 10,205,150,20, Oc.val,0.0,8.0 ,0)
      La = Slider("Lac = ", 3, 160,205,150,20, La.val,0.0,6.0 ,0)
      Ha = Slider("H = ", 3, 10,225,150,20, Ha.val,0.0,2.0 ,0)

      if (NType.val == 2):
         Of = Slider("Ofst = ", 3, 160,225,150,20, Of.val,0.0,6.0 ,0)
         Ga = Slider("Gain = ", 3, 10,245,150,20, Ga.val,0.0,6.0 ,0)

      if (NType.val == 3):
         Of = Slider("Ofst = ", 3, 160,225,150,20, Of.val,0.0,6.0 ,0)
         Ga = Slider("Gain = ", 3, 10,245,150,20, Ga.val,0.0,6.0 ,0)

      if (NType.val == 4):
         Of = Slider("Ofst = ", 3, 160,225,150,20, Of.val,0.0,6.0 ,0)


   if (NFunc.val == 2):
      Bn = "Noise Basis%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
         |Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
         |Voronoi Crackle%x9|CellNoise%x10"
      BType = Menu(Bn, 3, 160,175,150,20, BType.val)

      Bd1 = "Distortion Noise%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
         |Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
         |Voronoi Crackle%x9|CellNoise%x10"
      BDist1 = Menu(Bd1, 3, 10,175,150,20, BDist1.val)

      DAmnt = Slider("Distortion Amount = ", 3, 10,205,300,20, DAmnt.val,0.0,10.0, 0)


   if (NFunc.val == 3):
      Bn = "Noise Basis%t|Blender Original%x1|Original Perlin%x2|Improved Perlin%x3\
         |Voronoi_F1%x4|Voronoi_F2%x5|Voronoi_F3%x6|Voronoi_F4%x7|Voronoi_F2-F1%x8\
         |Voronoi Crackle%x9|CellNoise%x10"
      BType = Menu(Bn, 3, 160,175,150,20, BType.val)

      TDep = Number("Depth = ", 3, 10,175,100,20, TDep.val,0.0,10.0)
      TSH = Toggle("S/H", 3, 110,175,50,20, TSH.val)
      Tamp = Number("Amp = ", 3, 10,205,150,20, Tamp.val,0.0,10.0)
      Tfrq = Number("Frq = ", 3, 160,205,150,20, Tfrq.val,0.0,10.0)


   flev=Number("Min.(Sealevel)",3,10,45,150,20,flev.val,-50.0,50.0)
   plev=Number("Max.(Plateau)",3,160,45,150,20,plev.val,-50.0,50.0)

   Button("Create", 2, 10,10,150,25," Create ( Space key ) ")
   Button("Delete", 10, 160,10,50,25," Delete ( X key ) ")
   Button("Reset", 4, 210,10,50,25)
   Button("Exit", 1, 260,10,50,25," Exit ( Esc. key ) ")

   previewer()

def previewer():

   contrast = iSca.val * 1.0
   zoom = (20 * NSize.val) * 3

   sx = 96 + 60
   sy = 397 + 60
   for x in range(-60, 60):
        for y in range(-60, 60):
            B  = BType.val-1
            B1 = BDist1.val-1
            if (NFunc.val == 1):
               if (NType.val == 1):
                  pointCol = multiFractal(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),Ha.val,La.val,Oc.val,B)
               if (NType.val == 2):
                  pointCol = ridgedMFractal(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),Ha.val,La.val,Oc.val,Of.val,Ga.val,B)
               if (NType.val == 3):
                  pointCol = hybridMFractal(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),Ha.val,La.val,Oc.val,Of.val,Ga.val,B)
               if (NType.val == 4):
                  pointCol = heteroTerrain(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),Ha.val,La.val,Oc.val,Of.val,B)
               if (NType.val == 5):
                  pointCol = fBm(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),Ha.val,La.val,Oc.val,B)
            if (NFunc.val == 2):
               pointCol = vlNoise(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),DAmnt.val,B1,B)
            if (NFunc.val == 3):
               pointCol = turbulence(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val),TDep.val,TSH.val,B,Tamp.val,Tfrq.val)
            if (NFunc.val == 4):
               pointCol = cellNoise(((x/zoom)*Sx.val + Lx.val, (y/zoom)*Sy.val + Ly.val,Lz.val))
            # don't need of this
            # pointCol = pointCol * contrast
            # 50% of results can be under 0.0 so :
            r = (pointCol+1.0)/2.0
            g = (pointCol+1.0)/2.0
            b = (pointCol+1.0)/2.0


            glColor3f(r,g,b)
            glRecti(sx + x, sy + y, sx + x + 1, sy + y + 1)



#---------------------------------------
def event(evt, val):
   global undo

   if (evt == ESCKEY and not val):
      name = "EXIT SCRIPT ?%t|YES %x1|NO %x2"
      result = Blender.Draw.PupMenu(name)
      if result == 1:
         Exit()
   if (evt== SPACEKEY and not val):
      function()
      Blender.Redraw()

   if (evt== XKEY and not val):
      for ob in undo:
         curscene.unlink(ob)
         curscene.update()
      undo = []
      Blender.Redraw()

#---------------------------------------
def bevent(evt):
   global undo

   if evt == 1:
      Exit()
   if evt == 2:
      function()
      Blender.Redraw()
   if evt == 3:
      Draw()
   if evt == 4:
      reset()
      Blender.Redraw()
   if (evt == 10):
      for ob in undo:
         curscene.unlink(ob)
         curscene.update()
      undo = []
      Blender.Redraw()
#
Register(gui, event, bevent) 

Better display.

snake olympics have started.

:slight_smile:

:slight_smile: Thank’s for the reactions and updates.
Soon i will come with a new version of my script,
with some funky new functions. :smiley: