Hello and welcome to our latest tutorial with
the VFX graph.
With our last video giving a short introduction
on how to achieve a simple effect we got a
few comments and wishes on what to show next.
One of those wishes was to replicate an effect
from the game Rocket League which shows some
kind of fancy black hole explosion, you can
find a link to the video in the description.
Taking a closer look at the effect we can
separate it into four parts.
It starts with an explosion of particles that
almost immediately slows down and gets sucked
towards the center of the effect.
The second part is the black hole which appears
in the center.
It suddenly grows and stays for a short moment,
than collapses.
The third part are the fireworks that start
spreading right after the implosion part.
The single firework particles leave trails
of more particles.
And the last part are some sparkles which
are generated right after the black hole disappears.
This whole graph is a lot more complex than
the last tutorial as you can see here in the
VFX Editor with the completed effect.
Ok, let's take a look at how we can build
this effect.
The basic setup of a vfx project was already
shown in our last video, so we assume that
you know how to do that.
We will start with a new visual effect graph
and simply remove everything that is already
in there.
Add an event node and give it a name.
As you can see this node has a button to send
this event, with this button we can trigger
our effect.
We can create a simple particle system to
get a template from which we can develope
the explosion part.
Replace the Constant Spawn Rate in the Spawn
Context with a Single Burst and set its Count
to about 800.
Now you connect the event to the start input
of the Spawn context.
A press on the Send button will now trigger
the system.
Remove everything from the initialize block
and add a Position (Sphere), Set lifetime,
Set Velocity, SetScale and SetSize.
Also, set the Capacity to something two or
three times your Spawn count.
We can leave the settings for the position
sphere note on the default values.
The lifetime will be set to 0.5.
Set the size to 0.5.
The scale will be set to 0.1, 0.5, 0.5 to
get longer, slimmer particles.
For the velocity we will take the current
position, normalize it and multiply it by
a random value between 80 and 120.
Next we can make sure that the quad output
is set to blend mode additive and UV mode
simple.
Set the main texture to the sparkle image.
(You can find all the images we are using
in the archive linked in the description.)
Remove the set set size over life and the orient
face camera plane blocks and use an orient
along velocity instead.
If you trigger the event now you will barely
see any particles.
This is because currently they are too fast.
We want to achieve the effect of an explosion
which is interrupted by a black hole.
So in the first moment the particles should
expand really fast and then be stopped abruptly.
This is done by adding a linear drag node
to the update block.
Set the coefficient to 20.
Upon triggering the event this looks much
better now!
But this is only the first part of this!
Next we have to do the implosion.
We do this by adding a conform to sphere node.
Set the attraction speed to 35, the distance
to 0.01 and the force to 0.
For the attraction force we will build a small
calculation on the side.
Start by creating an Age Over Lifetime node
and connect it to a sample curve.
feed this into a multiply and set the parameter
b to 500.
Connect the output of the multiply to the
attraction force of the conform to sphere
node.
Open the curve of the sample curve node and
use the linear preset.
Add a key at position 0.6 and set its value
to 1.
Right click on it and set both tangets to
constant.
The last step is to set the first key to zero.
This controls the force of the conform to
sphere.
Change the Gradient in the color - alpha over
lifetime in the output to something like this.
This should conclude the first part of our
effect, the explosion and implosion combination.
Do not forget to name your systems!
This one will be called - Explosion
So let us continue with the next step, the
black hole in the center.
For this one we can again, start with a simple
particle system.
Replace the constant spawn rate with a single
burst and set it to count 1.
We will talk about the delay later.
We can lower the capacity to something small.
Remove the set velocity random and the set
lifetime random and add a set lifetime.
Set the lifetime to 2.
The update block can be left empty.
Set the texture to the blackhole Texture we
provided in the description.
Change the gradient in the Color / alpha over
life to something like this.
This will make the ring around the hole glow.
Next, adjust the curve in the size over life
to something like this.
With a fast start, a slow decay in the beginning
and then a faster ending.
Now we can connect the event to the the Black
hole graph and test it out.
At the moment, both effects start together.
But we want the black hole to have a slight
delay.
We can enter this in the spawn block.
Use something small like 0.3.
The fireworks start with another simple particle
system.
Like the other parts we start by changing
the spawn to a single burst.
Set the count to 30.
In the initialize block set the capacity to
120.
Remove the set velocity random and set the
Set Lifetime Random to 0.5 and 1.
Add a Position Sphere and set the radius to
0.5.
For the velocity we will use the vector of
the current position.
Since all positions are on the surface of
a sphere these will point outwards from the
center.
Add a Set velocity.
Now we take a Get Attribute position node
and feed it to a normalize node.
This way we will always start with a vector
of length 1 and have a better control over
the velocity.
Next we will multiply it by a random number
between 30 and 60.
Connect this to the set velocity input.
Before we try this one out, let us change
the main texture to the light dot texture,
switch the Blend Mode to additive.
Connect the event to the spawn block and see
how it looks.
To give the particles a nicer behaviour, add
a linear drag to the update and set its coefficient
to 5.
This will slow them down.
Now add a turbulence node with both intensity
and drag at 10.
This gives the particles a more firework-like
look.
Remove the Set size over lifetime from the
Quad output and change the gradient of the
color - alpha over life to something like
this.
For a better timing of the effect, set the
delay in the spawn to 0.5.
To make this part more interesting we will
now add some trails to the particles, for
this we need to enable the Experimental Operators
and Block from the Preferences, Visual Effects
menu.
This gives us the "Trigger Event Always" node
which we can add to the update.
This will trigger an event in each update
cycle.
Again, we can use a simple particle system
preset to start from.
Delete the whole spawn block and create a
GPUEvent context.
Now we can connect our trigger to the GPUEvent
and the GPUEvent to the Initialize block.
Set the capacity to something high.
Remove the Set velocity random and add an
Inherit source position node.
Set the lifteime bounds to 0.5 and 0.85.
Add a set angle randomized node and set it
to the z axis.
Set it to a linear curve from 0 to 1 and then
set the last key to 360.
A turbulence node in the update adds some
variety.
just raise the intensity to 5.
Make sure that the blend mode in the Quad
Output is set to additive.
As a texture you can use the splat texture
we provided.
The size over Life can be changed to something
like this.
Now with the Color / Alpha over life and a
Gradient like this, the effect looks really
really nice.
For some final sugarcoating, we will add a
few more particles to enhance the black hole
disappearing moment.
As before, start with a simple particle system
and replace the spawn part with a single burst
set to a count of 300.
Set the delay to 1.4.
Set the capacity to 1200.
Use a Position Sphere with a radius of 0.01.
Remove the set velocity random.
Add a Set Velocity and re-use the same functionality
we used for the fireworks part.
Just copy and paste it but limit the random
number range between 1 and 3.
Another turbulence node goes into the update
with an intensity of 2.
Again, the outputs blend mode is set to Additive.
The main texture is again, the light dot.
We can remove the size over life and change
the color - alpha gradient to this.
Change the orientation to Face camera position.
The effect is now complete, the only thing
to do is to change the render order of the
different parts.
You can do this in the inspector by dragging
the elements to where you need them.
For this, we only move the Black hole to the
bottom so it is rendered above everything
else.
We really like this effect and hope that you
learned something today.
Thank you for watching our tutorial.
If you like our videos, please subscribe to
our channel and give the video a thumbs-up.
If you have any questions or ideas what we
should do next, leave us a comment!
