メインコンテンツまでスキップ

blendExclusion: Soft Contrast Inversion

Mathematical Foundation of Exclusion

Exclusion blending creates a softer version of difference blending by using the formula base + blend - 2 * base * blend. This produces inverted contrast effects while preserving mid-tones, creating subtle yet distinctive visual results.

The mathematical definition is:

Cresult=Cbase+Cblend2CbaseCblendC_{result} = C_{base} + C_{blend} - 2 \cdot C_{base} \cdot C_{blend}

Unlike harsh difference blending, exclusion maintains smoother transitions and creates more pleasing artistic effects by reducing contrast in overlapping areas.

Soft Contrast Properties

PropertyDescriptionMathematical Behavior
Mid-tone PreservationGray areas remain relatively unchanged0.5+0.52(0.5)(0.5)=0.50.5 + 0.5 - 2(0.5)(0.5) = 0.5
Soft InversionGentle contrast without harsh edgesSmooth gradient response
SymmetryOrder independencef(A,B)=f(B,A)f(A,B) = f(B,A)
Bounded OutputResults stay within valid range0result10 \leq result \leq 1
ライブエディター
const fragment = () => {
      const base = vec3(0.7, 0.4, 0.8)
      const wave1 = uv.x.mul(8).add(uv.y.mul(3)).sin().mul(0.3).add(0.5)
      const wave2 = uv.y.mul(6).add(uv.x.mul(4)).cos().mul(0.3).add(0.5)
      const blend = vec3(wave1, wave2, wave1.mul(wave2))
      const result = blendExclusionVec3(base, blend)
      return vec4(result, 1)
}