Unity Mathmatics Noise Samples by Steven9Smith - 2

Games & ProjectsProcedural

A Demo Scene that should help you better understand the noise functions in Unity Mathematics

Unknown VersionOtherUpdated 1 day agoCreated on June 29th, 2020
Go to source

Unity-Mathmatics-Noise-Samples

This Demo Project was made to help create a visual aid on the Unity.Mathmatics noise functions in the Unity.Mathmatics package.

Users can modify various attributes to change the out of various noise functions.

Currently 3D and 4D methods are not visualized but are planned for a future release.

for more information on noise functions and how to use them take a look at this pdf.

http://weber.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf

Unity Mathmatics Noise page

https://github.com/Unity-Technologies/Unity.Mathematics/tree/master/src/Unity.Mathematics/Noise

With the source of the functions here:

https://github.com/stegu/webgl-noise

Here are some cool images i made, I plan on making a video in the future on how to use it.

TestImage

Tutorial:

Before I go over let’s go over some things.

This current version only supports 2D visual interpertation meaning the results are displayed on a Quad as a 2D Texture however the noise functions them selves go from 2D to 4D (please look at the pdf for more informatino on dimensions).

Tutorial_Image01

The Texture uses the width and height choosen by the user and is passed to all noise functions. The length and depth are placeholder names for 3D and 4D noise functions inputs and are passed to the noise functions. Note: width,height,length,and depth are all for loops so with length and depth be careful on how big you numbers are because it will affect performace.

Tutorial_Image02

The NoiseType is the type of noise you would like to see. Use the dropdown menu to select the one you want.

Tutorial_Image03

Some NoiseTypes require additional parameters like a rotation value of gradient. You can modify these in the Gradients and Rotation Section

Tutorial_Image04

The Scale attribute is used as a zoom in feature (panning not availible yet) for the resulting noise function. These is a checkbox that allows you to set the max Gradient and Rotation" values. (Usually when the Gradient and Rotation value surpasses the scale value, no visible change occurs). When this value is unchecked you can set the Gradient and Rotation’s min and max values.

Tutorial_Image05

Value Interpertation referes to how the return value of a noise function is interperted as on the 2D texture. Noise functions can return a float, float2, or float3. The Value Interpertation allows you to choose how to represent the return values in rgb format. Note: you cannot have multiple return values represent an r,g, or b value at the same time. (Value Interperation X Y Z will be later changed to R G B respectivly)

Tutorial_Image06

You can also Save, Load, and Export the noise images and/or values! Saving a noise profile is easy.

All you have to do is write the filename and hit Save Noise Profile.

This will save the noise profile in a .dat file (check the SaveNoiseDataClass for more information) in your Application.persistantDataPath Directory under the corresponding NoiseType folder.

e.g.: (Application.persistantDataPath)\Perlin Noise\PerlinTest01.dat

Tutorial_Image07

If you hit the checkbox named Save As Height Map and then hit Save Noise Profile then it will save the map in the corresponding NoiseType folder under “HeightMaps”. e.g.: (Application.persistantDataPath)\Perlin Noise\HeightMaps\PerlinHeightMap.map Note: the file is just a serialized float[][] (check the code on how to read the files in a script). Also be aware that the color of the converted image is assumed to be black and white and thus grabs only values from the x axis and remaps the values to 0-1, from 0-255.

Tutorial_Image08

Hitting the “Export Noise Profile” Button will create a folder, using the given filename as the name, in the corresponding NoiseType folder and then store a heightmap, NoiseProfile data, and png of the noise in that folder.

Tutorial_Image09

The Load section uses the given filepath and attempts to load the data from it and display the results on the Quad as a texture. this functionally is limited only to the .dat and .map files created by the “Save Noise Profile” and “Export Noise Profile” file outputs.

Tutorial_Image10

That’s it with the tutorial for now.

Enjoy!

Show all projects by Steven9Smith