Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Generating a seamless texture with noise

edited March 2012 in Questions Posts: 196

Hey there,

I would like to generate a tileable texture with the built-in noise function.
Anyone know if it is possible to "tile" the noise so that no seams are visible, some magic factor maybe ?

I looked up some stuff but I cannot make anything convincing out of it using the built-in function :(





  • Posts: 622

    You could use noise on a sprite and scale it up.

    function setup()     i = image(2,2)     for x = 1, 2 do         for y = 1, 2 do             i:set(x,y,math.random(255),math.random(255),math.random(255),255)         end     end end function draw()     background(40, 40, 50)     scale(300)     sprite(i,1,1) end

    I didn't use noise and scaled it up a ridiculous amount.

  • edited March 2012 Posts: 196

    @Ipad41001 - that's very smart, and it will do fine for now :D

    Thanks a lot,


  • Posts: 65

    Have you tried a power-of-two sized array/image? I read somewhere that that's supposed to make the resulting perlin noise seamlessly tileable.

  • SimeonSimeon Admin Mod
    edited March 2012 Posts: 4,888

    Not seamless, but it will make the texture repeat when the texture coordinates exceed 1 or are less than 0. For example:

     (0,5) -------------- (5,5)
       |                     |
       |                     |
       |                     |
       |                     |
       |                     |
       |                     |
       |                     |
     (0,0) -------------- (5,0)

    A rectangle with the above texture coordinates (on a mesh), using a power-of-two texture, will repeat 5 times. A non-power-of-two texture will not repeat and will instead clamp the border's pixel colours.

  • Posts: 159

    @Xavier Not quite what you're after, but the 'draw a road' code I posted the other day generates a noisy texture, and could perhaps be repurposed and tiled using the technique @Simeon suggested.

Sign In or Register to comment.