Giter VIP home page Giter VIP logo

2d-water-shader's Introduction

2D-Water-Shader

2D Water Shader made in HLSL in Unity based on water effect from the game Kingdom!

ko-fi

First off you'll need to create a render texture! Set it's size to some multiple of your screen resolution. For example width can be 1920ร—3.75=512 and height will then be 1080ร—3.75=288.

After that create a new camera and as the Target Texture assign previously created render texture. You should now have two cameras in the scene.

For the final step create new 3D plane and create material for it which will be using Custom/WaterShader as its shader.

Variables Description:

  • Texture: Your render texture
  • Displacement Texture: Your primary displacement texture for the water, you can find example texture in the Textures folder
  • Displacement Speed: How fast will your displacement texture scroll
  • Displacement Detail Texture: Secondary displacement texture for the water which should add more details to your water, you can find example texture in the Textures folder
  • Displacement Detail Speed: How fast will your displacement detail texture scroll
  • Displacement Amount Divider: How much effect will your displacement texture have, the lower the value, the more effect it has
  • Foam Threshold: Threshold used for displaying foam, the lower the value, the more foam there will be
  • Edge Foam Threshold: Threshold used for displaying edge foam, the lower the value, the more edge foam there will be
  • Foam Alpha: Alpha color value of the foam
  • Parallax Divider: How much parallax effect will there be on camera movement, the lower the value, the more effect it has
  • Perspective correction: Do you want your water to be slightly rotated and have correct perspection
  • Vertex Displacement: Toggle this if you want to slightly displace your plane
  • Vertex Displacement Texture: Texture for your vertex displacement, perlin noise texture can be found in the Textures folder
  • Vertex Displacement Amount Divider: How much vertex displacement will there be, the lower the value, the more effect it has
  • Vertex Displacement Speed Divider: How frequently should vertex displacement change, the lower the value, the more frequent it is

You are free to use this shader on all of your projects, commercial or non-commercial, you don't have to credit me anywhere, even though that would be nice.

Contact:

Background sprites by Craftpix: https://craftpix.net/freebies/free-horizontal-2d-game-backgrounds/

Example 01

2d-water-shader's People

Contributors

stefanjo3107 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.