loleris
|
  |
| Joined: 23 Feb 2009 |
| Total Posts: 1610 |
|
|
| 29 May 2013 07:17 AM |
Some of you may know how to generate Perlin noise the better way...
Anyways, this function generates a 100 x 100 perlin noise as a GUI picture. "OUTPUT_FRAME" is a GUI Frame object. It's a little laggy, but gets the job done.
OUTPUT_FRAME = script.Parent.Output octave_count = 55
perlin = {} for i = 1, 100 do perlin[i] = {} for a = 1, 100 do perlin[i][a] = 0 end end function AddOctave(trans, size) local rl_sz = math.ceil(100 / size) for x = 1, rl_sz do for y = 1, rl_sz do local dat_color = math.random(0, 1) for x2 = 1, size do for y2 = 1, size do local tx = ((x-1) * size)+x2 local ty = ((y-1) * size)+y2 if tx <= 100 and ty <= 100 then perlin[tx][ty] = perlin[tx][ty] + (trans * dat_color) end end end end end end
for e = octave_count,1,-1 do AddOctave(1/octave_count, e) end
OUTPUT_FRAME:ClearAllChildren() for i = 0,99 do for a = 0,99 do local pix_col = perlin[i+1][a+1] local newp = Instance.new("Frame") newp.BorderSizePixel = 0 newp.Size = UDim2.new(0, 1, 0, 1) newp.BackgroundColor3 = Color3.new(pix_col, pix_col, pix_col) newp.Position = UDim2.new(0, i, 0, a) newp.Parent = OUTPUT_FRAME end if math.floor(i / 5) == i / 5 then wait() end end
|
|
|
| Report Abuse |
|
|
loleris
|
  |
| Joined: 23 Feb 2009 |
| Total Posts: 1610 |
|
|
| 29 May 2013 07:25 AM |
| And again, it's slow - I've just crashed my PC by trying to generate a 300 x 300 picture... |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 29 May 2013 07:46 AM |
| Off-topic, but I have been wondering where were you gone before? Like I still remember your Mad wars 2 game, but after that you disappeared. Well now you are back. |
|
|
| Report Abuse |
|
|
loleris
|
  |
| Joined: 23 Feb 2009 |
| Total Posts: 1610 |
|
|
| 29 May 2013 07:49 AM |
@zars15
I was allways around. I only sometimes jumped off to program some Java, some other stuff. |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 29 May 2013 08:02 AM |
| Well I haven't seen you around these forums. Only recently noticed. |
|
|
| Report Abuse |
|
|
RaidenJPN
|
  |
| Joined: 22 May 2013 |
| Total Posts: 6920 |
|
|
| 29 May 2013 08:02 AM |
| I have not seen loleris since before zins got terminated. |
|
|
| Report Abuse |
|
|
Aerideyn
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 1882 |
|
|
| 29 May 2013 08:36 AM |
| You can find Simplex noise complete with fractal brownian motion under my stuff :3 |
|
|
| Report Abuse |
|
|