NVJOB Water Shader Simple And Fast by nvjob - 10

Games & ProjectsShaders & Effects

#NVJOB Water Shader - simple and fast.

Unity 2019.1.8f1MIT LicenseUpdated 27 days agoCreated on May 10th, 2019
Go to source

#NVJOB Water Shader - simple and fast. v1.4.4

GitHub Logo

Simple and fast water shader. This shader is suitable for scenes where water is not a key element of the scene, but a decorative element. Supported rendering path deferred and forward.

Unity Asset Store - https://assetstore.unity.com/packages/vfx/shaders/nvjob-water-shader-simple-and-fast-149916
Previous Versions - https://github.com/nvjob/NVJOB-Water-Shader-old-versions

https://www.youtube.com/watch?v=94dRrLFMA1k
https://www.youtube.com/watch?v=q91znPUJtPY

GitHub Logo


Prerequisites

To work on the project, you will need a Unity version of at least 2019.1.8 (64-bit).

Information

The movement of the waves is carried out using global shader variables: _WaterLocalUvX, _WaterLocalUvZ, _WaterLocalUvNX, _WaterLocalUvNZ.

_WaterLocalUvX, _WaterLocalUvZ - Offset main texture.
_WaterLocalUvNX, _WaterLocalUvNZ - Offset normal map texture.

An example of a script for the movement of water.

using UnityEngine;

public class Water : MonoBehaviour
{
    public float UvRotateSpeed = 0.4f;
    public float UvRotateDistance = 2.0f;
    public float UvBumpRotateSpeed = 0.4f;
    public float UvBumpRotateDistance = 2.0f;

    Vector2 lwVector, lwNVector;

    private void Awake()
    {
        lwVector = Vector2.zero;
        lwNVector = Vector2.zero;
    }

    void Update()
    {
        lwVector = Quaternion.AngleAxis(Time.time * UvRotateSpeed, Vector3.forward) * Vector2.one * UvRotateDistance;
        lwNVector = Quaternion.AngleAxis(Time.time * UvBumpRotateSpeed, Vector3.forward) * Vector2.one * UvBumpRotateDistance;
        Shader.SetGlobalFloat("_WaterLocalUvX", lwVector.x);
        Shader.SetGlobalFloat("_WaterLocalUvZ", lwVector.y);
        Shader.SetGlobalFloat("_WaterLocalUvNX", lwNVector.x);
        Shader.SetGlobalFloat("_WaterLocalUvNZ", lwNVector.y);
    }
}

GitHub Logo GitHub Logo GitHub Logo


Authors

Designed by #NVJOB Nicholas Veselov - https://nvjob.github.io

License

MIT License - https://nvjob.github.io/mit-license

Help for this project - https://nvjob.github.io/donate

Show all projects by nvjob