Version: 2021.3
언어: 한국어
ShaderLab 커맨드: Blend
ShaderLab 커맨드: ColorMask

ShaderLab 커맨드: BlendOp

Blend 커맨드가 사용하는 블렌딩 작업을 지정합니다. 이 커맨드가 작동하려면 같은 패스 블록(해당 커맨드가 패스 블록 내에 있는 경우) 또는 서브셰이더 블록(해당 커맨드가 서브셰이더 블록 내에 있는 경우)에도 Blend 커맨드가 있어야 합니다.

일부 블렌딩 작업은 일부 기기에서만 지원되며, 지원 여부는 그래픽스 API와 하드웨어에 따라 달라집니다. 지원되지 않는 블렌딩 작업을 처리하는 방식은 그래픽스 API마다 다릅니다. GL은 지원되지 않는 작업을 건너뛰며, Vulkan과 Metal은 Add 작업으로 폴백합니다.

렌더 파이프라인 호환성

기능 이름 빌트인 렌더 파이프라인 유니버설 렌더 파이프라인(URP) 고해상도 렌더 파이프라인(HDRP) 커스텀 SRP
BlendOp 지원 지원 지원 지원

사용법

이 커맨드는 렌더 상태를 변경합니다. Pass 블록에서 사용하여 해당 패스의 렌더 상태를 설정하거나, SubShader 블록에서 사용하여 해당 서브셰이더에 있는 모든 패스의 렌더 상태를 설정할 수 있습니다.

서명 예제 구문 기능
BlendOp <operation> BlendOp Sub Blend 커맨드가 사용하는 블렌딩 작업을 설정합니다.

유효한 파라미터 값

파라미터 기능
작업 Add 소스와 대상을 더합니다.
Sub 소스에서 대상을 뺍니다.
RevSub 대상에서 소스를 뺍니다.
Min 소스와 대상 중 더 작은 것을 사용합니다(참고 1 참조).
Max 소스와 대상 중 더 큰 것을 사용합니다(참고 1 참조).
LogicalClear 논리 연산: Clear (0)(참고 2 참조)
LogicalSet 논리 연산: Set (1)(참고 2 참조)
LogicalCopy 논리 연산: Copy (s)(참고 2 참조)
LogicalCopyInverted 논리 연산: Copy inverted (!s) 2
LogicalNoop 논리 연산: Noop (d)(참고 2 참조)| ||LogicalInvert|논리 연산: Invert (!d)(참고 2 참조)
LogicalAnd 논리 연산: And (s & d)(참고 2 참조)
LogicalNand 논리 연산: Nand !(s & d)(참고 2 참조)
LogicalOr Logical operation: Or (s | d) (See note 2)
LogicalNor Logical operation: Nor !(s | d) (See note 2)
LogicalXor 논리 연산: Xor (s ^ d)(참고 2 참조)
LogicalEquiv 논리 연산: Equivalence !(s ^ d)(참고 2 참조)
LogicalAndReverse 논리 연산: Reverse And (s & !d)(참고 2 참조)| ||LogicalAndInverted|논리 연산:Inverted And (!s & d)(참고 2 참조)| ||LogicalOrReverse|Logical operation:Reverse Or (s !d)(See note 2)| ||LogicalOrInverted|Logical operation:Inverted Or (!s d)(See note 2)| ||Multiply|고급 OpenGL 블렌딩 작업:Multiply(참고 3 참조)| ||Screen|고급 OpenGL 블렌딩 작업:Screen(참고 3 참조)| ||Overlay|고급 OpenGL 블렌딩 작업:Overlay(참고 3 참조)| ||Darken|고급 OpenGL 블렌딩 작업:Darken(참고 3 참조)| ||Lighten|고급 OpenGL 블렌딩 작업:Lighten(참고 3 참조)| ||ColorDodge|고급 OpenGL 블렌딩 작업:ColorDodge(참고 3 참조)| ||ColorBurn|고급 OpenGL 블렌딩 작업:ColorBurn(참고 3 참조)| ||HardLight|고급 OpenGL 블렌딩 작업:HardLight(참고 3 참조)| ||SoftLight|고급 OpenGL 블렌딩 작업:SoftLight(참고 3 참조)| ||Difference|고급 OpenGL 블렌딩 작업:Difference(참고 3 참조)| ||Exclusion|고급 OpenGL 블렌딩 작업:Exclusion(참고 3 참조)| ||HSLHue|고급 OpenGL 블렌딩 작업:HSLHue(참고 3 참조)| ||HSLSaturation|고급 OpenGL 블렌딩 작업:HSLSaturation(참고 3 참조)| ||HSLColor|고급 OpenGL 블렌딩 작업:HSLColor(참고 3 참조)| ||HSLLuminosity|고급 OpenGL 블렌딩 작업:HSLLuminosity`(참고 3 참조)

참고:

  1. Min과 Max는 OpenGL ES 2의 GL_EXT_blend_minmax가 필수입니다.
  2. 논리 연산은 DX 11.1+ 또는 Vulkan이 필수입니다.
  3. 고급 OpenGL 블렌딩 작업은 GLES3.1 AEP+, GL_KHR_blend_equation_advanced 또는 GL_NV_blend_equation_advanced가 필수입니다. 이는 표준 RGBA 블렌딩에 한해 함께 사용할 수 있으며, 별도의 RGB 및 알파 블렌딩과는 호환되지 않습니다.

예제

Shader "Examples/CommandExample"
{
    SubShader
    {
         // The rest of the code that defines the SubShader goes here.

        Pass
        {    
             // Enable subtractive blending for this Pass
             Blend SrcAlpha One
             BlendOp RevSub
            
              // The rest of the code that defines the Pass goes here.
        }
    }
}

이 예제 코드는 SubShader 블록에서 이 커맨드를 사용하기 위한 구문을 나타냅니다.

Shader "Examples/CommandExample"
{
    SubShader
    {
         // Enable subtractive blending for this SubShader
         Blend SrcAlpha One
         BlendOp RevSub

         // The rest of the code that defines the SubShader goes here.        

        Pass
        {    
              // The rest of the code that defines the Pass goes here.
        }
    }
}
ShaderLab 커맨드: Blend
ShaderLab 커맨드: ColorMask