Fernando Rodrigues
Fernando Rodrigues

Reputation: 93

Replacing Mathf.PerlinNoise in Unity

I was following some tutorials on Youtube trying to make my own voxel engine. The problem is, all tutorials I found uses Mathf.PerlinNoise(float x, float z) as the main method from get the noises. So, I have a problem with it, that is simmetry. If x or z are negative, it acts like being positive, and this happen.Simmetric noise

In other hand, using FastNoiseLite, I ever get a full yellow screen.

The code used to generate the noises are:

    public GSC_Noise(int seed)
    {
        Random.InitState(seed);
        gNoise = new FastNoiseLite(seed);
    }


    //From B3AGZ tutorial.
    //GSC_BlockHelper.ChunkSize is a static readonly Vector3Int
    public float Get2DNoise(int x, int z, int offset, float scale)
      => Mathf.PerlinNoise((x + 0.5f) / GSC_BlockHelper.ChunkSize.x * scale + offset,
                           (z + 0.5f) / GSC_BlockHelper.ChunkSize.z * scale + offset);

    public float Get2DNoiseFast(int x, int z, int offset, float scale)
        => gNoise.GetNoise((x + 0.5f) / GSC_BlockHelper.ChunkSize.x * scale + offset,
                           (z + 0.5f) / GSC_BlockHelper.ChunkSize.z * scale + offset);

Since FastNoiseLite returns in -1~1 range, against the 0~1 range from Mathf.PerlinNoise, that can be useful in some calculations, I asking for help to know how to set it properly, or other options that don´t cause simmetry on final result;

I am trying to generate a pseudo-random texture based in Perlin Noise. Basically to make randomic continents, like a randomic planet. Other calculations for heights, biomes, etc...

Upvotes: 2

Views: 445

Answers (1)

Fernando Rodrigues
Fernando Rodrigues

Reputation: 93

As pixlHero suggests in comment, I use two noises interpolated and the results are:enter image description here

So, for others with same doubt, I let the this question for help them.

Upvotes: 2

Related Questions