Blend 노드
설명
Mode 파라미터로 정의된 블렌딩 모드를 사용하여 Blend 입력의 값을 Base에 블렌딩합니다. 블렌드 강도는 Opacity 입력에서 정의됩니다. Opacity 값이 0이면 Base 입력이 변경되지 않은 상태로 반환됩니다.
포트
이름 | 방향 | Type | 바인딩 | 설명 |
---|---|---|---|---|
Base | 입력 | 동적 벡터 | None | 기본 레이어 값 |
Blend | 입력 | 동적 벡터 | None | 블렌드 레이어 값 |
Opacity | 입력 | 플로트 | None | 블렌드 강도 |
Out | 출력 | 동적 벡터 | None | 출력 값 |
컨트롤
이름 | Type | 옵션 | 설명 |
---|---|---|---|
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);
}