Class NoiseUtils | Terrain Tools | 3.0.2-preview.3
docs.unity3d.com
    Show / Hide Table of Contents

    Class NoiseUtils

    A utility class for rendering noise defined by NoiseSettings into various Texture types.

    Inheritance
    Object
    NoiseUtils
    Namespace: UnityEditor.Experimental.TerrainAPI
    Syntax
    public static class NoiseUtils

    Fields

    kNumBlitPasses

    Number of passes that the builtin noise blit shader contains. The passes include one for blitting 2D noise and one for blitting 3D noise.

    Declaration
    public static readonly int kNumBlitPasses
    Field Value
    Type Description
    Int32

    Properties

    previewFormat

    Format to use when rendering a preview of a Noise field into a RenderTexture with NoiseUtils.BlitPreview functions

    Declaration
    public static GraphicsFormat previewFormat { get; }
    Property Value
    Type Description
    GraphicsFormat

    singleChannelFormat

    Format to use when rendering a Noise field into a single channel RenderTexture

    Declaration
    public static GraphicsFormat singleChannelFormat { get; }
    Property Value
    Type Description
    GraphicsFormat

    Methods

    BakeToTexture2D(NoiseSettings, Int32, Int32, GraphicsFormat, TextureCreationFlags)

    Bakes 2D noise defined by the given NoiseSettings instance into a Texture2D instance and returns a reference to it.

    Declaration
    public static Texture2D BakeToTexture2D(NoiseSettings noise, int width, int height, GraphicsFormat format = GraphicsFormat.R16_UNorm, TextureCreationFlags flags = TextureCreationFlags.None)
    Parameters
    Type Name Description
    NoiseSettings noise

    An instance of NoiseSettings defining the type of noise to bake

    Int32 width

    The width of the baked Texture2D

    Int32 height

    The height of the baked Texture2D

    GraphicsFormat format

    The GraphicsFormat for the baked Texture2D. In most cases, you will want to use GraphicsFormat.R16_UNorm

    UnityEngine.Experimental.Rendering.TextureCreationFlags flags

    TextureCreation flags for the baked Texture2D

    Returns
    Type Description
    Texture2D

    A reference to the baked Texture2D instance

    BakeToTexture3D(NoiseSettings, Int32, Int32, Int32, GraphicsFormat, TextureCreationFlags)

    Bakes 3D noise defined by the given NoiseSettings instance into a Texture3D instance and returns a reference to it.

    Declaration
    public static Texture3D BakeToTexture3D(NoiseSettings noise, int width, int height, int depth, GraphicsFormat format = GraphicsFormat.R16_UNorm, TextureCreationFlags flags = TextureCreationFlags.None)
    Parameters
    Type Name Description
    NoiseSettings noise

    An instance of NoiseSettings defining the type of noise to bake

    Int32 width

    The width of the baked Texture3D

    Int32 height

    The height of the baked Texture3D

    Int32 depth

    The depth of the baked Texture3D

    GraphicsFormat format

    The GraphicsFormat for the baked Texture3D. In most cases, you will want to use GraphicsFormat.R16_UNorm

    UnityEngine.Experimental.Rendering.TextureCreationFlags flags

    TextureCreation flags for the baked Texture3D.

    Returns
    Type Description
    Texture3D

    A reference to the baked Texture3D instance

    Remarks

    Be careful when specifying TextureCreation flags. If you specify that mipmaps should be generated for a Texture3D, that will use a lot more memory than if you were generating mipmaps for a Texture2D.

    Blit2D(NoiseSettings, RenderTexture)

    Blits 2D noise defined by the given NoiseSettings instance into the destination RenderTexture.

    Declaration
    public static void Blit2D(NoiseSettings noise, RenderTexture dest)
    Parameters
    Type Name Description
    NoiseSettings noise

    An instance of NoiseSettings defining the type of noise to render

    RenderTexture dest

    The destination RenderTexture that the noise will be rendered into.

    Blit2D(NoiseSettings, RenderTexture, Material)

    Blits 2D noise defined by the given NoiseSettings instance into the destination RenderTexture using the provided Material.

    Declaration
    public static void Blit2D(NoiseSettings noise, RenderTexture dest, Material mat)
    Parameters
    Type Name Description
    NoiseSettings noise

    An instance of NoiseSettings defining the type of noise to render

    RenderTexture dest

    The destination RenderTexture that the noise will be rendered into.

    Material mat

    The Material to be used for rendering the noise

    Blit3D(NoiseSettings, RenderTexture)

    Blits 3D noise defined by the given NoiseSettings instance into the destination RenderTexture.

    Declaration
    public static void Blit3D(NoiseSettings noise, RenderTexture dest)
    Parameters
    Type Name Description
    NoiseSettings noise

    An instance of NoiseSettings defining the type of noise to render

    RenderTexture dest

    The destination RenderTexture that the noise will be rendered into.

    BlitPreview2D(RenderTexture, RenderTexture)

    Blits the source RenderTexture into the destination RenderTexture using the default Preview Blit Material. This is the blit Material that is used when rendering the NoiseSettings Preview.

    Declaration
    public static void BlitPreview2D(RenderTexture source, RenderTexture destination)
    Parameters
    Type Name Description
    RenderTexture source

    The source RenderTexture used in the Blit operation

    RenderTexture destination

    The destination RenderTexture in the Blit operation This will have the noise preview shader logic applied to it.

    BlitPreview2D(RenderTexture, RenderTexture, Material)

    Blits the source RenderTexture into the destination RenderTexture using the specified Material.

    Declaration
    public static void BlitPreview2D(RenderTexture src, RenderTexture dest, Material mat)
    Parameters
    Type Name Description
    RenderTexture src
    RenderTexture dest
    Material mat

    The material to be used in the blit operation

    GetDefaultBlitMaterial(Type)

    Declaration
    public static Material GetDefaultBlitMaterial(Type fractalType)
    Parameters
    Type Name Description
    Type fractalType
    Returns
    Type Description
    Material

    GetDefaultBlitMaterial(NoiseSettings)

    Returns a Material reference to the default blit material for the given NoiseSettings object.

    Declaration
    public static Material GetDefaultBlitMaterial(NoiseSettings noise)
    Parameters
    Type Name Description
    NoiseSettings noise
    Returns
    Type Description
    Material

    A reference to the default blit Material for the specified NoiseSettings instance

    Remarks

    Internally, this uses noise.domainSettings.fractalTypeName to get it's FractalType

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023