3d perlin noise code example
Example: 3d perlin noise unity
public static float Perlin3D(float x, float y, float z, float density, float scale){
float XY = Mathf.PerlinNoise(x, y);
float YZ = Mathf.PerlinNoise(y, z);
float ZX = Mathf.PerlinNoise(z, x);
float YX = Mathf.PerlinNoise(y, z);
float ZY = Mathf.PerlinNoise(z, y);
float XZ = Mathf.PerlinNoise(x, z);
float val = (XY + YZ + ZX + YX + ZY + XZ)/6f;
return val * scale;
}