//Spline stuff public static void AddSplineSegment(Vector3 pos, float holeOffsetRadius) { SplineLine.Add(new Spline { pos = pos, radius = 10 }); //Hole! float x = (Perlin3D.PerlinNoise3D(pos + Vector3.up) - 0.5f) * 2 * holeOffsetRadius; float y = (Perlin3D.PerlinNoise3D(pos + Vector3.right) - 0.5f) * 2 * holeOffsetRadius; float z = (Perlin3D.PerlinNoise3D(pos + Vector3.forward) - 0.5f) * 2 * holeOffsetRadius; Vector3 off = new Vector3(x, y, z); SplineHole.Add(new Spline { pos = pos + off, radius = 5f }); }
public void makeSpline(int segmentCount, float sporadicFactor, float noiseScale) { Perlin3D.scale = noiseScale; Vector3 direction = Vector3.right; Vector3 currentPos = Vector3.one * Random.Range(40, 9999); for (int i = 0; i < segmentCount; i++) { float x = 0.1f; float y = Perlin3D.PerlinNoise3D(currentPos + Vector3.up) - 0.5f; float z = Perlin3D.PerlinNoise3D(currentPos + Vector3.forward) - 0.5f; direction = Vector3.Slerp(direction, new Vector3(x, y, z).normalized, sporadicFactor); currentPos += direction.normalized * 20f; SplineNoise3D.AddSplineSegment(currentPos, 10f); } }
public float SuperNoise(Vector3 point) { //distance along spline X float dist = SplineNoise3D.HoleNoise(point) / _HoleSize; if (dist > 1f) { dist = 1f; } Perlin3D.scale = _InternalCaveNoise; float caveWalls = SplineNoise3D.SplineNoise(point) + Perlin3D.PerlinNoise3D(point) * _CaveWallAmount; if (caveWalls < 6f) { caveWalls = 0f; } return((caveWalls + Perlin3D.PerlinNoise3D(point) * _InternalCaveAmount) * dist); }