docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class LightUnitUtils

    Light Unit Utils contains functions and definitions to facilitate conversion between different light intensity units.

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

    Fields

    SphereSolidAngle

    The solid angle of a full sphere in steradians.

    Declaration
    public const float SphereSolidAngle = 12.566371
    Field Value
    Type Description
    float

    Methods

    CandelaToEv100(float)

    Convert intensity in Candela to Ev100.

    Declaration
    public static float CandelaToEv100(float candela)
    Parameters
    Type Name Description
    float candela

    Intensity in Candela.

    Returns
    Type Description
    float

    Intensity in Ev100.

    CandelaToLumen(float, float)

    Convert intensity in Candela to Lumen.

    Declaration
    public static float CandelaToLumen(float candela, float solidAngle)
    Parameters
    Type Name Description
    float candela

    Intensity in Candela.

    float solidAngle

    Light solid angle in steradians.

    Returns
    Type Description
    float

    Intensity in Lumen.

    CandelaToLux(float, float)

    Convert intensity in Candela to Lux.

    Declaration
    public static float CandelaToLux(float candela, float distance)
    Parameters
    Type Name Description
    float candela

    Intensity in Lux.

    float distance

    Distance between light and surface.

    Returns
    Type Description
    float

    Intensity in Lux.

    ConvertIntensity(Light, float, LightUnit, LightUnit)

    Convert intensity from one unit to another using the parameters of a given Light.

    Declaration
    public static float ConvertIntensity(Light light, float intensity, LightUnit fromUnit, LightUnit toUnit)
    Parameters
    Type Name Description
    Light light

    Light to use parameters from.

    float intensity

    Intensity to be converted.

    LightUnit fromUnit

    Unit to convert from.

    LightUnit toUnit

    Unit to convert to.

    Returns
    Type Description
    float

    Converted intensity.

    Ev100ToCandela(float)

    Convert intensity in Ev100 to Candela.

    Declaration
    public static float Ev100ToCandela(float ev100)
    Parameters
    Type Name Description
    float ev100

    Intensity in Ev100.

    Returns
    Type Description
    float

    Intensity in Candela.

    Ev100ToNits(float)

    Convert intensity in Ev100 to Nits.

    Declaration
    public static float Ev100ToNits(float ev100)
    Parameters
    Type Name Description
    float ev100

    Intensity in Ev100.

    Returns
    Type Description
    float

    Intensity in Nits.

    GetAreaFromDiscLight(float)

    Get the projected surface area of a Disc light.

    Declaration
    public static float GetAreaFromDiscLight(float discRadius)
    Parameters
    Type Name Description
    float discRadius

    The radius of the disc.

    Returns
    Type Description
    float

    Projected surface area.

    GetAreaFromRectangleLight(float, float)

    Get the projected surface area of a Rectangle light.

    Declaration
    public static float GetAreaFromRectangleLight(float rectSizeX, float rectSizeY)
    Parameters
    Type Name Description
    float rectSizeX

    The width of the rectangle.

    float rectSizeY

    The height of the rectangle.

    Returns
    Type Description
    float

    Surface area.

    GetAreaFromRectangleLight(Vector2)

    Get the projected surface area of a Rectangle light.

    Declaration
    public static float GetAreaFromRectangleLight(Vector2 rectSize)
    Parameters
    Type Name Description
    Vector2 rectSize

    The size of the rectangle.

    Returns
    Type Description
    float

    Projected surface area.

    GetAreaFromTubeLight(float)

    Get the projected surface area of a Tube light.

    Declaration
    public static float GetAreaFromTubeLight(float tubeLength)
    Parameters
    Type Name Description
    float tubeLength

    The length of the tube.

    Returns
    Type Description
    float

    4 * Pi * (tube length).

    Remarks

    Note that Tube lights have no physical surface area. Instead this method returns a value suitable for Nits<=>Lumen unit conversion.

    GetNativeLightUnit(LightType)

    Get the unit that light intensity is measured in, for a specific light type.

    Declaration
    public static LightUnit GetNativeLightUnit(LightType lightType)
    Parameters
    Type Name Description
    LightType lightType

    The type of light to get the native light unit for.

    Returns
    Type Description
    LightUnit

    The native unit of that light types intensity.

    GetSolidAngleFromPointLight()

    Get the solid angle of a Point light.

    Declaration
    public static float GetSolidAngleFromPointLight()
    Returns
    Type Description
    float

    4 * Pi steradians.

    GetSolidAngleFromPyramidLight(float, float)

    Get the solid angle of a Pyramid light.

    Declaration
    public static float GetSolidAngleFromPyramidLight(float spotAngle, float aspectRatio)
    Parameters
    Type Name Description
    float spotAngle

    The spot angle in degrees.

    float aspectRatio

    The aspect ratio of the pyramid.

    Returns
    Type Description
    float

    Solid angle in steradians.

    GetSolidAngleFromSpotLight(float)

    Get the solid angle of a Spot light.

    Declaration
    public static float GetSolidAngleFromSpotLight(float spotAngle)
    Parameters
    Type Name Description
    float spotAngle

    The spot angle in degrees.

    Returns
    Type Description
    float

    Solid angle in steradians.

    IsLightUnitSupported(LightType, LightUnit)

    Check if a light types intensity can be converted to/from a light unit.

    Declaration
    public static bool IsLightUnitSupported(LightType lightType, LightUnit lightUnit)
    Parameters
    Type Name Description
    LightType lightType

    Light type to check.

    LightUnit lightUnit

    Unit to check.

    Returns
    Type Description
    bool

    True if light unit is supported.

    LumenToCandela(float, float)

    Convert intensity in Lumen to Candela.

    Declaration
    public static float LumenToCandela(float lumen, float solidAngle)
    Parameters
    Type Name Description
    float lumen

    Intensity in Lumen.

    float solidAngle

    Light solid angle in steradians.

    Returns
    Type Description
    float

    Intensity in Candela.

    LumenToNits(float, float)

    Convert intensity in Lumen to Nits.

    Declaration
    public static float LumenToNits(float lumen, float area)
    Parameters
    Type Name Description
    float lumen

    Intensity in Lumen.

    float area

    Projected surface area of the light source.

    Returns
    Type Description
    float

    Intensity in Nits.

    LuxToCandela(float, float)

    Convert intensity in Lux to Candela.

    Declaration
    public static float LuxToCandela(float lux, float distance)
    Parameters
    Type Name Description
    float lux

    Intensity in Lux.

    float distance

    Distance between light and surface.

    Returns
    Type Description
    float

    Intensity in Candela.

    NitsToEv100(float)

    Convert intensity in Nits to Ev100.

    Declaration
    public static float NitsToEv100(float nits)
    Parameters
    Type Name Description
    float nits

    Intensity in Nits.

    Returns
    Type Description
    float

    Intensity in Ev100.

    NitsToLumen(float, float)

    Convert intensity in Nits to Lumen.

    Declaration
    public static float NitsToLumen(float nits, float area)
    Parameters
    Type Name Description
    float nits

    Intensity in Nits.

    float area

    Projected surface area of the light source.

    Returns
    Type Description
    float

    Intensity in Lumen.

    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)