Unity-Technologies / Unity.Mathematics

The C# math library used in Unity providing vector types and math functions with a shader like syntax
Other
1.38k stars 156 forks source link

Use Noise for Voxel Generation? #207

Open superfrantv opened 2 years ago

superfrantv commented 2 years ago

``Hi, iam currently have no plan how to use the snoise function for my voxels.

`int x = i / (renderDistance renderDistance); int y = (i - x renderDistance renderDistance) / renderDistance; int z = i - x renderDistance renderDistance - y renderDistance;

        float noise = Unity.Mathematics.noise.snoise(new float3(y, x, z)) * scale;

        if (y < noise) {
            part.solid = true;`

something like that will be. A flatten 3 dimensional array with all positions, then calculate noise on that positions and scale it a bit. next is the problem. How to check if Position at specifig Height should be solid or not?

Thank you