![source engine sdk flowmaps water source engine sdk flowmaps water](https://i.ytimg.com/vi/0f5KghK7YKI/maxresdefault.jpg)
a box or a closed triangle mesh), the volume defines the underwater area: When the camera is inside the volume, an underwater effect is applied.Īn infinite ocean plane (without vertex displacement for waves) is rendered as a single horizontal quad that covers the view frustum. a horizontal rectangle for a swimming pool, or a curved triangle mesh for a river. A local body of water can be defined using any of the built-in shapes, e.g. Our solution distinguishes between local bodies of water (puddles, ponds, rivers, etc.) and an infinite ocean plane. The water mesh is rendered as an opaque object (no alpha blending). The mesh allows to define a local body of water, information (such as flow direction) can be stored in vertex attributes, work can be moved to the vertex shader, and so on. This method is also used in the jMonkeyEngine. If the water surface should be displaced to create waves, waves are stored in a height map, and the shader raymarches through the height field – similar to Parallax Occlusion Mapping. The post-processing effect checks the depth buffer to see if a pixel is above or below the water surface. This method requires a G-buffer – at least you need a texture containing the depth values of the scene. The second method is described in the article Rendering Water as a Post-process Effect. To create water, we can either render a 3D mesh with a water shader, or render a 2D quad and apply a deferred rendering/post-processing effect. Instead, we will briefly describe all relevant parts, link to the relevant literature and go into detail where we have added something new. This will not be a complete step-by-step introduction – there are already many articles out there (see Water Rendering Resources ). By Helmut Garstenauer, Martin GarstenauerĪs requested, we will describe some implementation details of our water rendering solution.