Hi Everyone, I’m Richard, a baby real time VFX artist. I’ve been building effects for game engines for about 5 months. I’ve got a good grasp of all the fundamentals but found that I’m at a point now where I need to step up my game. That is why I’m starting this blog. From here until I inevitably forget this exits and stop updating it I’m going to be delving into various effects I think are cool and deconstructing them and rebuilding them in a game engine every two weeks.
EPIC games have released a ton of paragon assets giving me the chance to look at the processes used by some of the greatest UE4 Techno Mages, making this the easiest blog I’ll have to write in this series. Originally, I wanted this blog to be about me recreating some of the VFX. However, copying some shader code doesn’t make for an interesting blog post. Instead I am going to share some of the techniques that I saw being used. This blog will be using UE4 to demonstrate, however a lot of the math-based techniques will be able to carry over to other engines. Chances are to some of the more experienced VFX artists out there these will be pretty basic however they were mind blowing to a rookie like me and I hope some other rookies will see this and use it to make their art better.
What we will be looking at is:
1. The magic of the power node
2. Particle relative time node
3. Particle Random node
4. Using functions to store a collection of colours
5. Using the particle colour node to change values
6. Using a slight offset to make chromatic stars
7. View based masking
1. The magic of the Power Node:
Before I looked through the paragon assets I never used the power node which considering the janky material code I tried to use to get the same effect is insane. Before going into how it can be used to improve our shaders I want to go into what it actually does. Power is a maths function that looks like this:
Where is X multiplied by itself Y times. To put this in graphical terms each pixel in a texture is a scale of 0 – 1, 0 being black and 1 being white. This brings us to game engines, when we put a texture sample through the power node each pixel is going to be multiplied by itself Y times. Zooming into this cloud/bone texture we would see the following grid:
Putting that through a power 2 node makes the pixel values multiply by themselves once more. The impact this has on our texture is making the darker values a lot darker, the lighter pixels will become slightly darker and the white pixels will remain white, giving us a lot of contrast in our texture.
So that’s what the power node does but what can we do with it? The first use of this I found is making a soft exterior edge blur.
These nodes make a Fresnel, inverts it, and then powers it to 5. This gives a sphere a soft black outline. When this gets plugged into the opacity node that makes a soft sphere. Both these two objects have been placed in a level. One with just the colour white into the emissive slot and the other using the code above.
This next example uses the power node to create a highlight.
The power makes the circles smaller which get used as a mask to lerp the high colour over the low colour. When that lerp is multiplied by the original texture it creates these bubbles with a nice highlight.
2. Particle Relative Time Node:
The particle relative time node is something in the UE4 material editor that outputs a value between 0 – 1, that represents the age of the particle where 0 is the particles birth and 1 is the particles death. The UE4 documentation has great little section on this in their particle expression page so rather than give a more detailed explanation of the node I’m just going to link to their page here.
To demonstrate the node what I’ve done is replace it with a scalar parameter that will be manipulated in the material instance. The first use I’ve seen is to manipulate a sphere mask.
Here the PRT node is blending in between 2 values to make a circle bigger and the edge slightly harder. Which creates a circle in the middle of the particle as it gets older.
The use for this would be to plug it into the opacity node and have the particles fade from the inside out when they die.
Another example I’ve seen is using the time node to control the power of a texture distorting the UVs of another Texture. Here I’ve made a basic smoke material with alpha distortion using the time node.
As the particle grows older the distortion is going to change and make the particle look more warped.
3. Particle Random Node:
The particle random node outputs a random number between 0 – 1. There is a couple caveats about this. 1, it only works for GPU particles and 2, there isn’t any documentation about it. Unless you find out from someone else or just randomly stumble on it then chances are you won’t know it exists.
This node can be used instead of the dynamic parameter node. Since GPU particles can’t use the dynamic modules this really helps to make each particle different, which without the dynamic parameter is something that we are limited with. This setup I have below will output a random brightness for each particle between 0.5 and 10.
When put into an actual particle system it will output a diverse range of particles.
This setup will apply a random offset to the normal map being used.
The slight offset will help make the texture less recognizable.
4. Saving the main colour scheme into a material function:
Something I do a lot is relying on the particle colour node to drive the colour of my effects. However, if I’m working on a larger project with multiple particle effects, there’s no way to easily guarantee the colour modules will be the same. An easy hack to fix that is to define the colours that a collection of effects is going to be using and save them into a separate material function.
This collection, I made based off the one that belonged to the paragon character GRIMM.exe.
Inside each colour is properly labelled and ready to be used in a material. In the below setup we’re taking two colours from our function multiplying one of them by a random particle value and blending them together.
With this setup we’re using a powered vertical gradient and a darkened scrolling texture to lerp the hot colour on top of the cold colour.
5. Using the particle colour node as a dynamic parameter node:
As I mentioned earlier GPU particles can’t use the Dynamic parameter module which can drastically alter the diversity of the particles and make them look similar each time the effect plays. However, we also just had a section talking about using a material function for the colours rather than a particle colour module. That particle colour module can still be used, it still exists and it still outputs 4 separate values that can be used in the materials. With some clever wiring we can use that as a replacement for the dynamic parameter node. Now it does still have it’s draw backs, while it can have separate values the colour modules need to have the same overall way of dealing with that values, so for example you can’t have the blue channel be a uniform number and have the red and green channels change through a constant curve.
This node setup is meant to add heat distortion to a particle effect.
In this area the red channel is being used to control the strength of the emissive colour. The green channel is being used to control the scale of the normal map.
Further down the material the blue channel is being multiplied by the camera fade distance and plugged into the opacity plug. The alpha channel is being used to control the strength of the refraction happening.
I put this material into a particle system with a colour over life module set to these values:
When we put that in a level with general Porg-inov we get this:
The white fog is controlled by the red value which is hooked up to the emissive value and fading over time. The green channel is controlling the blue channel of the normal map making it stronger or weaker. At the minute it’s doing nothing because both values are set to higher than 1. The blue channel is what is controlling the opacity and the reason why the white mist is disappearing further up the model despite still being distorted. The alpha channel is controlling the refraction and is why the distortion is much stronger when the particle is dying.
6. Using a slight offset to make chromatic stars:
This is a fun hack that I would never think of doing before. We’re going to take 3 instances of a grayscale texture, offset the UVs slightly and then append them together to form an RGB texture. Those 3 channels together will form a chromatic star.
Using this we turn the grayscale texture below, into the coloured texture.
7. View based masking:
This technique comes from the radial blur refraction material. To me this was one of the cooler materials because of how it changes based on view direction.
The technique uses a Fresnel to mask an aura outside the main flare texture based on viewing angle. It’s a cool bit of maths and since it’s nearly Halloween I’m going to use it to make something kind of creepy.
I used some mega scans assets to build up this small scene, I’m going to make that white plane look like a pair of red eyes that when the camera pans around will reveal a hidden face. Ok less creepy more of a gimmick you would see in a rundown haunted house.
I grabbed a flare texture and a creepy skull from a google image search and packed them into two separate channels.
I then built this material setup:
The main effect is made up of 3 parts. 2 colours with high values blended with a small Fresnel dot.
That gets multiplied by a larger Fresnel with the glowing red eyes added on. The larger black core of the Fresnel will mask the two previous colours.
Finally, the effect gets multiplied by the skull to mask out the shape.
With the Emissive channel complete, I used a constant bias scale node to brighten the white parts of the skull, so I can use it as an opacity mask. Then when we put that onto the white plane in our scene we get this:
The perfect addition to a recreation of any dodgy haunted house in the world. Or something that would be great to creep out players in VR.
Those are 7 of my favourite techniques that I’ve picked up while rummaging through the paragon assets. There are so many amazing materials and weird maths going on in there, so I highly recommend looking through some of the character FX yourself to see what cool things you can pick out. Hopefully whether you are brand new VFX artist, or you’ve been doing it for several years there was something here that helped you out or at least gave you a smile. If you do find any creative uses for the things I’ve talked about here please email me a gif at – RichardVFXfanmail@gmail.com or tweet me @stokes_richard I’d love to see what you can create.
Check back in a couple weeks where I try to recreate some of the effects from The Avengers Infinity War in UE4.