docs.unity3d.com
    目次を表示する/隠す

    Blend ノード

    説明

    Mode パラメーターで定義されるブレンドモードを使用して、Blend の入力値を Base の入力値にブレンドします。ブレンドの強度は Opacity の入力値で定義されます。Opacity の値が 0 の場合、入力 Base がそのまま (変更されずに) 返されます。

    ポート

    Name Direction タイプ バインディング 説明
    Base 入力 任意のベクトル型 なし Base レイヤーの値
    Blend 入力 任意のベクトル型 なし Blend レイヤーの値
    Opacity 入力 Vector 1 なし ブレンドの強度
    Out 出力 任意のベクトル型 なし 出力値

    制御

    Name タイプ オプション 説明
    Mode ドロップダウン Burn、Darken、Difference、Dodge、Divide、Exclusion、HardLight、HardMix、Lighten、LinearBurn、LinearDodge、LinearLight、LinearLightAddSub、Multiply、Negation、Overlay、PinLight、Screen、SoftLight、Subtract、VividLight、Overwrite 適用するブレンドモード

    生成されるコードの例

    次のサンプルコードは、ブレンドモードごとに、このノードの出力の一例を示したものです

    Burn

    void Unity_Blend_Burn_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out =  1.0 - (1.0 - Blend)/Base;
        Out = lerp(Base, Out, Opacity);
    }
    

    Darken

    void Unity_Blend_Darken_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = min(Blend, Base);
        Out = lerp(Base, Out, Opacity);
    }
    

    Difference

    void Unity_Blend_Difference_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = abs(Blend - Base);
        Out = lerp(Base, Out, Opacity);
    }
    

    Dodge

    void Unity_Blend_Dodge_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = Base / (1.0 - Blend);
        Out = lerp(Base, Out, Opacity);
    }
    

    Divide

    void Unity_Blend_Divide_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = Base / (Blend + 0.000000000001);
        Out = lerp(Base, Out, Opacity);
    }
    

    Exclusion

    void Unity_Blend_Exclusion_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = Blend + Base - (2.0 * Blend * Base);
        Out = lerp(Base, Out, Opacity);
    }
    

    HardLight

    void Unity_Blend_HardLight_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        float4 result1 = 1.0 - 2.0 * (1.0 - Base) * (1.0 - Blend);
        float4 result2 = 2.0 * Base * Blend;
        float4 zeroOrOne = step(Blend, 0.5);
        Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
        Out = lerp(Base, Out, Opacity);
    }
    

    HardMix

    void Unity_Blend_HardMix_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = step(1 - Base, Blend);
        Out = lerp(Base, Out, Opacity);
    }
    

    Lighten

    void Unity_Blend_Lighten_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = max(Blend, Base);
        Out = lerp(Base, Out, Opacity);
    }
    

    LinearBurn

    void Unity_Blend_LinearBurn_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = Base + Blend - 1.0;
        Out = lerp(Base, Out, Opacity);
    }
    

    LinearDodge

    void Unity_Blend_LinearDodge_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = Base + Blend;
        Out = lerp(Base, Out, Opacity);
    }
    

    LinearLight

    void Unity_Blend_LinearLight_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = Blend < 0.5 ? max(Base + (2 * Blend) - 1, 0) : min(Base + 2 * (Blend - 0.5), 1);
        Out = lerp(Base, Out, Opacity);
    }
    

    LinearLightAddSub

    void Unity_Blend_LinearLightAddSub_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = Blend + 2.0 * Base - 1.0;
        Out = lerp(Base, Out, Opacity);
    }
    

    Multiply

    void Unity_Blend_Multiply_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = Base * Blend;
        Out = lerp(Base, Out, Opacity);
    }
    

    Negation

    void Unity_Blend_Negation_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = 1.0 - abs(1.0 - Blend - Base);
        Out = lerp(Base, Out, Opacity);
    }
    

    Overlay

    void Unity_Blend_Overlay_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        float4 result1 = 1.0 - 2.0 * (1.0 - Base) * (1.0 - Blend);
        float4 result2 = 2.0 * Base * Blend;
        float4 zeroOrOne = step(Base, 0.5);
        Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
        Out = lerp(Base, Out, Opacity);
    }
    

    PinLight

    void Unity_Blend_PinLight_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        float4 check = step (0.5, Blend);
        float4 result1 = check * max(2.0 * (Base - 0.5), Blend);
        Out = result1 + (1.0 - check) * min(2.0 * Base, Blend);
        Out = lerp(Base, Out, Opacity);
    }
    

    Screen

    void Unity_Blend_Screen_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = 1.0 - (1.0 - Blend) * (1.0 - Base);
        Out = lerp(Base, Out, Opacity);
    }
    

    SoftLight

    void Unity_Blend_SoftLight_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        float4 result1 = 2.0 * Base * Blend + Base * Base * (1.0 - 2.0 * Blend);
        float4 result2 = sqrt(Base) * (2.0 * Blend - 1.0) + 2.0 * Base * (1.0 - Blend);
        float4 zeroOrOne = step(0.5, Blend);
        Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
        Out = lerp(Base, Out, Opacity);
    }
    

    Subtract

    void Unity_Blend_Subtract_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = Base - Blend;
        Out = lerp(Base, Out, Opacity);
    }
    

    VividLight

    void Unity_Blend_VividLight_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        float4 result1 = 1.0 - (1.0 - Blend) / (2.0 * Base);
        float4 result2 = Blend / (2.0 * (1.0 - Base));
        float4 zeroOrOne = step(0.5, Base);
        Out = result2 * zeroOrOne + (1 - zeroOrOne) * result1;
        Out = lerp(Base, Out, Opacity);
    }
    

    Overwrite

    void Unity_Blend_Overwrite_float4(float4 Base, float4 Blend, float Opacity, out float4 Out)
    {
        Out = lerp(Base, Blend, Opacity);
    }
    
    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)