Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local high = 8
- if !c then
- noise = {}
- for x=0,2^high+1 do
- noise[x] = {}
- for y=0,2^high+1 do
- noise[x][y] = math.random()
- end
- end
- c = true
- end
- local N = 0
- for i=1,high do
- local freq = 2^i
- local X = freq*x/ScrW()
- local X_i = math.floor(X)
- local X_f = X-X_i
- local Y = freq*y/ScrH()
- local Y_i = math.floor(Y)
- local Y_f = Y-Y_i
- local n0 = noise[X_i][Y_i]*(1-X_f)+noise[X_i+1][Y_i]*X_f
- local n1 = noise[X_i][Y_i+1]*(1-X_f)+noise[X_i+1][Y_i+1]*X_f
- N = N+n0*(1-Y_f)+n1*Y_f
- end
- N = N/high
- local d = math.sqrt((x/ScrW()-0.5)^2+(y/ScrH()-0.5)^2)
- N = math.pow(1-N*d,1.2)
- surface.SetDrawColor(N*255,255*N^2,255*N^3)
- surface.DrawRect(x,y,1,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement