docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class LensFlareCommonSRP

    Common code for all Data-Driven Lens Flare used

    Inheritance
    object
    LensFlareCommonSRP
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.Rendering
    Assembly: Unity.RenderPipelines.Core.Runtime.dll
    Syntax
    public sealed class LensFlareCommonSRP

    Fields

    maxLensFlareWithOcclusion

    Max lens-flares-with-occlusion supported

    Declaration
    public static int maxLensFlareWithOcclusion
    Field Value
    Type Description
    int

    maxLensFlareWithOcclusionTemporalSample

    With TAA Occlusion jitter depth, thought frame on HDRP. So we do a "unanimity vote" for occlusion thought 'maxLensFlareWithOcclusionTemporalSample' frame Important to keep this value maximum of 8 If this value change that could implies an implementation modification on: com.unity.render-pipelines.high-definition/Runtime/PostProcessing/Shaders/LensFlareMergeOcclusionDataDriven.compute

    Declaration
    public static int maxLensFlareWithOcclusionTemporalSample
    Field Value
    Type Description
    int

    mergeNeeded

    Set to 1 to enable temporal sample merge. Set to 0 to disable temporal sample merge (must support 16 bit textures, and the occlusion merge must be written in the last texel (vertical) of the lens flare texture.

    Declaration
    public static int mergeNeeded
    Field Value
    Type Description
    int

    occlusionRT

    occlusion texture either provided or created automatically by the SRP for lens flare. Texture width is the max number of lens flares that have occlusion (x axis the lens flare index). y axis is the number of samples (maxLensFlareWithOcclusionTemporalSample) plus the number of merge results. Merge results must be done by the SRP and stored in the [(lens flareIndex), (maxLensFlareWithOcclusionTemporalSample + 1)] coordinate. Note: It's not supported on OpenGL3 and OpenGLCore

    Declaration
    public static RTHandle occlusionRT
    Field Value
    Type Description
    RTHandle

    Properties

    Instance

    Current unique instance

    Declaration
    public static LensFlareCommonSRP Instance { get; }
    Property Value
    Type Description
    LensFlareCommonSRP

    Methods

    AddData(LensFlareComponentSRP)

    Add a new lens flare component on the pool.

    Declaration
    public void AddData(LensFlareComponentSRP newData)
    Parameters
    Type Name Description
    LensFlareComponentSRP newData

    The new data added

    ComputeOcclusion(Material, Camera, XRPass, int, float, float, bool, float, float, bool, Vector3, Matrix4x4, CommandBuffer, bool, bool, Texture, Texture)

    Effective Job of drawing the set of Lens Flare registered

    Declaration
    public static void ComputeOcclusion(Material lensFlareShader, Camera cam, XRPass xr, int xrIndex, float actualWidth, float actualHeight, bool usePanini, float paniniDistance, float paniniCropToFit, bool isCameraRelative, Vector3 cameraPositionWS, Matrix4x4 viewProjMatrix, CommandBuffer cmd, bool taaEnabled, bool hasCloudLayer, Texture cloudOpacityTexture, Texture sunOcclusionTexture)
    Parameters
    Type Name Description
    Material lensFlareShader

    Lens Flare material (HDRP or URP shader)

    Camera cam

    Camera

    XRPass xr

    XRPass data.

    int xrIndex

    XR multipass ID.

    float actualWidth

    Width actually used for rendering after dynamic resolution and XR is applied.

    float actualHeight

    Height actually used for rendering after dynamic resolution and XR is applied.

    bool usePanini

    Set if use Panani Projection

    float paniniDistance

    Distance used for Panini projection

    float paniniCropToFit

    CropToFit parameter used for Panini projection

    bool isCameraRelative

    Set if camera is relative

    Vector3 cameraPositionWS

    Camera World Space position

    Matrix4x4 viewProjMatrix

    View Projection Matrix of the current camera

    CommandBuffer cmd

    Command Buffer

    bool taaEnabled

    Set if TAA is enabled

    bool hasCloudLayer

    Unused

    Texture cloudOpacityTexture

    Unused

    Texture sunOcclusionTexture

    Sun Occlusion Texture from VolumetricCloud on HDRP or null

    ComputeOcclusion(Material, Camera, XRPass, int, float, float, bool, float, float, bool, Vector3, Matrix4x4, CommandBuffer, bool, bool, Texture, Texture, int, int, int, int, int, int, int, int, int, int, int)

    Effective Job of drawing the set of Lens Flare registered

    Declaration
    [Obsolete("Use ComputeOcclusion without _FlareOcclusionTex.._FlareData4 parameters.")]
    public static void ComputeOcclusion(Material lensFlareShader, Camera cam, XRPass xr, int xrIndex, float actualWidth, float actualHeight, bool usePanini, float paniniDistance, float paniniCropToFit, bool isCameraRelative, Vector3 cameraPositionWS, Matrix4x4 viewProjMatrix, CommandBuffer cmd, bool taaEnabled, bool hasCloudLayer, Texture cloudOpacityTexture, Texture sunOcclusionTexture, int _FlareOcclusionTex, int _FlareCloudOpacity, int _FlareOcclusionIndex, int _FlareTex, int _FlareColorValue, int _FlareSunOcclusionTex, int _FlareData0, int _FlareData1, int _FlareData2, int _FlareData3, int _FlareData4)
    Parameters
    Type Name Description
    Material lensFlareShader

    Lens Flare material (HDRP or URP shader)

    Camera cam

    Camera

    XRPass xr

    XRPass data.

    int xrIndex

    XR multipass ID.

    float actualWidth

    Width actually used for rendering after dynamic resolution and XR is applied.

    float actualHeight

    Height actually used for rendering after dynamic resolution and XR is applied.

    bool usePanini

    Set if use Panani Projection

    float paniniDistance

    Distance used for Panini projection

    float paniniCropToFit

    CropToFit parameter used for Panini projection

    bool isCameraRelative

    Set if camera is relative

    Vector3 cameraPositionWS

    Camera World Space position

    Matrix4x4 viewProjMatrix

    View Projection Matrix of the current camera

    CommandBuffer cmd

    Command Buffer

    bool taaEnabled

    Set if TAA is enabled

    bool hasCloudLayer

    Unused

    Texture cloudOpacityTexture

    Unused

    Texture sunOcclusionTexture

    Sun Occlusion Texture from VolumetricCloud on HDRP or null

    int _FlareOcclusionTex

    ShaderID for the FlareOcclusionTex

    int _FlareCloudOpacity

    ShaderID for the FlareCloudOpacity

    int _FlareOcclusionIndex

    ShaderID for the FlareOcclusionIndex

    int _FlareTex

    ShaderID for the FlareTex

    int _FlareColorValue

    ShaderID for the FlareColor

    int _FlareSunOcclusionTex

    ShaderID for the _FlareSunOcclusionTex

    int _FlareData0

    ShaderID for the FlareData0

    int _FlareData1

    ShaderID for the FlareData1

    int _FlareData2

    ShaderID for the FlareData2

    int _FlareData3

    ShaderID for the FlareData3

    int _FlareData4

    ShaderID for the FlareData4

    ComputeOcclusion(Material, Camera, XRPass, int, float, float, bool, float, float, bool, Vector3, Matrix4x4, UnsafeCommandBuffer, bool, bool, Texture, Texture)

    Effective Job of drawing the set of Lens Flare registered

    Declaration
    public static void ComputeOcclusion(Material lensFlareShader, Camera cam, XRPass xr, int xrIndex, float actualWidth, float actualHeight, bool usePanini, float paniniDistance, float paniniCropToFit, bool isCameraRelative, Vector3 cameraPositionWS, Matrix4x4 viewProjMatrix, UnsafeCommandBuffer cmd, bool taaEnabled, bool hasCloudLayer, Texture cloudOpacityTexture, Texture sunOcclusionTexture)
    Parameters
    Type Name Description
    Material lensFlareShader

    Lens Flare material (HDRP or URP shader)

    Camera cam

    Camera

    XRPass xr

    XRPass data.

    int xrIndex

    XR multipass ID.

    float actualWidth

    Width actually used for rendering after dynamic resolution and XR is applied.

    float actualHeight

    Height actually used for rendering after dynamic resolution and XR is applied.

    bool usePanini

    Set if use Panani Projection

    float paniniDistance

    Distance used for Panini projection

    float paniniCropToFit

    CropToFit parameter used for Panini projection

    bool isCameraRelative

    Set if camera is relative

    Vector3 cameraPositionWS

    Camera World Space position

    Matrix4x4 viewProjMatrix

    View Projection Matrix of the current camera

    UnsafeCommandBuffer cmd

    Command Buffer

    bool taaEnabled

    Set if TAA is enabled

    bool hasCloudLayer

    Unused

    Texture cloudOpacityTexture

    Unused

    Texture sunOcclusionTexture

    Sun Occlusion Texture from VolumetricCloud on HDRP or null

    ComputeOcclusion(Material, Camera, XRPass, int, float, float, bool, float, float, bool, Vector3, Matrix4x4, UnsafeCommandBuffer, bool, bool, Texture, Texture, int, int, int, int, int, int, int, int, int, int, int)

    Effective Job of drawing the set of Lens Flare registered

    Declaration
    [Obsolete("Use ComputeOcclusion without _FlareOcclusionTex.._FlareData4 parameters.")]
    public static void ComputeOcclusion(Material lensFlareShader, Camera cam, XRPass xr, int xrIndex, float actualWidth, float actualHeight, bool usePanini, float paniniDistance, float paniniCropToFit, bool isCameraRelative, Vector3 cameraPositionWS, Matrix4x4 viewProjMatrix, UnsafeCommandBuffer cmd, bool taaEnabled, bool hasCloudLayer, Texture cloudOpacityTexture, Texture sunOcclusionTexture, int _FlareOcclusionTex, int _FlareCloudOpacity, int _FlareOcclusionIndex, int _FlareTex, int _FlareColorValue, int _FlareSunOcclusionTex, int _FlareData0, int _FlareData1, int _FlareData2, int _FlareData3, int _FlareData4)
    Parameters
    Type Name Description
    Material lensFlareShader

    Lens Flare material (HDRP or URP shader)

    Camera cam

    Camera

    XRPass xr

    XR Infos

    int xrIndex

    Index of the SinglePass XR

    float actualWidth

    Width actually used for rendering after dynamic resolution and XR is applied.

    float actualHeight

    Height actually used for rendering after dynamic resolution and XR is applied.

    bool usePanini

    Set if use Panani Projection

    float paniniDistance

    Distance used for Panini projection

    float paniniCropToFit

    CropToFit parameter used for Panini projection

    bool isCameraRelative

    Set if camera is relative

    Vector3 cameraPositionWS

    Camera World Space position

    Matrix4x4 viewProjMatrix

    View Projection Matrix of the current camera

    UnsafeCommandBuffer cmd

    Command Buffer

    bool taaEnabled

    Set if TAA is enabled

    bool hasCloudLayer

    Unused

    Texture cloudOpacityTexture

    Unused

    Texture sunOcclusionTexture

    Sun Occlusion Texture from VolumetricCloud on HDRP or null

    int _FlareOcclusionTex

    ShaderID for the FlareOcclusionTex

    int _FlareCloudOpacity

    ShaderID for the FlareCloudOpacity

    int _FlareOcclusionIndex

    ShaderID for the FlareOcclusionIndex

    int _FlareTex

    ShaderID for the FlareTex

    int _FlareColorValue

    ShaderID for the FlareColor

    int _FlareSunOcclusionTex

    ShaderID for the _FlareSunOcclusionTex

    int _FlareData0

    ShaderID for the FlareData0

    int _FlareData1

    ShaderID for the FlareData1

    int _FlareData2

    ShaderID for the FlareData2

    int _FlareData3

    ShaderID for the FlareData3

    int _FlareData4

    ShaderID for the FlareData4

    Dispose()

    Disposal function, must be called by the SRP to release all internal textures.

    Declaration
    public static void Dispose()

    DoLensFlareDataDrivenCommon(Material, Camera, Rect, XRPass, int, float, float, bool, float, float, bool, Vector3, Matrix4x4, CommandBuffer, bool, bool, Texture, Texture, RenderTargetIdentifier, Func<Light, Camera, Vector3, float>, bool)

    Effective Job of drawing the set of Lens Flare registered

    Declaration
    public static void DoLensFlareDataDrivenCommon(Material lensFlareShader, Camera cam, Rect viewport, XRPass xr, int xrIndex, float actualWidth, float actualHeight, bool usePanini, float paniniDistance, float paniniCropToFit, bool isCameraRelative, Vector3 cameraPositionWS, Matrix4x4 viewProjMatrix, CommandBuffer cmd, bool taaEnabled, bool hasCloudLayer, Texture cloudOpacityTexture, Texture sunOcclusionTexture, RenderTargetIdentifier colorBuffer, Func<Light, Camera, Vector3, float> GetLensFlareLightAttenuation, bool debugView)
    Parameters
    Type Name Description
    Material lensFlareShader

    Lens Flare material (HDRP or URP shader)

    Camera cam

    Camera

    Rect viewport

    Viewport used for rendering and XR applied.

    XRPass xr

    XRPass data.

    int xrIndex

    XR multipass ID.

    float actualWidth

    Width actually used for rendering after dynamic resolution and XR is applied.

    float actualHeight

    Height actually used for rendering after dynamic resolution and XR is applied.

    bool usePanini

    Set if use Panani Projection

    float paniniDistance

    Distance used for Panini projection

    float paniniCropToFit

    CropToFit parameter used for Panini projection

    bool isCameraRelative

    Set if camera is relative

    Vector3 cameraPositionWS

    Camera World Space position

    Matrix4x4 viewProjMatrix

    View Projection Matrix of the current camera

    CommandBuffer cmd

    Command Buffer

    bool taaEnabled

    Set if TAA is enabled

    bool hasCloudLayer

    Unused

    Texture cloudOpacityTexture

    Unused

    Texture sunOcclusionTexture

    Sun Occlusion Texture from VolumetricCloud on HDRP or null

    RenderTargetIdentifier colorBuffer

    Source Render Target which contains the Color Buffer

    Func<Light, Camera, Vector3, float> GetLensFlareLightAttenuation

    Delegate to which return return the Attenuation of the light based on their shape which uses the functions ShapeAttenuation...(...), must reimplemented per SRP

    bool debugView

    Debug View which setup black background to see only Lens Flare

    DoLensFlareDataDrivenCommon(Material, Camera, Rect, XRPass, int, float, float, bool, float, float, bool, Vector3, Matrix4x4, CommandBuffer, bool, bool, Texture, Texture, RenderTargetIdentifier, Func<Light, Camera, Vector3, float>, int, int, int, int, int, int, int, int, int, int, int, int, bool)

    Effective Job of drawing the set of Lens Flare registered

    Declaration
    [Obsolete("Use DoLensFlareDataDrivenCommon without _FlareOcclusionRemapTex.._FlareData4 parameters.")]
    public static void DoLensFlareDataDrivenCommon(Material lensFlareShader, Camera cam, Rect viewport, XRPass xr, int xrIndex, float actualWidth, float actualHeight, bool usePanini, float paniniDistance, float paniniCropToFit, bool isCameraRelative, Vector3 cameraPositionWS, Matrix4x4 viewProjMatrix, CommandBuffer cmd, bool taaEnabled, bool hasCloudLayer, Texture cloudOpacityTexture, Texture sunOcclusionTexture, RenderTargetIdentifier colorBuffer, Func<Light, Camera, Vector3, float> GetLensFlareLightAttenuation, int _FlareOcclusionRemapTex, int _FlareOcclusionTex, int _FlareOcclusionIndex, int _FlareCloudOpacity, int _FlareSunOcclusionTex, int _FlareTex, int _FlareColorValue, int _FlareData0, int _FlareData1, int _FlareData2, int _FlareData3, int _FlareData4, bool debugView)
    Parameters
    Type Name Description
    Material lensFlareShader

    Lens Flare material (HDRP or URP shader)

    Camera cam

    Camera

    Rect viewport

    Viewport used for rendering and XR applied.

    XRPass xr

    XRPass data.

    int xrIndex

    XR multipass ID.

    float actualWidth

    Width actually used for rendering after dynamic resolution and XR is applied.

    float actualHeight

    Height actually used for rendering after dynamic resolution and XR is applied.

    bool usePanini

    Set if use Panani Projection

    float paniniDistance

    Distance used for Panini projection

    float paniniCropToFit

    CropToFit parameter used for Panini projection

    bool isCameraRelative

    Set if camera is relative

    Vector3 cameraPositionWS

    Camera World Space position

    Matrix4x4 viewProjMatrix

    View Projection Matrix of the current camera

    CommandBuffer cmd

    Command Buffer

    bool taaEnabled

    Set if TAA is enabled

    bool hasCloudLayer

    Unused

    Texture cloudOpacityTexture

    Unused

    Texture sunOcclusionTexture

    Sun Occlusion Texture from VolumetricCloud on HDRP or null

    RenderTargetIdentifier colorBuffer

    Source Render Target which contains the Color Buffer

    Func<Light, Camera, Vector3, float> GetLensFlareLightAttenuation

    Delegate to which return return the Attenuation of the light based on their shape which uses the functions ShapeAttenuation...(...), must reimplemented per SRP

    int _FlareOcclusionRemapTex

    ShaderID for the OcclusionRemap

    int _FlareOcclusionTex

    ShaderID for the FlareOcclusionTex

    int _FlareOcclusionIndex

    ShaderID for the FlareOcclusionIndex

    int _FlareCloudOpacity

    ShaderID for the FlareCloudOpacity

    int _FlareSunOcclusionTex

    ShaderID for the _FlareSunOcclusionTex

    int _FlareTex

    ShaderID for the FlareTex

    int _FlareColorValue

    ShaderID for the FlareColor

    int _FlareData0

    ShaderID for the FlareData0

    int _FlareData1

    ShaderID for the FlareData1

    int _FlareData2

    ShaderID for the FlareData2

    int _FlareData3

    ShaderID for the FlareData3

    int _FlareData4

    ShaderID for the FlareData4

    bool debugView

    Debug View which setup black background to see only Lens Flare

    DoLensFlareDataDrivenCommon(Material, Camera, Rect, XRPass, int, float, float, bool, float, float, bool, Vector3, Matrix4x4, UnsafeCommandBuffer, bool, bool, Texture, Texture, RenderTargetIdentifier, Func<Light, Camera, Vector3, float>, bool)

    Effective Job of drawing the set of Lens Flare registered

    Declaration
    public static void DoLensFlareDataDrivenCommon(Material lensFlareShader, Camera cam, Rect viewport, XRPass xr, int xrIndex, float actualWidth, float actualHeight, bool usePanini, float paniniDistance, float paniniCropToFit, bool isCameraRelative, Vector3 cameraPositionWS, Matrix4x4 viewProjMatrix, UnsafeCommandBuffer cmd, bool taaEnabled, bool hasCloudLayer, Texture cloudOpacityTexture, Texture sunOcclusionTexture, RenderTargetIdentifier colorBuffer, Func<Light, Camera, Vector3, float> GetLensFlareLightAttenuation, bool debugView)
    Parameters
    Type Name Description
    Material lensFlareShader

    Lens Flare material (HDRP or URP shader)

    Camera cam

    Camera

    Rect viewport

    Viewport used for rendering and XR applied.

    XRPass xr

    XRPass data.

    int xrIndex

    XR multipass ID.

    float actualWidth

    Width actually used for rendering after dynamic resolution and XR is applied.

    float actualHeight

    Height actually used for rendering after dynamic resolution and XR is applied.

    bool usePanini

    Set if use Panani Projection

    float paniniDistance

    Distance used for Panini projection

    float paniniCropToFit

    CropToFit parameter used for Panini projection

    bool isCameraRelative

    Set if camera is relative

    Vector3 cameraPositionWS

    Camera World Space position

    Matrix4x4 viewProjMatrix

    View Projection Matrix of the current camera

    UnsafeCommandBuffer cmd

    Command Buffer

    bool taaEnabled

    Set if TAA is enabled

    bool hasCloudLayer

    Unused

    Texture cloudOpacityTexture

    Unused

    Texture sunOcclusionTexture

    Sun Occlusion Texture from VolumetricCloud on HDRP or null

    RenderTargetIdentifier colorBuffer

    Source Render Target which contains the Color Buffer

    Func<Light, Camera, Vector3, float> GetLensFlareLightAttenuation

    Delegate to which return return the Attenuation of the light based on their shape which uses the functions ShapeAttenuation...(...), must reimplemented per SRP

    bool debugView

    Debug View which setup black background to see only Lens Flare

    DoLensFlareDataDrivenCommon(Material, Camera, Rect, XRPass, int, float, float, bool, float, float, bool, Vector3, Matrix4x4, UnsafeCommandBuffer, bool, bool, Texture, Texture, RenderTargetIdentifier, Func<Light, Camera, Vector3, float>, int, int, int, int, int, int, int, int, int, int, int, int, bool)

    Effective Job of drawing the set of Lens Flare registered

    Declaration
    [Obsolete("Use DoLensFlareDataDrivenCommon without _FlareOcclusionRemapTex.._FlareData4 parameters.")]
    public static void DoLensFlareDataDrivenCommon(Material lensFlareShader, Camera cam, Rect viewport, XRPass xr, int xrIndex, float actualWidth, float actualHeight, bool usePanini, float paniniDistance, float paniniCropToFit, bool isCameraRelative, Vector3 cameraPositionWS, Matrix4x4 viewProjMatrix, UnsafeCommandBuffer cmd, bool taaEnabled, bool hasCloudLayer, Texture cloudOpacityTexture, Texture sunOcclusionTexture, RenderTargetIdentifier colorBuffer, Func<Light, Camera, Vector3, float> GetLensFlareLightAttenuation, int _FlareOcclusionRemapTex, int _FlareOcclusionTex, int _FlareOcclusionIndex, int _FlareCloudOpacity, int _FlareSunOcclusionTex, int _FlareTex, int _FlareColorValue, int _FlareData0, int _FlareData1, int _FlareData2, int _FlareData3, int _FlareData4, bool debugView)
    Parameters
    Type Name Description
    Material lensFlareShader

    Lens Flare material (HDRP or URP shader)

    Camera cam

    Camera

    Rect viewport

    Viewport used for rendering and XR applied.

    XRPass xr

    XRPass data.

    int xrIndex

    XR multipass ID.

    float actualWidth

    Width actually used for rendering after dynamic resolution and XR is applied.

    float actualHeight

    Height actually used for rendering after dynamic resolution and XR is applied.

    bool usePanini

    Set if use Panani Projection

    float paniniDistance

    Distance used for Panini projection

    float paniniCropToFit

    CropToFit parameter used for Panini projection

    bool isCameraRelative

    Set if camera is relative

    Vector3 cameraPositionWS

    Camera World Space position

    Matrix4x4 viewProjMatrix

    View Projection Matrix of the current camera

    UnsafeCommandBuffer cmd

    Command Buffer

    bool taaEnabled

    Set if TAA is enabled

    bool hasCloudLayer

    Unused

    Texture cloudOpacityTexture

    Unused

    Texture sunOcclusionTexture

    Sun Occlusion Texture from VolumetricCloud on HDRP or null

    RenderTargetIdentifier colorBuffer

    Source Render Target which contains the Color Buffer

    Func<Light, Camera, Vector3, float> GetLensFlareLightAttenuation

    Delegate to which return return the Attenuation of the light based on their shape which uses the functions ShapeAttenuation...(...), must reimplemented per SRP

    int _FlareOcclusionRemapTex

    ShaderID for the OcclusionRemap

    int _FlareOcclusionTex

    ShaderID for the FlareOcclusionTex

    int _FlareOcclusionIndex

    ShaderID for the FlareOcclusionIndex

    int _FlareCloudOpacity

    ShaderID for the FlareCloudOpacity

    int _FlareSunOcclusionTex

    ShaderID for the _FlareSunOcclusionTex

    int _FlareTex

    ShaderID for the FlareTex

    int _FlareColorValue

    ShaderID for the FlareColor

    int _FlareData0

    ShaderID for the FlareData0

    int _FlareData1

    ShaderID for the FlareData1

    int _FlareData2

    ShaderID for the FlareData2

    int _FlareData3

    ShaderID for the FlareData3

    int _FlareData4

    ShaderID for the FlareData4

    bool debugView

    Debug View which setup black background to see only Lens Flare

    DoLensFlareScreenSpaceCommon(Material, Camera, float, float, Color, Texture, Texture, Texture, Texture, Texture, Vector4, Vector4, Vector4, Vector4, Vector4, CommandBuffer, RTHandle, bool)

    Effective Job of drawing Lens Flare Screen Space.

    Declaration
    public static void DoLensFlareScreenSpaceCommon(Material lensFlareShader, Camera cam, float actualWidth, float actualHeight, Color tintColor, Texture originalBloomTexture, Texture bloomMipTexture, Texture spectralLut, Texture streakTextureTmp, Texture streakTextureTmp2, Vector4 parameters1, Vector4 parameters2, Vector4 parameters3, Vector4 parameters4, Vector4 parameters5, CommandBuffer cmd, RTHandle result, bool debugView)
    Parameters
    Type Name Description
    Material lensFlareShader

    Lens Flare material (HDRP or URP shader)

    Camera cam

    Camera

    float actualWidth

    Width actually used for rendering after dynamic resolution and XR is applied.

    float actualHeight

    Height actually used for rendering after dynamic resolution and XR is applied.

    Color tintColor

    tintColor to multiply all the flare by

    Texture originalBloomTexture

    original Bloom texture used to write on at the end of compositing

    Texture bloomMipTexture

    Bloom mip texture used as data for the effect

    Texture spectralLut

    spectralLut used for chromatic aberration effect

    Texture streakTextureTmp

    Texture used for the multiple pass streaks effect

    Texture streakTextureTmp2

    Texture used for the multiple pass streaks effect

    Vector4 parameters1

    globalIntensity, regularIntensity, reverseIntensity, warpedIntensity

    Vector4 parameters2

    vignetteEffect, startingPosition, scale, freeSlot

    Vector4 parameters3

    samples, sampleDimmer, chromaticAbberationIntensity, chromaticAbberationSamples

    Vector4 parameters4

    streaksIntensity, streaksLength, streaksOrientation, streaksThreshold

    Vector4 parameters5

    downsampleStreak, warpedFlareScaleX, warpedFlareScaleY, freeSlot

    CommandBuffer cmd

    Command Buffer

    RTHandle result

    Result RT for the Lens Flare Screen Space

    bool debugView

    Information if we are in debug mode or not

    DoLensFlareScreenSpaceCommon(Material, Camera, float, float, Color, Texture, Texture, Texture, Texture, Texture, Vector4, Vector4, Vector4, Vector4, Vector4, CommandBuffer, RTHandle, int, int, int, int, int, int, int, int, int, int, int, bool)

    Effective Job of drawing Lens Flare Screen Space.

    Declaration
    [Obsolete("Use DoLensFlareScreenSpaceCommon without _Shader IDs parameters.")]
    public static void DoLensFlareScreenSpaceCommon(Material lensFlareShader, Camera cam, float actualWidth, float actualHeight, Color tintColor, Texture originalBloomTexture, Texture bloomMipTexture, Texture spectralLut, Texture streakTextureTmp, Texture streakTextureTmp2, Vector4 parameters1, Vector4 parameters2, Vector4 parameters3, Vector4 parameters4, Vector4 parameters5, CommandBuffer cmd, RTHandle result, int _LensFlareScreenSpaceBloomMipTexture, int _LensFlareScreenSpaceResultTexture, int _LensFlareScreenSpaceSpectralLut, int _LensFlareScreenSpaceStreakTex, int _LensFlareScreenSpaceMipLevel, int _LensFlareScreenSpaceTintColor, int _LensFlareScreenSpaceParams1, int _LensFlareScreenSpaceParams2, int _LensFlareScreenSpaceParams3, int _LensFlareScreenSpaceParams4, int _LensFlareScreenSpaceParams5, bool debugView)
    Parameters
    Type Name Description
    Material lensFlareShader

    Lens Flare material (HDRP or URP shader)

    Camera cam

    Camera

    float actualWidth

    Width actually used for rendering after dynamic resolution and XR is applied.

    float actualHeight

    Height actually used for rendering after dynamic resolution and XR is applied.

    Color tintColor

    tintColor to multiply all the flare by

    Texture originalBloomTexture

    original Bloom texture used to write on at the end of compositing

    Texture bloomMipTexture

    Bloom mip texture used as data for the effect

    Texture spectralLut

    spectralLut used for chromatic aberration effect

    Texture streakTextureTmp

    Texture used for the multiple pass streaks effect

    Texture streakTextureTmp2

    Texture used for the multiple pass streaks effect

    Vector4 parameters1

    globalIntensity, regularIntensity, reverseIntensity, warpedIntensity

    Vector4 parameters2

    vignetteEffect, startingPosition, scale, freeSlot

    Vector4 parameters3

    samples, sampleDimmer, chromaticAbberationIntensity, chromaticAbberationSamples

    Vector4 parameters4

    streaksIntensity, streaksLength, streaksOrientation, streaksThreshold

    Vector4 parameters5

    downsampleStreak, warpedFlareScaleX, warpedFlareScaleY, freeSlot

    CommandBuffer cmd

    Command Buffer

    RTHandle result

    Result RT for the Lens Flare Screen Space

    int _LensFlareScreenSpaceBloomMipTexture

    ShaderID for the original bloom texture

    int _LensFlareScreenSpaceResultTexture

    ShaderID for the LensFlareScreenSpaceResultTexture texture

    int _LensFlareScreenSpaceSpectralLut

    ShaderID for the LensFlareScreenSpaceSpectralLut texture

    int _LensFlareScreenSpaceStreakTex

    ShaderID for the LensFlareScreenSpaceStreakTex streak temp texture

    int _LensFlareScreenSpaceMipLevel

    ShaderID for the LensFlareScreenSpaceMipLevel parameter

    int _LensFlareScreenSpaceTintColor

    ShaderID for the LensFlareScreenSpaceTintColor color

    int _LensFlareScreenSpaceParams1

    ShaderID for the LensFlareScreenSpaceParams1

    int _LensFlareScreenSpaceParams2

    ShaderID for the LensFlareScreenSpaceParams2

    int _LensFlareScreenSpaceParams3

    ShaderID for the LensFlareScreenSpaceParams3

    int _LensFlareScreenSpaceParams4

    ShaderID for the LensFlareScreenSpaceParams4

    int _LensFlareScreenSpaceParams5

    ShaderID for the LensFlareScreenSpaceParams5

    bool debugView

    Information if we are in debug mode or not

    DoLensFlareScreenSpaceCommon(Material, Camera, float, float, Color, Texture, Texture, Texture, Texture, Texture, Vector4, Vector4, Vector4, Vector4, Vector4, UnsafeCommandBuffer, RTHandle, bool)

    Effective Job of drawing Lens Flare Screen Space.

    Declaration
    public static void DoLensFlareScreenSpaceCommon(Material lensFlareShader, Camera cam, float actualWidth, float actualHeight, Color tintColor, Texture originalBloomTexture, Texture bloomMipTexture, Texture spectralLut, Texture streakTextureTmp, Texture streakTextureTmp2, Vector4 parameters1, Vector4 parameters2, Vector4 parameters3, Vector4 parameters4, Vector4 parameters5, UnsafeCommandBuffer cmd, RTHandle result, bool debugView)
    Parameters
    Type Name Description
    Material lensFlareShader

    Lens Flare material (HDRP or URP shader)

    Camera cam

    Camera

    float actualWidth

    Width actually used for rendering after dynamic resolution and XR is applied.

    float actualHeight

    Height actually used for rendering after dynamic resolution and XR is applied.

    Color tintColor

    tintColor to multiply all the flare by

    Texture originalBloomTexture

    original Bloom texture used to write on at the end of compositing

    Texture bloomMipTexture

    Bloom mip texture used as data for the effect

    Texture spectralLut

    spectralLut used for chromatic aberration effect

    Texture streakTextureTmp

    Texture used for the multiple pass streaks effect

    Texture streakTextureTmp2

    Texture used for the multiple pass streaks effect

    Vector4 parameters1

    globalIntensity, regularIntensity, reverseIntensity, warpedIntensity

    Vector4 parameters2

    vignetteEffect, startingPosition, scale, freeSlot

    Vector4 parameters3

    samples, sampleDimmer, chromaticAbberationIntensity, chromaticAbberationSamples

    Vector4 parameters4

    streaksIntensity, streaksLength, streaksOrientation, streaksThreshold

    Vector4 parameters5

    downsampleStreak, warpedFlareScaleX, warpedFlareScaleY, freeSlot

    UnsafeCommandBuffer cmd

    UnsafeCommandBuffer

    RTHandle result

    Result RT for the Lens Flare Screen Space

    bool debugView

    Information if we are in debug mode or not

    GetFlareData0(Vector2, Vector2, Vector2, Vector2, float, float, float, Vector2, bool)

    Compute internal parameters needed to render single flare

    Declaration
    public static Vector4 GetFlareData0(Vector2 screenPos, Vector2 translationScale, Vector2 rayOff0, Vector2 vLocalScreenRatio, float angleDeg, float position, float angularOffset, Vector2 positionOffset, bool autoRotate)
    Parameters
    Type Name Description
    Vector2 screenPos

    The screen position of the flare.

    Vector2 translationScale

    The scale of translation applied to the flare.

    Vector2 rayOff0

    The base offset for the flare ray.

    Vector2 vLocalScreenRatio

    The ratio of the flare's local screen size.

    float angleDeg

    The base angle of rotation for the flare.

    float position

    The position along the flare's radial line, relative to the source, where 1.0 represents the edge of the screen.

    float angularOffset

    Angular offset applied to the flare's position.

    Vector2 positionOffset

    The offset from the flare's calculated position.

    bool autoRotate

    Flag to enable automatic rotation based on flare's position.

    Returns
    Type Description
    Vector4

    A Vector4 object representing the shader parameters _FlareData0.

    Initialize()

    Initialization function which must be called by the SRP.

    Declaration
    public static void Initialize()

    IsCloudLayerOpacityNeeded(Camera)

    Check if at least one LensFlareComponentSRP request occlusion from background clouds

    Declaration
    public static bool IsCloudLayerOpacityNeeded(Camera cam)
    Parameters
    Type Name Description
    Camera cam

    Camera

    Returns
    Type Description
    bool

    true if cloud occlusion is requested

    IsEmpty()

    Check if we have at least one Lens Flare added on the pool

    Declaration
    public bool IsEmpty()
    Returns
    Type Description
    bool

    true if no Lens Flare were added

    IsOcclusionRTCompatible()

    Check if we can use an OcclusionRT

    Declaration
    public static bool IsOcclusionRTCompatible()
    Returns
    Type Description
    bool

    return true if we can have the OcclusionRT

    ProcessLensFlareSRPElementsSingle(LensFlareDataElementSRP, CommandBuffer, Color, Light, float, float, Material, Vector2, bool, Vector2, Vector4, bool, int)

    Function that process a single element of a LensFlareDataSRP, this function is used on scene/game view and on the inspector for the thumbnail.

    Declaration
    public static void ProcessLensFlareSRPElementsSingle(LensFlareDataElementSRP element, CommandBuffer cmd, Color globalColorModulation, Light light, float compIntensity, float scale, Material lensFlareShader, Vector2 screenPos, bool compAllowOffScreen, Vector2 vScreenRatio, Vector4 flareData1, bool preview, int depth)
    Parameters
    Type Name Description
    LensFlareDataElementSRP element

    Single LensFlare asset we need to process.

    CommandBuffer cmd

    Command Buffer.

    Color globalColorModulation

    Color Modulation from Component?

    Light light

    Light used for the modulation of this singe element.

    float compIntensity

    Intensity from Component.

    float scale

    Scale from component

    Material lensFlareShader

    Shader used on URP or HDRP.

    Vector2 screenPos

    Screen Position

    bool compAllowOffScreen

    Allow Lens Flare offscreen

    Vector2 vScreenRatio

    Screen Ratio

    Vector4 flareData1

    _FlareData1 used internally by the shader.

    bool preview

    true if we are on preview on the inspector

    int depth

    Depth counter for recursive call of 'ProcessLensFlareSRPElementsSingle'.

    RemoveData(LensFlareComponentSRP)

    Remove a lens flare data which exist in the pool.

    Declaration
    public void RemoveData(LensFlareComponentSRP data)
    Parameters
    Type Name Description
    LensFlareComponentSRP data

    The data which exist in the pool

    ShapeAttenuationAreaDiscLight(Vector3, Vector3)

    Attenuation by Light Shape for Area Light with Disc Shape

    Declaration
    public static float ShapeAttenuationAreaDiscLight(Vector3 forward, Vector3 wo)
    Parameters
    Type Name Description
    Vector3 forward

    Forward Vector of Directional Light

    Vector3 wo

    Vector pointing to the eye

    Returns
    Type Description
    float

    Attenuation Factor

    ShapeAttenuationAreaRectangleLight(Vector3, Vector3)

    Attenuation by Light Shape for Area Light with Rectangular Shape

    Declaration
    public static float ShapeAttenuationAreaRectangleLight(Vector3 forward, Vector3 wo)
    Parameters
    Type Name Description
    Vector3 forward

    Forward Vector of Directional Light

    Vector3 wo

    Vector pointing to the eye

    Returns
    Type Description
    float

    Attenuation Factor

    ShapeAttenuationAreaTubeLight(Vector3, Vector3, float, Camera)

    Attenuation by Light Shape for Area Light with Tube Shape

    Declaration
    public static float ShapeAttenuationAreaTubeLight(Vector3 lightPositionWS, Vector3 lightSide, float lightWidth, Camera cam)
    Parameters
    Type Name Description
    Vector3 lightPositionWS

    World Space position of the Light

    Vector3 lightSide

    Vector pointing to the side (right or left) or the light

    float lightWidth

    Width (half extent) of the tube light

    Camera cam

    Camera rendering the Tube Light

    Returns
    Type Description
    float

    Attenuation Factor

    ShapeAttenuationDirLight(Vector3, Vector3)

    Attenuation by Light Shape for Directional Light

    Declaration
    public static float ShapeAttenuationDirLight(Vector3 forward, Vector3 wo)
    Parameters
    Type Name Description
    Vector3 forward

    Forward Vector of Directional Light

    Vector3 wo

    Vector pointing to the eye

    Returns
    Type Description
    float

    Attenuation Factor

    ShapeAttenuationPointLight()

    Attenuation by Light Shape for Point Light

    Declaration
    public static float ShapeAttenuationPointLight()
    Returns
    Type Description
    float

    Attenuation Factor

    ShapeAttenuationSpotBoxLight(Vector3, Vector3)

    Attenuation by Light Shape for Spot Light with Box Shape

    Declaration
    public static float ShapeAttenuationSpotBoxLight(Vector3 forward, Vector3 wo)
    Parameters
    Type Name Description
    Vector3 forward

    Forward Vector of Directional Light

    Vector3 wo

    Vector pointing to the eye

    Returns
    Type Description
    float

    Attenuation Factor

    ShapeAttenuationSpotConeLight(Vector3, Vector3, float, float)

    Attenuation by Light Shape for Spot Light with Cone Shape

    Declaration
    public static float ShapeAttenuationSpotConeLight(Vector3 forward, Vector3 wo, float spotAngle, float innerSpotPercent01)
    Parameters
    Type Name Description
    Vector3 forward

    Forward Vector of Directional Light

    Vector3 wo

    Vector pointing to the eye

    float spotAngle

    The angle of the light's spotlight cone in degrees.

    float innerSpotPercent01

    Get the inner spot radius between 0 and 1.

    Returns
    Type Description
    float

    Attenuation Factor

    ShapeAttenuationSpotPyramidLight(Vector3, Vector3)

    Attenuation by Light Shape for Spot Light with Pyramid Shape

    Declaration
    public static float ShapeAttenuationSpotPyramidLight(Vector3 forward, Vector3 wo)
    Parameters
    Type Name Description
    Vector3 forward

    Forward Vector of Directional Light

    Vector3 wo

    Vector pointing to the eye

    Returns
    Type Description
    float

    Attenuation Factor

    Extension Methods

    ReflectionUtils.GetField(object, string)
    ReflectionUtils.GetFields(object)
    ReflectionUtils.Invoke(object, string, params object[])
    ReflectionUtils.SetField(object, string, object)
    AnalyticsUtils.ToNestedColumnWithDefault<T>(T, T, bool)
    AnalyticsUtils.ToNestedColumn<T>(T, T)
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)