psrdnoise Tiling Simplex Flow Noise

repository·main·Indexed 43 days ago

https://github.com/stegu/psrdnoise

High-performance, tiling simplex flow noise implementations for 2-D and 3-D, optimized for shaders. Provides ports for GLSL (compatible with GLSL 1.20/WebGL 1.0+), WGSL, and HLSL. Includes a 2-D variant compatible with mediump 16-bit float precision and self-contained HLSL implementations of Simplex, Classic, and Cellular noise that utilize ALU resources instead of texture lookup tables.

Tokens
1.1K
Snippets
3
Records
7
Agent score
56%

What's inside psrdnoise

  1. Overview of psrdnoise tiling simplex flow noise

    main

    psrdnoise provides implementations of tiling simplex flow noise in 2-D and 3-D. These implementations are designed to be compatible with GLSL 1.20 (WebGL 1.0) and above.

    Key features include:

    • Multi-language support: Includes GLSL (WebGL 1.0+), WGSL, and HLSL ports.
    • Precision variants: A 2-D noise variant is available that is compatible with mediump 16-bit float precision.
    • Scientific basis: The implementation is based on a scientific article published in the Journal of Computer Graphics Techniques (JCGT).

    For live WebGL examples and a tutorial, visit the accompanying GitHub Pages site.

  2. Overview of psrdnoise HLSL noise functions

    main

    The psrdnoise library provides self-contained HLSL implementations of various noise functions, including Simplex, Classic, and Cellular noise. Unlike many other implementations that rely on texture lookup tables (which can be texture bandwidth limited), these functions are completely self-contained with no dependency on external data.

    While they may not be as fast as texture-based implementations on typical desktop GPUs, they offer better scalability for massive parallelism and are more convenient to use because they utilize ALU resources rather than texture bandwidth, making them ideal for use alongside texture-intensive rendering tasks.

  3. Licensing and attribution for psrdnoise GLSL code

    main

    The code in this folder is released under the MIT license.

    For small snippets of GLSL code (e.g., in demos where space is limited), you may use a simplified attribution header instead of the full MIT license text. If you use the simplified version, you must still reference the MIT license by name and point to the original repository. You are permitted to remove other comments and edit the code for compactness, provided this minimal credit is maintained.

    Simplified attribution header:

    // psrdnoise (c) 2021 Stefan Gustavson and Ian McEwan
    // Published under the MIT license.
    // https://github.com/stegu/psrdnoise/
  4. Use the HLSL noise library in your shaders

    main

    This library provides HLSL ports of the webgl-noise library. The functions have been modified for HLSL compatibility, including the removal of redundant code and renaming of identifiers to prevent function redefinition errors when using #include.

    To include all available noise functions at once, you can use the provided convenience header: #include "noise-include-all.hlsl".

    Requirements:

    • You must use an HLSL compiler that supports macros.
    • If your compiler does not support macros, you must manually edit special-math.hlsl to convert the mod macro into explicit overloaded functions.
    #include "noise-include-all.hlsl"
  5. How to credit psrdnoise in your projects

    main

    The psrdnoise GLSL code is released under the MIT license. If you are using the code in a space-constrained environment (like a demo) and want to avoid the full license text, you may use a simplified header.

    When using the simplified version, you must:

    1. Include the minimal credit header provided below.
    2. Reference the MIT license by name.
    3. Provide a link to the original repository.

    You are permitted to remove other comments and edit the code for compactness, but this minimal credit must remain.

    // psrdnoise (c) 2021 Stefan Gustavson and Ian McEwan
    // Published under the MIT license.
    // https://github.com/stegu/psrdnoise/
  6. Available language ports for psrdnoise

    main

    The noise functions are available in several shading languages located within the src/ directory:

    • GLSL: Compatible with GLSL 1.20 (WebGL 1.0) and above.
    • WGSL: A port available in the src/ directory alongside the GLSL versions.
    • HLSL: Ports are located in the src/hlsl directory.

    Additionally, a Unity shader project using an HLSL port can be found at https://github.com/chmodseven/psrdnoise.

  7. License information for psrdnoise

    main

    The licensing for this repository is split:

    • Documentation: The entire content of the docs/ folder is in the public domain.
    • GLSL Shader Code: All GLSL code in the repository is published under the permissive MIT license.

    Copyright 2021 Stefan Gustavson and Ian McEwan.