Skip to content

Commit

Permalink
Added FastNoise library
Browse files Browse the repository at this point in the history
  • Loading branch information
BasmanovDaniil committed Jan 7, 2020
1 parent 76093c5 commit 9b8a0bf
Show file tree
Hide file tree
Showing 16 changed files with 3,445 additions and 4 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ There are several ways to install Procedural Toolkit:
The best way is to install this library as a [Git package](https://docs.unity3d.com/Manual/upm-git.html) using the Package Manager.
First, make sure that you to have Git installed and available in your system's PATH.
After that you need to add the following line to your project's `manifest.json`:
```JSON
```
"com.syomus.proceduraltoolkit": "https://github.com/Syomus/ProceduralToolkit.git",
```

It should look like this, notice the comma at the end of the line:
```JSON
```
{
"dependencies": {
"com.syomus.proceduraltoolkit": "https://github.com/Syomus/ProceduralToolkit.git",
Expand Down Expand Up @@ -155,6 +155,9 @@ Use [PathClipper](/Runtime/PathClipper.cs) and [PathOffsetter](/Runtime/PathOffs
The [LibTessDotNet](https://github.com/speps/LibTessDotNet) library.
The recommended use is through the wrapper class [Tessellator](/Runtime/Tessellator.cs).

### Runtime/FastNoiseLib/
The [FastNoise](https://github.com/Auburns/FastNoise_CSharp) library.

### Shaders/
Depending on the installation type, the shader library can be used like this:
```HLSL
Expand Down Expand Up @@ -278,6 +281,9 @@ An example showing the usage of Tesselator.
### StraightSkeleton
An StraightSkeletonGenerator example showing how you can generate a straight skeleton from a polygon and use the result.

### Noise
An example demonstrating various noise types.

### Samples~/Common
UI prefabs and the skybox material used in examples.
* SkyBoxGenerator: Skybox generator, assuming that scene uses gradient skybox shader, animates transitions to new parameters every few seconds.
Expand Down
8 changes: 8 additions & 0 deletions Runtime/FastNoiseLib.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,371 changes: 2,371 additions & 0 deletions Runtime/FastNoiseLib/FastNoise.cs

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Runtime/FastNoiseLib/FastNoise.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions Runtime/FastNoiseLib/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016 Jordan Peck

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 7 additions & 0 deletions Runtime/FastNoiseLib/LICENSE.txt.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Runtime/FastNoiseLib/ProceduralToolkit.FastNoiseLib.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "ProceduralToolkit.FastNoiseLib",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": []
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions Runtime/FastNoiseLib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# FastNoise

This is the C# version of [FastNoise](https://github.com/Auburns/FastNoise)

FastNoise is an open source noise generation library with a large collection of different noise algorithms. This library has been designed for realtime usage from the ground up, so has been optimised for speed without sacrificing noise quality.

This project started when my search to find a good noise library for procedural terrain generation concluded without an obvious choice. I enjoyed the options and customisation of Accidental Noise Library and the speed of LibNoise, so many of the techniques from these libraries and the knowledge I gained from reading through their source has gone into creating FastNoise.

I have now also created [FastNoise SIMD](https://github.com/Auburns/FastNoiseSIMD), which utilises SIMD CPU instructions to gain huge performance boosts. It is slightly less flexible and cannot be converted to other languages, but if you can I would highly suggest using this for heavy noise generation loads.

### Features
- Value Noise 2D, 3D
- Perlin Noise 2D, 3D
- Simplex Noise 2D, 3D, 4D
- Cubic Noise 2D, 3D
- Gradient Perturb 2D, 3D
- Multiple fractal options for all of the above
- Cellular (Voronoi) Noise 2D, 3D
- White Noise 2D, 3D, 4D
- Supports floats or doubles

### Wiki
Usage and documentation available in wiki

[Wiki Link](https://github.com/Auburns/FastNoise/wiki)

### Related repositories
- [FastNoise Java](https://github.com/Auburns/FastNoise_Java)
- [FastNoise SIMD](https://github.com/Auburns/FastNoiseSIMD)
- [FastNoise Unity](https://www.assetstore.unity3d.com/en/#!/content/70706)
- [Unreal FastNoise](https://github.com/midgen/UnrealFastNoise)

Credit to [CubicNoise](https://github.com/jobtalle/CubicNoise) for the cubic noise algorithm

## FastNoise Preview

I have written a compact testing application for all the features included in FastNoise with a visual representation. I use this for development purposes and testing noise settings used in terrain generation.

Download links can be found in the [Releases Section](https://github.com/Auburns/FastNoise/releases).

![FastNoise Preview](http://i.imgur.com/uG7Vepc.png)


# Performance Comparisons
Benchmarking done on C++ version.

Using default noise settings on FastNoise and matching those settings across the other libraries where possible.

Timings below are x1000 ns to generate 32x32x32 points of noise on a single thread.

- CPU: Intel Xeon Skylake @ 2.0Ghz
- Compiler: Intel 17.0 x64

| Noise Type |FastNoise | FastNoiseSIMD AVX2 | LibNoise | FastNoise 2D |
|-------------|----------|--------------------|-----------|--------------|
| White Noise |141 | 13 | | 111 |
| Value |635 | 160 | | 364 |
| Perlin |964 | 342 | 1409 | 476 |
| Simplex |1189 | 340 | | 875 |
| Cellular |2933 | 1472 | 56960 | 1074 |
| Cubic |2933 | 1393 | | 872 |

Comparision of fractal performance [here](https://github.com/Auburns/FastNoiseSIMD/wiki/In-depth-SIMD-level).

# Examples
## Cellular Noise
![Cellular Noise](http://i.imgur.com/quAic8M.png)

![Cellular Noise](http://i.imgur.com/gAd9Y2t.png)

![Cellular Noise](http://i.imgur.com/7kJd4fA.png)

## Fractal Noise
![Fractal Noise](http://i.imgur.com/XqSD7eR.png)

## Value Noise
![Value Noise](http://i.imgur.com/X2lbFZR.png)

## White Noise
![White Noise](http://i.imgur.com/QIlYvyQ.png)

## Gradient Perturb
![Gradient Perturb](http://i.imgur.com/gOjc1u1.png)

![Gradient Perturb](http://i.imgur.com/ui045Bk.png)

![Gradient Perturb](http://i.imgur.com/JICFypT.png)

# Any suggestions or questions welcome
7 changes: 7 additions & 0 deletions Runtime/FastNoiseLib/README.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Samples~/Noise.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9b8a0bf

Please sign in to comment.