I would like to know how I can make the gradient tool aligned perpendicular to a line in photoshop, or how to set the exact angle of the gradient? I know that by pressing the Shift key, I can constrain the angle of the gradient tool to increments of 45 degrees, but let's say for example in the following photo, I want to create a layer mask to mask out the sky and the water, but I want the bottom part of the layer mask to be a gradient from the horizon to the water. How can I align the gradient exactly to the horizon line?
Quick selection of the sky, some images with hard contrast allow to make a quick selection from a channel.
In this case, from the Channel window > duplicating the Blue Channel > Menu Image > Adjustments > Levels > eliminate midtones moving shadows and lights to the center.
A square frame at the bottom filled with black cover the sea. Selecting the sky with the Magic Wand > Invert selection > Fill it with black.
For fine retouching with the Brush Tool, visualize the RGB channel clicking on the eye icon or/and change the new channel opacity
This is the SKY/SEA Channel.
Activate the RGB channel > with the Shape tool, choose Line, 6px weight, and make a line shape layer across the horizon from side to side of the file (green on the image):
From the Layers Window > Hide the background layer.
With the Magic Wand click on the bottom area below the green line to select the sea and keep the selection.
With the Shape Selector Tool > Select the line > Copy > Paste > Transform > Rotate 90º
Channel Window > Activate the SKY/SEA Channel clicking on the name > Make the RGB channel visible clicking on the eye to see the vertical line
Choose the Gradient Tool > From Black to Transparent, make a gradient line from the bottom to the horizon following the vertical green line.
To make the other version, duplicate the SKY/SEA channel and using the same selection > Menu Image > Adjustments > Invert
Layers Window > Duplicate the background image
Menu Select > Load Selection... > Choose SKY/SEA or SKY/SEA COPY and apply the mask: