I did up a degauss unity image effect for Incapacitor. During one of our meetings, we were talking about the feedback we would use for the player taking damage, as they are a robot we would not be able to use the default CoD blood screen. I have played SOMA, as you may have read about in previous posts, and *spoiler* the player is a robot. The damage feedback for the player in that is a glitchy, degauss-like visual interruption, with lots of chromatic aberration. I showed the team what the old CRT monitors looked like when they were degaussed, (example), and the team was very interested in having something much like it in our game.

I used a base Image effect shader by Steve Halliway (here) to skip the setup process, and incorporate the built in unity image effects for chromatic aberration and rendered vortex to help add to the overall look. I have changed the vortex effect so that it renders pixels from outside the source image as black, so the default one won’t look quite right.

The main thing that I did was run each of the colour channels through a sine wave, at different offsets, after offsetting the current reference pixel position by a base sine wave. This is done in the shader, and the timing for the sine is sent through the image effect script. This image effect script is used to allow easy adjustment or dynamically controlled strength of the effect itself. I split up the controls for the wobble strength and effect time, colour strength, chromatic aberration and vortex twist strength. This will be able to work for small to large damage effects.

Currently it isn’t doing a rotational wobble very well, my next goal is to add a stronger twist that over-corrects, and has a stronger twist the further from the centre of the screen it is (the unity vortex works in the opposite direction). I have also been asked to add a ‘static’ effect. I need a better description of what is required before I start designing for it, but that will also be put in.


Bezier Spline tool!

Here is where I found the tutorial to help me make this

Here is the repo link containing the Unity Package

This is what I learned while making it
First of all, I need to thank  Shaun Allen for helping me with figuring out how to export a package in unity, all you have to do is download a single file and import it in Unity, exporting has an automatic dependencies option, so you just select the main scripts and/or prefabs you want and it also selects anything else it requires to run. It’s good practice to remove anything that is not critical and include instructions on how to use the tool, especially a video tutorial. You should bury anything that isn’t used directly by the user, and ensure you set up useful folders and names. Also, comment your code! If something doesn’t work, or someone needs to change the scripts to do what they want, you can save a lot of time through commenting what everything does, what it talks to and why, and this will also help people learn how to set this sort of thing up themselves. I haven’t set up any comments in this myself, as this is the first time I have created a tool and the script itself is fairly complex, I still need to work through everything to fully understand the inner workings, so keep an eye out here for an updated version in the future.

In doing this, I learned a few things about creating tools in unity, like GUI functions and how to create an editor panel. Enabling the use of ctrl+z, and getting unity to ask if you want to save your changes when you try to close it after making changes to the spline. I even tested creating my own contextual buttons, which worked but had trouble with the script itself (I was trying to insert points to the middle of the array of points, but there are a few arrays that stopped functioning correctly, this is why I need to work through it again)
I was also made aware of other types of curves available other than bezier. The problem with a bezier curve is that to shape the curve, you need to pull its point around a lot further out than the curve sits, the problem here is that the curve never intersects a point, and is, therefore, difficult for a person to use.
The scenario would be that the curve is being used as a path for a camera, which needs to hit a very specific point or even several. On a Catmull curve, for example, the curve intersects each point which are what gets placed by the user. This is very precise, and the tool I created also does this (as this is a spline, every 4th points is intersected by the line, with the two points in between controlling the curve of the path). To control the curve, there are two ‘rotation’ handles surrounding the main handle, this is what controls the angle of the curve and speed of movement along the path.
Here is the maths behind a bezier curve. We should be using a simplified version of the cubic bezier curve.

Things I learned from playtesting the tool
The tool controls are fiddly. If you click off it, it deselects, which is some bad ‘player feedback’, and is too easy for this to happen as the handles on the tool are very small.
The handles need to have an adjustable size, this way people can decide what works best for them, as if it is too big, it will obscure too much of the scene it is in.
Its a little hard to know how to use the tool right from the get go, as it requires several scripts on separate game objects. this is mainly run through in the instructions, but thats also a wall of text, no one reads instructions anymore. A good way to fix this is to create a prefab on the top level of the hierarchy, to easily pull into the scene a working example of its functions, a demo scene of all the cool things it can do, and a tutorial video running through the correct set up of this scene.