0 Replies
      Latest reply on Apr 21, 2019 2:00 PM by Skyn3t
      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))