#unitytips Dev Takeover: VFX and shaders with Harry Alisavakis

Finally, let’s make a simple dissolve shader for our particle system using Shader Graph. We’re talking about an unlit, double-sided Universal Render Pipeline (URP) shader with alpha clipping. The interesting thing here is to notice what drives the dissolve effect – the third component of our UVs.

You might be wondering why, especially since we tend to work with UV coordinates for texture sampling through the x and y components.

Well, next to each stream’s name, you’ll see where data is stored.

Here, the new stream is stored in TEXCOORD0.z, which corresponds to the third component of the first texture coordinate channel (a.k.a. UV0.z). By adding the lifetime age percentage, this value will start from zero and move toward one during the particle’s lifetime.

With our shader, this makes particles dissolve over time. Applying the shader to the particle system can give us this neat result:

So far so good, but what if we want even more control over their lifetime? Age percentage works, but it’s quite linear and not very useful for creating more complex effects. The solution lies in this Custom Data module:

We can use Custom1.x instead of age percentage, which in turn, allows us to employ a curve that alters the value over the particle’s lifetime, similar to built-in curves like Size over Lifetime.

Now we can better manage how our particles dissolve over time. ✨ How great is that?

Of course, there’s plenty more data that you can pass to custom vertex streams. The possibilities for using them inside your custom shaders are plenty.

That said, we’d love to know about your own creative uses for custom vertex streams. Keep us posted in the comments below.

Happy VFXing! ✨

Source link

More To Explore

Share on facebook
Share on twitter
Share on linkedin
Share on email