Skip to content

Instantly share code, notes, and snippets.

View Cruxial0's full-sized avatar

Cruxial Cruxial0

  • Norway
  • 09:20 (UTC +02:00)
View GitHub Profile
@tntmeijs
tntmeijs / unitythreedimensionalperlinnoise.cs
Last active October 4, 2024 20:23
A 3D implementation using the 2D Perlin noise function of Unity3D.
public static float Noise3D(float x, float y, float z, float frequency, float amplitude, float persistence, int octave, int seed)
{
float noise = 0.0f;
for (int i = 0; i < octave; ++i)
{
// Get all permutations of noise for each individual axis
float noiseXY = Mathf.PerlinNoise(x * frequency + seed, y * frequency + seed) * amplitude;
float noiseXZ = Mathf.PerlinNoise(x * frequency + seed, z * frequency + seed) * amplitude;
float noiseYZ = Mathf.PerlinNoise(y * frequency + seed, z * frequency + seed) * amplitude;