Skip to content

leonjovanovic/water-shader-unity

Repository files navigation

Water shader in Unity 3D

Summary

    The goal of this project is to create as realistic water as possible using Shaders in Unity3D. Realistic water was achieved by implementing selected water effects:

Video

water1

Directional water

Reflection

    The reflection implemented in this paper is a simplified Fresnel's reflection. The reflection will only be applied to the distant environment (skybox), which will be mapped to the surface of the water. It is necessary to calculate the reflected vector in relation to the surface of the water. The reflected vector will be used to sample the skybox. The output color of the observed fragment will be sampled part from skybox.     The water view angle was also taken into account, so that the output color was multiplied by 1 - the angle between the water normal and the vector from the camera to the fragment on the water. This leads to the desired result where if the angle is 0 (the camera is located parallel to the water), the reflection will be 0 and vice versa.

refl1

Reflection on calm and turbulent water

Refraction

Caustics

Waves

Flow

Underwater Fog

Video

Water Youtube

Future improvements