How to render a water?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Robotex

I added area and calculate Archimedes Force and change state if player inside that area, so we can swim.

But how to render a water in that area? Can you give me some tutorial how to correctly implement water in 3d game?

:bust_in_silhouette: Reply From: clemens.tolboom

What about GitHub - godot-extended-libraries/godot-realistic-water: Godot - Realistic Water Shader

Wow! Looks amazing! I will learn the code, thank you.

Robotex | 2020-07-02 15:51

:bust_in_silhouette: Reply From: Calinou

If performance is your goal, you could make a simple but fast water material using SpatialMaterial:

  • Create a MeshInstance with a new PlaneMesh.
  • Create a new SpatialMaterial in the MeshInstance’s material override.
  • Set Albedo to a dark, translucent color.
  • Set Roughness to 0 and metallic to 1.
  • Use a normal map texture that represents some waves.
  • Optionally, you can enable refraction to distort what’s below the water.
  • Optionally, you can enable Proximity Fade to make water edges fade in smoothly. This is only supported when using the GLES3 renderer.
  • Create an AnimationPlayer node and use it to animate the SpatialMaterial’s Uv1 offset property. This will make the texture scroll over time.

To make waving water, you’ll need to write a vertex shader though.

Thank you. I will try at evening

Robotex | 2020-07-03 14:24