Merry Christmas!

Recently Unity updated its version to 2018.3 and it is packed with a lot of wonderful features, and my favorite of them is definitely the Visual Effect Graph (VFX graph). VFX graph allows you to create amazing particle systems with an easy-to-use node-based system, and if this is not wonderful enough, the new VFX graph uses compute shader to allow millions of particles to be calculated and rendered on the GPU without choking your computer. There is no better way to experience its awesomeness than trying it out ourselves. Therefore, in the spirit of Christmas, let’s make some particle Christmas tree.

Setup

Please refer to here for a gentle introduction to the system.

To set up the VFX graph, your Unity needs to be at least on version 2018.3, which is currently under beta test right now. Also, the VFX Graph is only supported in Unity’s High Definition Rendering Pipeline (HDRP). If you are not familiar with the HDRP, please refer to here for more information. Once you have a project set up with HDRP, you will be able to import the VFX graph package from Window -> Package Manager. 

Once you have your package imported, create an empty game object and attach the Visual Effect component on it.

The Asset Template slot on the component is empty when you attach it to the game object, so we need to create a Visual Effect Graph like the following and attach it to the component. Once a Visual Effect Graph is created, double click it to open the editing window, and here is where all the fun happens.

Components

Each particle system consists of four major components: Spawn, Initialize, Update and Output, and each VFX Graph can contain multiple different particle systems. In fact, as we will see later, the Christmas tree consists of three particles systems. Within each of the four components, various nodes can be dropped in to control the behavior of the particles. For a detail explanation of the components, please refer back to the video in the Setup section. Now, let’s make the tree! (finally!)

Node Setup

Please download the following zip file for the materials used in the particle system. It contains textures for the particle rendering, as well as signed distance field textures that are used to lookup for the force that confines the particles to a shape of the tree body and the star. Unfortunately, currently there is no native way to bake the signed distance field texture in Unity, so if you would like to create your own shapes, you will have to rely on third-party software like Houdini to bake out the texture.

Result

Hope you will have fun with this new system like I did!

Leave a Comment

Your email address will not be published. Required fields are marked *