Slime Time!

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.

Goals:

  • Create a system to paint and clean on any surface, inspired by Super Mario Sunshine, Splatoon and Powerwash Simulator.
  • Experiment with Render Targets.
  • Create Slime Shading.

Paint system

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.

How it Works

  • Slimes, Paint gun or Water gun hits a paintable object and tries to paint or clean it.
  • Paintable object uses Function Library Paint, which requests a render target from Game State to draw.
  • Game states checks if that object has an associated render target. If it doesn't, create a new one and store it as an Object->Render target map/dictionary.
  • Function Lib draws to the Render Target using a colored brush material.
  • Paintable Master Material uses the render target to mask where Slime should and should not be.
  • Paintable object's material instance inherits from the master material and slime is rendered in the right places.

Slime Material

  • Triplanar World Tiling Material for Slime in the Master Material using a mask from the Render Target.
  • Non-slime areas can still use regular non-triplanar textures.
  • Tiling Slime Albedo and Normal textures made in Substance Designer.
  • Color tint comes from the Render Target.

Splat shape used to paint on the render target is also made in Substance Designer

Color Smuggling in the Render Targets

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.

Slimes

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.

Vertex animation

  • The mesh is just a regular ball
  • Signed Distance Fields (SDF) find the distance to the nearest surface and then use Vertex offset to stretch the mesh towards it, resulting in slime-like behavior.
  • The eyes are just emissive spheres to give it a little bit more personality.

Material

  • Uses the same textures I made for the wall/floor slime and pans it from top to bottom.
  •  Fresnel function for opacity at the edges to make it seem thick and viscous.
  • Hue shifted color to more easily control the random color setting on spawn.

VFX Breakdown

Water Spray

Material

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.

Water foam and Paint splash

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.