I was going to explore the noise function, starting from @Simeon 's example. I first tried to replace the rectangles with meshes to speed up the program, and use higher resolutions. The problem is that some meshes are messed up, the x coordinate of one of the points is 0 when it hasn’t to be 0.

At first it seemed a random problem, but further exploration revealed that the broken meshes where not random, but 500, 1000, 2000, 4000. I haven’t looked further but there is a clear pattern.

I haven’t found any mistakes in the program, so I imagine there is some kind of error in the creation of rectangular meshes (I imagine they are just 2 adjacent triangular meshes).

http://www.youtube.com/watch?v=PO5Tx8HDoGI

```
supportedOrientations(LANDSCAPE_ANY)
tileSize = WIDTH/65
noiseScale = 1/5
noisePos = vec2(0,0)
noiseSpeed = 0.2
-- Use this function to perform your initial setup
function setup()
parameter("noiseScale", 1/30, 1, 1/5)
parameter("noiseSpeed", 0.05, 1, 0.2)
tiles = {}
for x = 1, WIDTH/tileSize do
tiles[x] = {}
for y = 1, HEIGHT/tileSize do
tiles[x][y] = noise(x * noiseScale, y * noiseScale)
end
end
end
function moveNoise()
for x,column in ipairs(tiles) do
for y,value in ipairs(column) do
tiles[x][y] = math.floor((noise(x * noiseScale + noisePos.x, y * noiseScale + noisePos.y) + 1)*127)
end
end
end
-- This function gets called once every frame
function draw()
background(231, 14, 14, 255)
noStroke()
noSmooth()
spriteMode(CORNER)
m = mesh()
t = image(1,1)
t:set(1,1,255,255,255)
m.texture = t
translate(tileSize/2,tileSize/2)
local counter = 0
for x,column in ipairs(tiles) do
for y,value in ipairs(column) do
local i = m:addRect((x-1)*tileSize, (y-1)*tileSize, tileSize-1, tileSize-1)
m:setRectColor(i, color(value,value,value,255))
end
end
m:draw()
m:clear()
noisePos = noisePos + vec2(0.5,0.3) * noiseSpeed
moveNoise()
end
```