Log Node | Shader Graph | 7.1.8
docs.unity3d.com
    Show / Hide Table of Contents

    Log Node

    Description

    Returns the logarithm of input In. Log is the inverse operation to the Exponential Node.

    For example, the result of a base-2 Exponential using an input value of 3 is 8.

    Therefore the result of a base-2 Log using an input value of 8 is 3.

    The logarithmic base can be switched between base-e, base-2 and base-10 from the Base dropdown on the node.

    Ports

    Name Direction Type Description
    In Input Dynamic Vector Input value
    Out Output Dynamic Vector Output value

    Controls

    Name Type Options Description
    Base Dropdown BaseE, Base2, Base10 Selects the logarithmic base

    Generated Code Example

    The following example code represents one possible outcome of this node per Base mode.

    Base E

    void Unity_Log_float4(float4 In, out float4 Out)
    {
        Out = log(In);
    }
    

    Base 2

    void Unity_Log2_float4(float4 In, out float4 Out)
    {
        Out = log2(In);
    }
    

    Base 10

    void Unity_Log10_float4(float4 In, out float4 Out)
    {
        Out = log10(In);
    }
    
    In This Article
    • Description
    • Ports
    • Controls
    • Generated Code Example
    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