@HarryAlisavakis As you already know, rendered models in Unity are made with triangles which consist of vertices. And vertices hold all essential information regarding these models, like their individual position, their UV coordinates or their 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 what custom vertex streams in particle systems allow us to do: pass particle-related information to our vertices that we can use as we please!
The option to add custom vertex streams can be found under the Renderer module of your particle system. Enabling it will show you all the vertex streams that are already being used, like the UV coordinates and the vertex color!
Let’s now make a simple dissolve shader for us to use with our particle system, using shader graph! This is a simple unlit, double-sided #URP shader, with alpha clipping. The interesting thing here is to notice what drives the dissolve effect: the third component of our UVs.
🤷♂️ “But why?” I hear you asking. You might be used to using UV coordinates for texture sampling, where you only really use the x and y components. Well, let’s get back to the particle system and its custom vertex streams and add a new one, hopefully that will clear things out:
Next to each stream’s name, you’ll see where that data is stored. Here, the new stream is stored in “TEXCOORD0.z”, which corresponds to the third component of the first texture coordinate channel (aka UV0.z).
Here, I added the lifetime age percentage, so this value will start from 0 and go towards 1 during the particle's lifetime. With our shader, that will make our particles dissolve over their lifetime!
Applying the shader to the particle system can give us this neat result:
So that’s cool, but what if we wanted more control over lifetime?
Age percentage is good but it’s quite linear and not very helpful if we wanted to do more complex effects. The answer is this little module here, called “Custom Data”:
We can use “Custom1.x” instead of age percentage, which in turn allows us to use a curve that alters the value over the particle’s lifetime, similarly to built-in curves like “Size over Lifetime”.
So now we can get a lot more control over how our particles dissolve over time ✨
How cool is that?
There’s plenty of data you can pass over to custom vertex streams and there’s just so much stuff for which you can use them inside your custom shaders!
Can you think of any other creative uses for custom vertex streams? Let us know in the replies!
Happy VFXing! ✨
• • •
Missing some Tweet in this thread? You can try to
force a refresh
Game development can be difficult, but there are ways to increase your learning process 10x. Here are some things you can do to maximize your learning potential 🧵
⌛ You can speed up in the scene view camera! That way you can adjust the speed and avoid missing the objects you are trying to zoom into. You can also Right Click and scroll the scroll wheel on the mouse to change the speed more easily! (1/7)
You can press “F” when you select an object in the Scene View to focus on it. You can press Shift+F to focus and zoom in to the object! (2/7)
When importing pixel art, make sure to pay attention to the resolution of your art.
Ideally, the size should be base 2, for example, 16x16,32x32,64x64,128x128, however, it is not necessary. Make sure it is a PNG with a transparent background. Tiles by @KenneyNL. (1/8)
In the import settings, select Sprite and then set the PPU (Pixels Per Unit) to the size of your pixel resolution. For example for a 64x64 image, you will put in 64. This is important for the pixels to be scaled correctly. (2/8)
Thank you again for a great takeover ♥ Make sure to give Joyce's website a visit, we've also compiled all the tips below so you can find them in one place 😊
I wanted to finish this Takeover with something I get asked a lot: how do I set up my characters in Unity? So here is how to create, rig and animate simple characters all in Unity! I threw together a cute robot for this occasion 🤖
It’s easy to create simple characters with basic primitives. Probuilder is useful too! For this character I used 4 models that I duplicated, scaled, rotated around to create this cute robot. It helps to think about animation at this step!
Once the model is done, I create empty gameobjects, and place them where the joints would rotate. These are the objects that will get animated, it’s important to name them correctly for animation! Using front/side views helps with precise placement.