Coder Social home page Coder Social logo

jawinn / dither-transparency-urp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from daniel-ilett/dither-transparency-urp

1.0 1.0 0.0 19.34 MB

A dither transparency shader for Unity's Shader Graph and Universal Render Pipeline.

Home Page: https://danielilett.com/2020-04-19-tut5-5-urp-dither-transparency/

License: MIT License

C# 42.11% Mathematica 57.89%

dither-transparency-urp's Introduction

Dither Transparency in Unity URP

A dither transparency shader for Unity's Shader Graph and Universal Render Pipeline.

Dither Banner

Overview

This project features an efficient dither tarnsparency shader which uses a world-space Bayer dither matrix to cull object pixels to 'fake' a transparency-like effect without the need to implement actual transparency. It uses the features of Shader Graph and Universal RP. An accompanying tutorial is available on danielilett.com.

Usage and Demo

The project contains two custom shaders that can be used for your materials.

  • DitherTransparent: Shadows cast by the object also have the dithering pattern.
  • DitherTransparentOriginalShadow: The original opaque shadow is cast no matter the opacity. The shader has an additional node to set IsShadowCaster to true.

The shaders have a Vector1 called "Opacity" to control how opaque the object is—the higher it is, the less the object will be dithered. You can adjust the opacity via script like so:

float newOpacityValue = 0.5;
renderer.material.SetFloat("_Opacity", newOpacityValue);

If you run the SampleScene contained in the project, you will see the robotSphere fading in and out with the dither pattern. This is being done by the FadeInOut class found in the Scripts folder.

Software

This project was created using Unity 2019.3.0f6 and Universal Render Pipeline 7.1.8.

Authors

This project and the corresponding tutorial series were written by Daniel Ilett. Follow him on Twitter for more gamedev tutorials!

Release

This project was released on April 19th 2020.

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.