generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Yay, I finally made some perlin noise here!

Previous Thread :: Next Thread 
loleris is online. 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 is online. 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 is not online. 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 is online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image