Problem with shadow catcher and a question about alpha blending I have a model of an object and a ground 



and I need to separate the two into two different render images. First image -- object with a transparent shadow, second image -- ground without an object. Then I need to place the resulting images in Unity on top of each other so that they would look the same as the render of an object unseparated from the ground.

I managed to make a render of the object with a shadow using render layers and a "shadow catcher" feature. But when I try to combine it in Unity or Photoshop with a render of a ground, the shadow looks too dark (much darker than in a combied render). Surprisingly, when I mix an object with a ground in a Blender compositor, the shadow looks exactly right:



So here are the questions:


Is it possible to make a shadow lighter using shadow catcher? I tried to make a shadow catcher material semi-transparent, but the shadow stayed the same. I also tried to fix the issue with adding a third render -- a render of object without a shadow: I placed it on top, the layer of an object with a shadow in the middle (with the opacity of 50% for a lighter shadow) and the render of a ground in the bottom. Unfortunately it renders some artifacts on the fringes of an object. I also tried to make shadow dimmer in Blender compositor using object ID mask, but again it renders some artifacts on the fringe of an object. The same goes with the method of dividing image with a shadow on the image without a shadow and then placing object on top.
Why does blender overlaying method differ from method in Photoshop or Unity? (I tried to convert renders from standard to premultiplied and from premultiplied to standard, but it did not change much).
Is it possible at all to simulate Photoshop blending algorithm in Blender compositor, so that I will have an idea of how the blending would look in Photoshop or unity without using them?


Would be grateful for any advice.
1) It is possible with the compositor. You need to pull a pass with the shadow catcher object only, modify its alpha and composite it. However, compositing back the foreground object with the shadow catcher pass might be tricky, specially in the edges where the solid object meets the shadow.
A useful tip in this case is to work with both alphas (solid foreground's and catcher's) and make sure they are combined properly rather than working with RGBA. Check whether those alphas are correlated or uncorrelated, depending on your setup.

2) As cegaton pointed out and you realized already, the reason for the difference is blending images in a linear space (blender) vs. blending images in a non-linear space (photoshop and others).
Blender works with linear images all the way. What you get from the compositor is linear, even though the display transform makes the final composite non-linear and also saving as byte-images (like PNG, JPG, etc. does ,as 8-bit images need to be gamma-corrected to avoid artifacts.
So, even when images are converted to non-linear in the end, all the blending operations inside the compositor are performed on linear data with associated alpha (also called pre-multiplied).
Photoshop does it completely different, for a number of reasons, being legacy the main one: Back in the day when it was only possible to edit 8-bit images, it made sense to work with gamma-corrected sources with unassociated alpha (like PNGs).
Things have changed since, but Photoshop kept the non-linear editing and a lot of graphics applications followed its lead doing the same.
It's good to keep in mind that linear blending works closer to reality than non-linear blending, so take Blender's result as the right one (which means that you should try making Photoshop look like Blender, not the other way around).

3) Yes it is!
You need to turn your linear associated images to non-linear unassociated ones.
With the alpha convert node, you have to make the buffers unassociated (premul to straight), then with a gamma correct node "bend" the linear image to 0.4545 (1/2.2).
The result will be merged with an alpha-over node (make sure you mark the convert premul checkbox, as the input is unassociated), and right after that node a gamma node set to 2.2 will take the result back to linear (which is necessary as Blender colour management expects linear to apply the display transform and the output gamma-correction.

Check the following image, it comes with a bonus: Did you see the ugly dark fringe around the foreground? That's one of the nasty effects of alpha blending non-linear images ;-)