I am working on a water shader, using nodes to displace the waves of an ocean. Here is the simplified version using a checker texture to visualize my problem.

Since I want to make a cross section of the ocean ( waves on top, and a smooth glass shader on the sides to see the inside ) I need the top of the plane of the cube to displace on the z axis only, while the sides adjust their height accordingly to touch the top plane. Is it possible, and how if it is, to stop X and Y from going outwards?

My Blender version is 2.83

node setup used

subdivisions used

solid view

render isometric view

render side view

render top view

render water shader

  • $\begingroup$ even with a Separate XYZ it seems to mess up on the X and Y axis. And I suppose you don't want to use the Displace modifier (you can constraint on the Z axis) $\endgroup$ – moonboots Jun 19 '20 at 7:31
  • $\begingroup$ @moonboots I considered using the displacement modifier, but since I cant fully reproduce the waves I will use it as my last option. I just wondered if there would be another way besides using modifiers and baking out the displacement texture. $\endgroup$ – Tim Ott Jun 19 '20 at 8:03

The "Displacement" node displaces geometry along the local normal. If you want to push the geometry along a definite axis, you can use the "Vector Displacement" node and only populate the Z input field.

Don't forget to set the matrix to "World space" in the node though.

enter image description here

  • 1
    $\begingroup$ Thank you so much for the quick answer! It works seamlessly with my custom water setup. $\endgroup$ – Tim Ott Jun 19 '20 at 8:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.