1 Reply
      Latest reply on Sep 29, 2019 6:31 PM by bb01
      Skyn3t Level 1 Level 1 (0 points)

        I wrote a small playground to play around with noise generation. It is attached below.

         

        When I undestand the system correctly, GKNoise contains a 3D environment based on the chosen GKNoiseSource.

        Therefore GKNoise contains transforming functions to move, rotate and scale the environment.

         

        But no matter what I insert in .scale(by:) or .rotate(by:), the output doesn't change. .move(by:) works though.

        I tried with different NoiseSources, but the result is the same.

         

        Is this a bug or am I doing something wrong?

         

        import PlaygroundSupport
        import SpriteKit
        import GameplayKit
        
        let billow = GKBillowNoiseSource()
        billow.frequency = 4.0
        billow.octaveCount = 15
        billow.persistence = 0.5
        billow.lacunarity = 2.0
        
        let cylinder = GKCylindersNoiseSource()
        cylinder.frequency = 2
        
        let perlin = GKPerlinNoiseSource()
        perlin.frequency = 4.0
        perlin.octaveCount = 15
        perlin.persistence = 0.5
        perlin.lacunarity = 2.0
        
        let checkerboard = GKCheckerboardNoiseSource(squareSize: 0.1)
        
        let noise = GKNoise(checkerboard)
        
        noise.rotate(by: vector_double3(0, .pi/3, .pi/3))
        noise.move(by: vector_double3(0,0.5,0))
        noise.scale(by: vector_double3(0.5,0.5,0.5))
        
        let sampleCount = vector_int2(200, 200)
        let noiseMap = GKNoiseMap(noise, size: vector_double2(1, 1), origin: .zero, sampleCount: sampleCount, seamless: true)
        
        let spriteNode = SKSpriteNode(texture: SKTexture(noiseMap: noiseMap), color: .white, size: CGSize(width: 500, height: 500))
        
        • Re: GKNoise.rotate(by:) & .scale(by:) don't do anything.
          bb01 Level 1 Level 1 (0 points)

          Hi,

          Did you end up finding a solution to this issue of the geometric transforms of the noise field not taking effect (except for move(by:))?

          I'm seeing the same behaviour, tested across playgrounds, a compiled app, and both iOS and macOS and wondered if you'd managed to learn any more about it? Coincidentally I was testing almost the exact same way as you were (basically I'm only trying to rotate checkerboard noise, which otherwise renders fine but simply with no rotation).

          I have noticed that the applyTurbulence() method and the displaceWithNoises() method don't seem to do anything either, even on the simplest noise system setups. It seems like .move(by:) is the only thing that works!

           

          Anyway, let me know if you'd managed to find a solution or a workaround? Or maybe it really is a bug!

           

          Thanks