I am trying to make a procedural texture for donut, I want the white dots ( sugar ) to be only on top instead of all over the donut, How can I do ?
To get a mask of the top of the model, you can use the Normal output of the Texture Coordinate node. This gives a map of colors -1 to 1 along the X Y and Z axis. You can use a separate XYZ node to use only the Z axis, which can be used as a mask of the top of the model.
This gives a nice result
I used the Subtract node to control how high the mask was on the donut. Because the output from separate XYZ is a black and white image, you can manipulate it easily.
Then I added the Sugar texture onto black using the Z Normal as a mask, giving a black and white texture with the white dots acting as sugar.