How would i go about detecting when a ravine is present? (please)

henlo, im trying to detect when a ravine is present, however i cant work out a logical, clean method (no im just joking i cant come up with a method at all lol) of detecting when a ravine is present. Here is my code:

local cx = (chunkX * CHUNK_SCALE) + x
            local cz = (chunkZ * CHUNK_SCALE) + z
            
            local noise1 = math.noise(GENERATION_SEED, cx / 270, cz / 270)
            local noise2 = math.noise(GENERATION_SEED * 2, cx / 25, cz / 25)
            local noise3 = math.noise(GENERATION_SEED * 2.1, cx / 75, cz / 75)
            local noise4 = math.noise(GENERATION_SEED * 2.2, cx / 5, cz / 5)
            local noise5 = math.noise(GENERATION_SEED * 2.3, cx / 75, cz / 75)
            
            local n1 = noise1 * 85
            local n2 = noise2 * 4
            local n3 = noise3 * 6
            local detail = -math.abs(noise4)

            local output = n1 + n2

			local ravine = math.clamp(math.clamp(noise5, 0, 1), 0.437, 0.446) * 200 * 48

            local y = -math.abs(output) + n3 - detail - ravine
			
			mountLayer(cx, y, cz, Enum.Material.Grass)

Thanks if you can help me come up with a way!

EDIT: I still need help with this, it is crucial

1 Like

What you would do is check if any noise levels are low (indicates spikes) if it is x close to player then it is.