Photoshop-style Overlay blend mode

Avatar
  • updated
  • Declined

Most of the main blend modes that someone using Photoshop might be used to are accounted for in Shapes, but the 'Overlay' blend mode, which is like a hybrid of both Multiply and Screen, is not yet included.

As an example, here is an implementation that has worked for me in the past, though I make no claims to its correctness:

#define BLEND_OVERLAY(a, b) b <= 0.5 ? (2*b)*a : (1 - (1-2*(b-0.5)) * (1-a)) 
half3 overlayBlend(half3 back, half3 front)
{
    return
        half3(
            BLEND_OVERLAY(back.r, front.r),
            BLEND_OVERLAY(back.g, front.g),
            BLEND_OVERLAY(back.b, front.b)
        );
}

Referenced from here: http://www.deepskycolors.com/archive/2010/04/21/formulas-for-Photoshop-blending-modes.html

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Pinned replies
Avatar
Freya Holmér creator
  • Answer
  • Declined

so far all blend modes have been implemented using hardware blending, in which you have much less control than blending operations where you have full access to both the source and the destination values. As far as I know there's no way to do this, unless we start going into Shapes using GrabPass or render textures or other extremely expensive operations to get a hold of the target data

Avatar
JohannesMP
Quote from Freya Holmér

so far all blend modes have been implemented using hardware blending, in which you have much less control than blending operations where you have full access to both the source and the destination values. As far as I know there's no way to do this, unless we start going into Shapes using GrabPass or render textures or other extremely expensive operations to get a hold of the target data

Darn, that is understandable though.

Avatar
Freya Holmér creator
  • Answer
  • Declined

so far all blend modes have been implemented using hardware blending, in which you have much less control than blending operations where you have full access to both the source and the destination values. As far as I know there's no way to do this, unless we start going into Shapes using GrabPass or render textures or other extremely expensive operations to get a hold of the target data