PDA

View Full Version : Perlin noise (just for fun)


Mug Funky
26th October 2006, 06:45
function perlin (clip c, int "iterations", int "scale", float "weight", float "contrast")
{

function iterate (clip c, int scale, int count, float weight)
{
mt_lutxy(c,c.bilinearresize(c.width,c.height,0,0,c.width/2,c.height/2),expr="x 1 "+string(weight)+" - * y "+string(weight)+" * +")
count==0? last : iterate(scale,count-1,weight)
}

weight=default(weight,.5)
scale=default(scale,10)
iterations=default(iterations,scale)
contrast=default(contrast,10.)
blankclip(c,length=1,color_yuv=$808080,pixel_type="yv12").addgrain(512,.0,.0).mt_lut(expr="x 128 - "+string(contrast)+" * 128 +",y=3,u=2,v=2)

iterations == iterations <= scale ? iterations : scale

iterate(scale,iterations,weight)
bicubicresize(c.width,c.height,1,0,0,0,c.width/pow(2,scale-iterations),c.height/pow(2,scale-iterations))

loop(c.framecount)

}

usage:

anysource("blahblah.d2v")

perlin(int iterations, int scale, float contrast, float weight)

requires Addgrain

Pookie
27th October 2006, 05:52
Hee hee! Nice for DVD menu backgrounds....