Want access to this effect? Let me know in the comments below 👇 & I’ll make it available!
What is this?
This is a test scene showcasing a shockwave impact shader with a fairly simple vertex deformation based on the player’s position made with shader graph and scripts then played back through the animation timeline in Unity URP.
I started by using Unity’s Pro Builder to make a high poly plane mesh on which the shader is applied. With a script on the player I output a vector3 of the transform’s position in Update which is sent to the shader which then gets the distance between that point and the absolute world position of the mesh’s vertices and offsets those vertices on the Y axis. This offset is based on a radius around the player which is then smoothstepped to create a second minimum distance radius, making a ring. Further smoothstepping smooths out the ring and we can use the distance from player data to fade out the effect. Colour can be multiplied with the effect and plugged into emission. The result is transformed from absolute world place back into object space and fed into the vertex position on the PBR master.
With the max ring distance, vertex smoothing, shockwave width and intensity values exposed, an Animator component can be added to the plane and you can animate a shockwave being created, swelling and expanding before fading away.
The next steps are to play the shockwave anim on the plane with a script which detects when the player has collided with the ground with a little camera shake provided through Cinemachine’s impulse listener.
When the collision is detected, debris particles are spawned at the contact point. These are a prefab which uses three particles system. The first is low poly rock meshes as the particles spawned, with world collision enabled and a gravity modifier applied. It’s a cone shape with the size random between two constants and colour over lifetime fading out the alpha. The second system is a wider cone with simple spark particles with trails on them, size decreasing over lifetime and noise added to the movement. The last particle system is a very short-lived sphere emitter, growing larger on all axes, with a -360 to 360 random start rotation and rotating between 180 and -180 degrees to add more randomness. The particles for this are very small and have an electricity effect shader applied to their material.
Features:
- vertex deformation
- animated shader values
- scripted shader
- Cinemachine
- ProBuilder
- procedural generated VFX
- rigidbody character controller
Credits:
Shockwave Tutorial from Phi Dinh – https://twitter.com/phi6/status/1257714254532280324
Player model from Unity Technologies – https://assetstore.unity.com/packages/3d/characters/robots/space-robot-kyle-4696
Player Animations from www.mixamo.com