Git Product home page Git Product logo

cloudnoisegen's Introduction

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).
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).

cloudnoisegen's People

Contributors

fewes avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.