changed 4 years ago
Linked with GitHub

Basic VFX Graph

tags: Blog Tutorial

Goal:

  • Understand how to use basic VFX graph

I. Introduction to VFX Graph in Unity

  • Particle system is not only tool available in Unity to create VFX

  • The visual effects graph is a another tool (and even more powerful) to create stunning visuals in unity projects. The visual effects graph uses nodes and blocks workflow that's quick to learn and familiar to users who have use Unity Shader graph

  • The visual effect graph and the existing particle system will co-exist because the both have different advantages & disadvantages. Below is the difference between them that is explained in the Visual Effect Graph - Realtime visual effects In Unity 2018.3 Video in Youtube

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Some VFX suited for VFX Graph:

    • environment lit smoke
    • fluid simulations
    • detailed spell effects
  • Some VFX suited for the Current Particle System:

    • debris
    • sparks
    • projectiles
  • To learn more on VFX graph, visit Visual Effect Graph

II. Project Setup

  • So to make our VFX graph, first, we need to make a new project and remember to use the URP since the renderer cannot work in the regular pipeline. Let's call our project "VFXGraphTutorial"
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Now, let's delete the examples assets except the floor from the default scene of the URP
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Next, import the VFX Graph Package
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

III. Making a Basic VFX Graph

  • Now, let's start creating our VFX Graph. Create the directory & the Visual Effect Graph file named "TestVFX"
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • If we drag the VFX to the scene as an object, we can already see the effects that it makes
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • To edit the VFX Graph, double click it from the directory & we can see the node based strucuture just like what we saw in the Shader Graph.
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Note: Don't worry if we don't understand too much right now. Basically, the visual effect graph is like a timeline with nodes. Let's just try to follow the tutorial to see what happens. If ou want to learn more first, then visit https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@12.0/manual/index.html

  • First, let's try to manipulate the Spawn Rate in the 1st to 16000 & the Capacity in the 2nd node to 320000
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Suddenly, we can see that the amount of bubbles in the VFX is increased. So that is the function of the spawn rate & capacity
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Edit back the Spawn Rate to 16 & the Capacity to 32. And let's try to add a gravity block in the update node
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Suddenly, we can see that the bubbles fall
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Let's remove the gravity and random blocks
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Now, let's add a set lifetime, set velocity & set position block inside the Init node
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • We can see that our bubbless shoot straight up in the scene, just like what we set in the VFX graph
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Since our current VFX is a bit boring, let's add a new sine wave node & connect its output to the x input of the position block
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Try to modify the value of the input and we can see the position where the bubbles spawn will be changing
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • To make the change constantly happening, we just add a total time node and connect its output to the input of the sine wave node
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Now, we can already see some OK VFX
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • We can also add property like in the shader graph. Let's try it by making a sineMax property from the blackboard & edit the contents to this
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Drag the sineMax to the graph and make a connection to the Max input of the Sine Wave node
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Now, we can edit the Maximum value of the Sine Wave node directly in the inspector panel through the use of the sineMax property. Remember to tick the property to override its default value
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Because we use the property feature, we can now duplicate the VFX object & make direct individual edit of the parameter without affecting the other object and editing the contents of our VFX graph
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Next, let's make our VFX more interesting by giving some colors. Add a new gradient property
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Now, connect the the output of the new property node to the input of the set color over life block
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Let's add some cool colors
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • We can also edit the spawn rate
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Let's also edit the Main Texture
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • And we have some cool VFX with colors. Of course to make it more beautiful, we need to do more work
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

IV. Fire & Smoke VFX from VFX Package Samples

  • Now of course we do not have to make our own VFX from scratch everytime. Unity actually provide us some basic VFX from the package. To use them, first import the VisualEffectGraph Additions package
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Next, navigate to the sample VFX directory to see some premade VFX
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Here, we have a bonfire VFX from the sample asset
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • We also have a smoke VFX from the sample asset
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • To further study the insides of the sample asset VFX graph, just double click it and we can see how it works
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

V. Advanced VFX Samples

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • Now, we can load & study some really cool VFX like this morphing face down here
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

VI. Conclusion

Conclusion

  • VFX graph is a node based approach to create stunning VFX
  • We can create our own VFX graph just like we can create the shader graph
  • Unity has provided some simple VFX samples and also some advance VFX samples so that we can study and reuse it
Select a repo