[SOLVED] Flat noise torus

Discussion in 'Programming' started by Gzebra, Mar 15, 2019.

  1. Gzebra

    Gzebra Member

    Joined:
    Aug 3, 2017
    Posts:
    38
    So..

    I'm trying to create a noise map in the shape of a flat torus, like this:

    [​IMG]

    But I believe I'm having some difficulties with the fact that a 3 dimensional torus doesn't have a consistent curvature.

    [​IMG]

    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? :/
     
  2. Gzebra

    Gzebra Member

    Joined:
    Aug 3, 2017
    Posts:
    38
    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)
        }
    }
    
     
    Last edited: Mar 15, 2019

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice