Master the Blend-if advanced layer style parameters
Now open the image SUNSET.JPG. Select Edit>Paste to paste the full moon image. Press V to select the move tool and drag to position the moon layer above the tree branches, as shown in the image below.
We want to knock out the black background around the moon. We can use the elliptical marquee tool to create a circular selection around the moon, inverse it, feather it and delete it. But what can we do if we want the moon to appear behind the tree branches? Our task is getting tougher. Using a layer mask would be an option yet it would require a lot of work. Fortunately Photoshop offers us a powerful and flexible feature.
Select the Moon layer and double click its thumbnail to open the layer styles window. On the BLEND IF area you can see two horizontal bars. Underneath each one of these bars you can see a black slider and a white slider; each slider is divided into two parts.
Click the black slider underneath the first bar and move it to the right until you read the tonal value of 40 (see the image below).
The black background around the moon has disappeared:
So far we learnt that the first bar provides advanced control over layers blending based upon the brightness of the pixels of the active layer. There are two more important things to learn. Back to work!
We want to make the moon appear behind the trees. In other words we want to bring forward the dark pixels of the underlying layer(s).
Drag the black slider of the second bar to the right until you read the tonal value of 20. This brings forward the pixels of the underlying layer that are darker than the tonal value of 20. As a result the dark tree branches and leaves appear in front of the bright moon pixels.
There is another important thing to learn. If you magnify the moon you will notice that the tree edges appear to be very jagged (see image below).
In this way you specify a tonal blending range within which the transition from visible to non-visible pixels takes place. As a result we create a soft blending effect. Now the tree edges look soft and the overall effect is natural:
Press V and move the moon with your mouse!