How you would implement wet and dirty materials or material overlays that you can clean like in PowerWash Simulator.

  • 4
    \$\begingroup\$ Welcome to Game Development! There is a lot of things missing from your question: what have you tried so far, why did it not work? what technology are you using to make your game? we're not familiar with PowerWash simulator, you need to add one or two screenshots or a link to a video showing what you want. \$\endgroup\$
    – Vaillancourt
    Jul 16 at 13:29
  • \$\begingroup\$ This is basically like the painting effect in Splatoon or Portal 2 in reverse: your level starts off already painted, and instead of adding paint to the surfaces, your tools clear the paint mask to show the surface underneath. So you can search for a tutorial for painting effects in your engine of choice, follow that tutorial's steps to the end, and then invert the paint mask to make it a cleaning mechanic instead. Try that, and ask here if you run into trouble with any specific step along the way. \$\endgroup\$
    – DMGregory
    Jul 16 at 13:32
  • \$\begingroup\$ How much do you know about shader programming? How much do you know about programming in general? \$\endgroup\$
    – Philipp
    Jul 16 at 13:39
  • 1
    \$\begingroup\$ Hey, thanks for your comments. So I'm not developing a specific game but I've heard CG this term in university and asked myself how this works in games like PowerWash or Splatoon. I know a lot about programming in general but never worked with 3d graphics before touched GLSL shaders for the first time in this course. \$\endgroup\$
    – hefe
    Jul 16 at 15:14

I've never implemented any of this stuff before. But from my understanding there's two basic ways you could solve this problem.


The simplest solution would be to just to just put simple billboards with "wet" or "clean" materials on top of the surfaces. This has the real world equivalent of placing an animatable sticker on top of surfaces. This works great for when the effects your placing are small, and self contained (they don't need to interact with other entities of the same type to achieve their desired effect). Bullet holes, in FPSs, are ideal candidates for decals. As soon the effect needs to know where it is on a surface, or know about other nearby decals, or must curve around complicated meshes, you're out of luck unless you make your decal system much more complicated and likely much less performant.

fps bullet hole decal example

Textures and an alpha mask

What's probably happening in PowerWash, is that there are two sets of textures for every cleanable object, and then a texture mask which determines which set are visible and where. When you power wash something, you're simply coloring the alpha mask from white to black (or vice versa) which changes which set of textures (dirty or clean) are visible. From a technical POV, the hardest part of this technique would be the projection from 3D world space to 2D texture space when you have to find out where on the object's texture you're spraying.

power wash capture


There seems to be more complicated effects happening in PowerWash which adds to the main effect. When you spray objects, they seem to briefly become wet, drip, and then dry. There's probably another texture which represents the wetness of every object, which gets set by the powerwash but then fades back to its original dry state (texture value) overtime.


This method is much more powerful because you have access to all the mesh and textures of whatever object you're on (unlike with decals). But it means you have to have duplicate sets of textures for every object which could get very expensive.


DMGregory mentions that there's ways to reduce the memory cost of this approach by tiling and re-using materials

  • 1
    \$\begingroup\$ Note that these textures can often be tiling materials that are re-used across large surfaces or between different objects, cutting down the expense of the multi-texturing approach. \$\endgroup\$
    – DMGregory
    Jul 16 at 16:38
  • \$\begingroup\$ Thanks for your detailed answer! Let's assume we would write the shaders ourselves. Couldn't we just give the fragment shader, which does the texturing and puts the "dirty" texture over the normal texture, a value for each vertex to indicate whether it is still dirty or has already been cleaned, and then put the texture over it or not? I mean, the calculations of the intersections are of course complex, but for a trashy game that could be sufficient, or not? :D \$\endgroup\$
    – hefe
    Jul 16 at 18:19
  • \$\begingroup\$ @hefe You could definitely add extra vertex attributes to encode a vertex-based alpha mask. That's actually a common optimization technique (texture -> vertex attrib) that's used in open world games when certain objects are really far away. But if you do this always: you're then coupling the resolution of the effect with the mesh geometry though, which is probably not desirable. This would mean a simple cube would have very very low resolution (8 vertices), while a character model would have a multiple order of magnitude higher resolution (potentially over 10k vertices). \$\endgroup\$
    – Charly
    Jul 16 at 20:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.