Terrain from perlin noise grid pattern in shadows

Hi there!

I want to generate terrain and therefore created a Noise class, which returns me a noise-value based on Perlin-Noise. I’ve created a class Octave which (sort of) just represent the input for the Noise-Generator:
(EDIT: While asking this question I noticed that it should not be the Generation of the noise values but something else. I still appended the code for generation just in case I miss a point)

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using WorldGenerator;
    public class Octave {
        public Vector2 offset;
        public Vector2 scale;
        public Vector2 frequency;
        public float amplitude;
        public float influence;
        public Octave(WorldGenerator.Random random, Vector2 scale, Vector2 frequency, float amplitude, float influence) {
            this.offset = new Vector2(random.nextXInRange(-100000, 100000), random.nextYInRange(-100000, 100000));
            this.scale = scale;
            this.frequency = frequency;
            this.amplitude = amplitude;
            this.influence = influence;
    public static class Noise
        public static float GenerateNoise(float x, float y, Octave[] octaves) {
            float noiseValue = 0.0f;
            for(int i = 0; i < octaves.Length; i++) {
                noiseValue += GenerateNoise(x, y, octaves*);*

return noiseValue;

public static float GenerateNoise(float x, float y, Octave octave) {
Vector2 samplePos = new Vector2(x / octave.scale.x * octave.frequency.x, y / octave.scale.y * octave.frequency.y);
float perlinValue = (Mathf.PerlinNoise(samplePos.x + octave.offset.x, samplePos.y + octave.offset.y) * 2.0f) - 1;
return (perlinValue * (octave.amplitude * octave.influence));
Now in my world generation script I do The following:
In the start function: this.surfaceOctave = new Octave(this.random, new Vector2(this.scale, this.scale), new Vector2(this.noise, this.noise), worldHeight, 1.0f);
and my world has the function:
public float GetHeightAt(Vector2 pos) {

return Noise.GenerateNoise(pos.x, pos.y, this.surfaceOctave);

but when using that function when generating my mesh with the vertices: this.vertices[count] = new Vector3(pos.x, pos.y, World.instance.GetHeightAt(new Vector2(transform.position.x + pos.x, transform.position.y + pos.y)));
I get a strange behaviour…The shadows of my terrain throw in a grid like pattern:
but while making the pictures for this question I noticed that the values of the height should be fine:
As you see there are no jumps in height…I first thought there were when having higher scale values. But that might have happened because of the float precision.
Now my question is. This seems to be due to shadowing…Is there a way to fix this? And if it is not the shadowing. What could it be?

seems more of a shader - shadow bias issue. I doubt you’ll even notice this if drop a texture on it. How far zoomed are the images you show?