# Geometry Nodes - Controlling Direction of Displacement

I have a flat cube with some subdivisions that I ran a simple noise displacement node setup through. I'm not using a flat plane with no fill because I want to have the sides of the terrain "cube" visible in my final render. In my node setup, I have a vertex group masking my terrain such that the top faces of my terrain cube should be the only parts of my mesh that are displaced. My problem is that despite the displacement working as expected, I am seeing that the mesh is trying to displace itself in the X and Y axes, and is stretching the vertices on the very edge of the cube outward:

To solve this, I think I need to restrict the displacement so it will only deform the mesh in the Z axis. I haven't found much on doing this, however. Here is my displacement setup:

I'm not quite sure how to proceed with restricting displacement in the Z axis. Any advice would be appreciated.

• Would you like to use an existing mesh, or would you also be happy with a solution in which the entire geometry is created in geometry nodes? Feb 26 at 18:13
• Either option is fine, as long as the setup can be applied to both the same way. I'm not particular, but geometry nodes can get confusing for me. Feb 28 at 16:09
• I have provided you with both solutions in the answer below. Let me know if you have any questions. Feb 28 at 19:08

The node Compare, with which you can compare the normals of the faces, for example, helps you to do this. If you compare the dot product of the normals with $$(0,0,1)$$, you will get the faces pointing upwards as the selection. You then evaluate this selection with Evaluate on Domain in the face domain so that the node Set Position receives the associated points as a selection.