top of page

Learning to use Unity's new Shader Graph: Dissolve Shader

I decided to get to know Unity's new shader graph system. It's a lot like Unreal Engine 4's, although it's a bit messier and a bit buggier, but that's to be expected since it's still in a sort of beta. And of course Unity lets you fall back on written shaders and custom shading models if the shader graph can't get the job you need done, something Unreal Engine 4 doesn't support unless you rewrite the source code for the engine.

I wanted to see if I could create a dissolve shader from scratch, without using any tutorials or examples as reference. I've worked with dissolve shaders but I'd never looked really closely at how they worked, but I figured they couldn't be all that complex. After a few hours, this is what I'd come up with.

I made this a bit more complicated than the bare minimum. The logic to the lower left is used to blend a Voronoi generator with several different types of noise to create a more organic looking basis for the dissolve effect. Ideally we would just create that texture by ourselves and use it as an input into the shader, but it works fine for experiment's sake. The logic at the top is making sure the offset of our "bumpiness" to the dissolve effect is the same distance in world space, no matter how the object is scaled. It's a very subtle effect in the video I posted but if you look closely you can see it.

Right now the dissolve effect is tied to a triangle wave function of time, just for demonstration's sake. Tying it to an actual time value difference using inverse lerp so that you could trigger it with code would be trivial, but I did it this way to save a bit of time, and so I could easily see the effect over and over.

Featured Posts
Recent Posts
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square
bottom of page