Giter Site home page Giter Site logo

mudv587 / sand-shader-unity-urp-for-mobile Goto Github PK

View Code? Open in Web Editor NEW

This project forked from theodorknab/sand-shader-unity-urp-for-mobile

0.0 1.0 0.0 2.43 MB

Mobile friendly Unity sand/snow shader using the Universal Render Pipeline

License: MIT License

C# 52.57% ShaderLab 47.43%

sand-shader-unity-urp-for-mobile's Introduction

Sand Shader - in Unity URP for Mobile Phones

Demo tested on a OnePlus 3T, runs at 55 - 60 FPS

Sand Demo

Demo Scene

In the demo scene (Assets/Scenes/Main.unity) you can spawn stones or a rake via the buttons.

  • Left click / touch: drag object
  • Long left click / touch: pick up object

Effect Setup

This effect uses multiple shaders and materials, as multipass shaders are to my understanding currently not available in Unity SRPs. Those multiple materials/shaders need to be controlled by a script. (Done in Assets/Scripts/Sand/DrawDepth.cs)

How it works:

  • A depth texture is created from the underside of all movable objects and stored in a render texture.

Sand Demo

  • From this texture a difference texture is created, with the (stored) depth texture of the previous frame.
  • This difference texture gets blured.

  • The blured difference texture now gets subtracted from the existing sand depth texture.
  • The depth texture from the beginning gets added to the sand depth texture.

This texture is saved as the new sand depth texture.

  • The texture gets blured again. This texture is then used by the actual sand shader.

  • The actual sand shader uses the depth map to modify the normals of the material. No actual displacement of the geometry happens.

License

License

sand-shader-unity-urp-for-mobile's People

Contributors

theodorknab avatar

Watchers

James Cloos 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.