FastNoise C# and Unity released

FastNoise C# GitHub

FastNoise is a C++ noise generation library I designed for real-time terrain generation. Since the library has reached all my feature and performance goals, I decided to convert and release a C# version.

Features

  • Value Noise 2D, 3D
  • Perlin Noise 2D, 3D
  • Simplex Noise 2D, 3D, 4D
  • Position Warping 2D, 3D
  • Multiple fractal options for all of the above
  • Cellular (Voronoi) Noise 2D, 3D
  • White Noise 2D, 3D, 4D
  • Noise Examples

FastNoise Unity Asset Store

Along with a pure C# version I wanted to create a Unity Asset featuring Unity editor integration and FastNoise SIMD support. FastNoise SIMD has a similar feature set to FastNoise but uses CPU intrinsic functions to process data in sets of 4/8, this gives around a 300-400% performance increase over FastNoise making it ideal for 3D terrain generation.

Features over pure C# version

  • Unity editor integration with live noise preview
  • Precompiled C++ libraries for FastNoise SIMD (Windows(32/64bit), Mac OSX(32/64bit), Linux(32/64bit))
  • C# interface to use FastNoise SIMD libraries
  • Voxel terrain engine
  • Help support continued development of these open source noise libraries

The voxel terrain engine included in the Unity asset is designed as a learning tool for people starting out with voxels in Unity, while being fairly simple it is well designed for expansion and has a heavy focus on optimisation.

Voxel Terrain Engine Demo Video

Unity Voxel Terrain Engine Features

  • Chunk management system
  • Infinite generation in all 3 axis
  • Multi-threaded terrain generation
  • Baked ambient occlusion
  • Naive surface meshing
  • Flexible classes allow easy customisation
  • 5 different terrain generators
  • Commented code to help people understand the workings of a voxel engine

unityss3

Let me know if you have any ideas or questions!

You may also like...

2 Responses

  1. Hi Jordan,
    I’ve just purchased the Unity FastNoise plugin, and am having difficulties getting going. I can implement the float[] noiseSet = myNoise.GetNoiseSet(0, 0, 0, 16, 16, 16); example from the documentation, within a c# script on an object with a mesh. This happily returns noise values.
    I cannot, however, find a way to use the VectorSet function. I want to pass in a Vector3[] array (of vertex points) and get a float[] array back of noise values (for the vertex 3D coords). I am trying:
    FastNoiseSIMD myVectorSet = new VectorSet(); …and variations including FastNoiseSIMD myVectorSet = new VectorSet(sphereVertices); …where ‘sphereVertices’ is a non-null Vector3[].
    But I am getting errors, such as; “The type or namespace name ‘VectorSet’ could not be found. Are you missing a using directive or an assembly reference?”
    I am obviously doing something basically wrong here. Could you give me a couple of pointers, or maybe an example that achieves what I am trying (including “using LibraryX” headers for the c# code)?

    • Hi Simon,
      You need to use new FastNoiseSIMD.VectorSet(Vector3[] vectors)
      Try to reuse vector sets as much as you can by using them with position offsets in GetNoise(), since there is some overhead to create them.
      Hope this helps.

Leave a Reply