I was inspired by one of my childhood favorite games:
Super Mario Sunshine, as well as Splatoon and Powerwash Simulator, to create a system for painting and cleaning on different surfaces using some form of paint gun and/or power washer. This resulted in Slime Time!
Made in 3 weeks half-time using Unreal Engine 5.6.
I dynamically create render targets for each mesh I want to paint on and match it to the object's UV map to create a mask where the paint should be. This could get expensive if both the level size and the render target's resolution get too big, but it works well in a small area.
Splat shape used to paint on the render target is also made in Substance Designer
The Render Target can be drawn on, but not erased from. This means I can use the RGB channels but not the alpha channel. So I use the R-channel for the mask where slime is painted/not painted. This means I only have the G and B-channels left, which is not enough to store a full RGB color on the render target. One way to fix this is to have two render targets, one for mask and one for color, but that can be very performance-heavy when using as many render targets as I am already doing.
So I came up with a different solution! I convert an RGB color to HSV-color and and store the H (hue) in the G-channel and later convert it back into an RGB color in the Material. This means I can store a color in the render target with only one channel. However, I can't store black, white or grey, but since I want the slimes to be vibrant and colorful, this is not an issue. B-channel is still available for future features.
The idea of having slimes came a few days into the project while researching Signed Distance Field (SDF) for the Water Shader in Maruk: Shipwrecked.
I learned how I can animate slime-like material using SDF and vertex offsets, and thought it would be fun to add them as enemies to move around and paint slime all over for me to clean up.
I later added different colors for them, which creates a beautiful, chaotic mess for me to clean.
Their AI is very simple. At random intervals, it picks a random direction and starts moving. I added a random jump to better showcase the SDF animation and they also jump when hitting a wall.
I use a caustic noise I made in Substance Designer at different scales, panning at different speeds, together for the texture. I also use my trusty old slime texture to create some nice wavy UV offsets for both of them. The slime texture is also the basis for the vertex offset, which I combine with UV to make waves increase the further out they go.
I use basically the same technique for both the water foam and paint splashes, which is a bunch of alpha eroding spheres. In the paint version, I change the color depending on the color of the projectile.