So.. I'm trying to create a noise map in the shape of a flat torus, like this: But I believe I'm having some difficulties with the fact that a 3 dimensional torus doesn't have a consistent curvature. I've tried to counter the warp by scaling the noise, but I've been unable to come up with a equation that doesn't increase the circumference of the torus in the process, leaving the warp still remaining. Looping the noise function across a single axis turns out perfectly fine, that is making a cylinder instead of a torus , but how does one go about looping a noise function in 2 axis? :/

Solved using a 4th dimension. Code: var pi2=pi*2 var r=noiseSize/pi2 for(var w=0; w<noiseSize; w++){ for(var h=0; h<noiseSize; h++){ var a=r+r*cos(pi2*h/noiseSize) var b=r+r*cos(pi2*w/noiseSize) var c=r+r*sin(pi2*w/noiseSize) var d=r+r*sin(pi2*h/noiseSize) noiseGrid[w,h]=simplex_calculate_4d(a,b,c,d,noiseMin,noiseMax,noiseOctaves,noisePersistence,noiseScale) } }