I recently wrote an overlay shader. According to Wikipedia, it’s the same as hard light, except a and b are swapped.
My fragment is as follows…
fixed4 frag(vertexOutput input) : COLOR
{
fixed4 output = 0;
fixed4 inputA = tex2D(_MainTex, input.tex);
fixed4 inputB = _Color;
output = (inputA < 0.5) ? 2*inputA*inputB : 1-2*(1-inputA)*(1 - inputB);
output = lerp(inputA, output, _Blend);
output.a = inputA.a * inputB.a * _Transparency;
output.a = inputA.a * inputB.a * _Transparency;
}
Note, I’m doing a couple things different here than what you’ll ultimately need. First, this is an “Overlay” not “Hard Light” blend mode, but it should be a matter of swapping which color is assigned to “a” and “b” Blend modes - Wikipedia. Second, I’m blending a texture and a color. It sounds like you want to blend a texture with the scene, so your use of a grab pass appears necessary.
As @tanoshimi mentioned, you don’t have a blend mode specified. Since the blending has already happened in the shader,…
Blend SrcAlpha OneMinusSrcAlpha
…should work (it did for me).
Lastly, this line…
output = lerp(inputA, output, _Blend);
…functions the same as the “Opacity” property of a layer in photoshop.
The “_Transparency” property…
output.a = inputA.a * inputB.a * _Transparency;
…was just to allow me to fade out the object being rendered altogether.