• Stars
    star
    127
  • Rank 282,790 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 6 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A static utility class for Unity which handles generating and loading periodic, cloud-like (perlin-worley) 3D noise textures on the GPU.

CloudNoiseGen

Perlin-Worley noise

A static utility class for Unity which handles generating and loading periodic, cloud-like (perlin-worley) 3D noise textures for use with volumetric shaders. The noise is generated on the GPU, and so it is very fast.

Usage

Use the perlin and worley variables to set the amount of octaves, periods, brightness and contrast of the Perlin and Worley noise respectively.
Use the InitializeNoise function to load/generate noise.
The generated noise is stored in Assets/Resources/CloudNoiseGen/folderName as 2D textures (one for each z-slice).
If the folder already exists and contains noise with the same resolution, it will be loaded instead of generated (unless you set the mode parameter to ForceGenerate). If the folder already exists but the resolution does not match, it will be discarded and new noise will be generated.
When generating noise, the asset database is refreshed upon completion. This takes a few seconds. When generating noise for the first time, texture import settings need to be set. This takes a bit longer but only needs to be done once. The actual noise generation is near-instant depending on your GPU.

If you wish to display a preview of the noise before generating the textures, use the GetSlice function.
If you don't want to use the automatic handling of loading/generating the noise textures, you can use the LoadNoise and GenerateNoise functions instead of InitializeNoise.

Limitations

Generating new noise is limited to the editor.
Generated noise must be stored in the resources folder (so it can be loaded from script in built player).
If the folder containing the noise textures contains any other files, it will not be loaded (additionally, the generator will discard the entire folder and create a new one).
If you want to modify the way the perlin/worley noise is blended together, you need to modify the CloudNoiseGen shader.
Changing the texture import settings of the generated z slices is recommended against.

Credits

Perlin Noise
Noise Shader Library for Unity - https://github.com/keijiro/NoiseShader
Original work (webgl-noise) Copyright (C) 2011 Stefan Gustavson
Translation and modification was made by Keijiro Takahashi

Worley Noise
Worley noise implementation for WebGL shaders - https://github.com/Erkaman/glsl-worley
Original work (GLSL-cellular-noise) Copyright (C) 2011 Stefan Gustavson
Translation and modification was made by Eric Arnebรคck
Periodic modification was made by Felix Westin

All source code is distributed under the MIT license (See CloudNoiseLib.cginc for full details).

More Repositories

1

BNAO

A tiny, GPU-based Bent Normal and Ambient Occlusion baker for Unity.
C#
529
star
2

MinimalAtmosphere

A minimal atmospheric scattering implementation for Unity
C#
459
star
3

BakerBoy

A single-component, GPU-based universal ambient occlusion and bent normal baker for Unity. The successor to my BNAO respository
HLSL
302
star
4

MeshDecal

A simple mesh decal component for Unity
C#
210
star
5

TerrainPrettifier

A small GPU-based component designed to aid in cleaning and refining satellite/DEM based terrains directly inside Unity.
C#
185
star
6

VolumetricTracer

A simple way to render soft, volumetric bullet tracers in Unity. Only needs a unit cube and a material to render and supports instancing.
ShaderLab
117
star
7

CapsuleOcclusion

Unity package implementing clustered capsule/character occlusion
C#
92
star
8

VertexColorBaker

A tiny vertex color baker for Unity that runs on the GPU, implemented as an AssetPostprocessor
C#
86
star
9

SDFGI

A Monte Carlo path tracer implemented on the GPU in Unity, using Signed Distance Fields.
C#
77
star
10

Celery

Mask
24
star
11

SphericalHarmonicsDev

ShaderLab
10
star
12

SphericalHarmonics

HLSL
9
star
13

TNM084_Lab3

A procedural lava ball in Unity
C#
5
star
14

BasicPlayerMovement

A super simple Unity demo featuring two ways of doing basic player and camera movement.
C#
5
star
15

AtomicSurfer

A super-rad surfing/shark shooter simulator.
C#
4
star
16

TextureProcessor

Static utility class for processing texture on the GPU.
C#
4
star
17

InfinitePain

A RougLike FPS created during a game jam
C#
4
star
18

LiTHeLan_Final

C#
3
star
19

LudumDare38

C#
2
star
20

iMat

Java
1
star
21

MoS

C#
1
star