Question : perlin noise unity
Answered by : mcdown
// HOW TO IMPLEMENT A PERLIN NOISE FONCTION TO GET A TERRAIN HEIGHT IN UNITY
using UnityEngine;
public static class NoiseCreator
{ /// scale : The scale of the "perlin noise" view /// heightMultiplier : The maximum height of the terrain /// octaves : Number of iterations (the more there is, the more detailed the terrain will be) /// persistance : The higher it is, the rougher the terrain will be (this value should be between 0 and 1 excluded) /// lacunarity : The higher it is, the more "feature" the terrain will have (should be strictly positive) public static float GetNoiseAt(int x, int z, float scale, float heightMultiplier, int octaves, float persistance, float lacunarity) { float PerlinValue = 0f; float amplitude = 1f; float frequency = 1f; for(int i = 0; i < octaves; i++) { // Get the perlin value at that octave and add it to the sum PerlinValue += Mathf.PerlinNoise(x * frequency, z * frequency) * amplitude; // Decrease the amplitude and the frequency amplitude *= persistance; frequency *= lacunarity; } // Return the noise value return PerlinValue * heightMultiplier; }
}
Source : | Last Update : Sat, 05 Dec 20
Question : 3d perlin noise unity
Answered by : munchduster
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;
}
Source : | Last Update : Sun, 20 Dec 20
Question : unity get perlin noise 3d
Answered by : chris-1z3rijh36ycu
public static float PerlinNoise3D(float x, float y, float z) { float xy = Mathf.PerlinNoise(x, y); float xz = Mathf.PerlinNoise(x, z); float yz = Mathf.PerlinNoise(y, z); float yx = Mathf.PerlinNoise(y, x); float zx = Mathf.PerlinNoise(z, x); float zy = Mathf.PerlinNoise(z, y); return (xy + xz + yz + yx + zx + zy) / 6; }
Source : https://stackoverflow.com/questions/69213448/whats-the-usage-of-get3dperlinnoise-function | Last Update : Thu, 23 Sep 21