The #unitytips Dev Takeover is an ongoing series on our @unitygames Twitter account. The Unity team invites super users from our community to share their insights, tips, and tricks directly with our followers. We’re kicking things off with Harry Alisavakis, tech artist at Jumpship Studio and VFX wizard extraordinaire.
If you don’t know Harry yet, you might recognize him from his neon-green avatar floating around whenever, and wherever, there’s talk of shaders. Here’s a quick rundown on how Harry has become such a rockstar in the world of visual effects:
Currently working as a technical artist on the upcoming game Somerville over at Jumpship, Harry spends his ‘spare’ time learning about VFX and shaders. In fact, he continues to inspire creators through his weekly compilation of tweets around game development called “Technically Art,” where he also promotes the work of other talented artists (be sure to give him a follow!) Through his related Discord channel, “Technically Speaking,” he leads chats about technical art, Unity creative challenges, and AMAs to answer as many user questions as possible. Check it out here.
Below are just a few stills from Harry’s most recent work. You can find even more in his portfolio.
Now onto the #unitytips, courtesy of Harry Alisavakis.
Let’s start with a small VFX trick for you to try out. While timing particle system effects with each other can be a bit fiddly, there’s actually a simple way to iterate on your visual effects using timelines. 🧵
In Unity, timelines have built-in support for particle systems, so you don’t need any custom scripting whatsoever. Just drag and drop your particle system right on there, and you’ll be able to pan through it.
Combining these tracks with animation or any other timeline gives you a much better idea for syncing up all the individual, animated elements, to create some really juicy VFX.
There’s a super fun way to get more bang for your buck when using particle systems and custom shaders, and that’s through custom vertex streams.
Let’s take a moment to fully understand what these are, and how we can use them for more advanced particle effects. 🧵
As you know, rendered models in Unity are made with triangles that consist of vertices. The vertices hold all the essential information regarding these models, such as their individual position, UV coordinates, and vertex color.
The cool thing is that we can add any sort of arbitrary data to our vertices and use it in our custom shader however we like. ✨ That’s the beauty of custom vertex streams in particle systems: We can pass particle-related information to our vertices and only leverage it as needed.
The option to add custom vertex streams can be found under the particle system’s Renderer module. Enabling it will show you all of the vertex streams already in use, like the UV coordinates and vertex color.
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 to notice is 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 particles’ 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 the particles’ 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 particles’ 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 tons 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 in the comments below.
Happy VFXing! ✨
Follow our Unity for Games Twitter for weekly #unitytips on Tuesdays and monthly Dev Takovers. Let us know in the comments who you would like to have featured in our future Dev Takeovers on Twitter.