3
\$\begingroup\$

I am wondering how one could implement "paint" in games. As a reference, I have two games I am specifically thinking about which are Super Mario Sunshine with its "goo" and Splatoon.

I'm wondering how I could replicate that kind of paint effect, where paint can be sprayed on to both the walls and floors of the environment, and on to objects.

\$\endgroup\$
4
  • \$\begingroup\$ I just reformulated the post so that it hopefully can be reopened. I take all the blame for it being put on hold since I didn't read through the guidelines before I posted. Sorry about that. \$\endgroup\$
    – Ellie
    Dec 20, 2016 at 18:41
  • \$\begingroup\$ Okay. I trimmed some speculation about possible solutions from your query, since generally we prefer you don't do that and simply let somebody use that as an answer. It would be helpful if you could find some good screenshots that highlight the specifics of your desired result, as well. \$\endgroup\$
    – user1430
    Dec 20, 2016 at 18:45
  • \$\begingroup\$ Problem with that is that you essentially stripped half of my question. What I meant to accomplish with the speculation was to clearify some of the challenges with implementing a system like this. The question as you made it is essentially just asking for basic graphics painting, which is far from what I was wondering about. I wanted to know how you would send over the paint to the CPU efficiently too for example. \$\endgroup\$
    – Ellie
    Dec 20, 2016 at 21:39
  • \$\begingroup\$ I think you're going to get far more bang for your buck adding a screenshot or two, but if you want to include clarifying technical constraints that's fine. Our goal in removing "suggested approaches" from questions is to avoid your time being wasted, in the long run. When a question includes text like "I was thinking of using a framebuffer effect, is that okay?" then "Yes." is a valid answer, if largely unhelpful because it doesn't talk about how. If you feel my edits were too severe you are welcome to put back the information you feel is most relevant. \$\endgroup\$
    – user1430
    Dec 20, 2016 at 22:12

2 Answers 2

6
\$\begingroup\$

Valve reports that for the gel-splatting in Portal 2, applying individual decals for each splat would have become too performance-intensive.

Instead, they re-used the second set of UV coordinates generated for all the level geometry as part of their lightmapping process. This second UV channel unwraps every triangle of the level to a unique portion of the lightmap texture. By creating a "gel map" texture, they could use these UVs to overlay gel onto any of this geometry. To paint a particular spot on a wall, you look up that spot's corresponding texels in the gel map texture and set them to your paint colour.

This was based on Tag: the Power of Paint, where the levels were small enough that this map could be displayed directly with reasonable resolution, so they could stamp detailed splatter patterns into it directly.

For Portal 2 with its larger levels, this map's resolution per world meter is relatively low. To mask the artifacts, they combine this with a tiling normal map for the surface of the gel, which has a blotchy pattern in the alpha channel. By mixing this alpha with the falloff from the gel map, they turn the gel map's low-res bilinear interpolation falloff into a more detailed-looking splatter edge.

I wouldn't be surprised if Splattoon uses a similar technique. When you expect to be painting a large percentage of your level, applying it as one consistent layer tends to scale better than applying large numbers of overlapping decals.

\$\endgroup\$
1
  • \$\begingroup\$ This was exactly the kind of answer I was hoping for! I didn't even think about portal and its gel. Thank you very much! \$\endgroup\$
    – Ellie
    Dec 21, 2016 at 0:19
1
\$\begingroup\$

Without some images or mock-ups of what you want the desired result to be, my first guess would take use a splatter image as a texture & then project it as a decal.

The basic steps are:

  • set up the projector
  • crop your triangles so that they don't extend past the projector
    • transform the triangles from world space to projector space
    • crop them
    • transform them back
  • apply your texture to the projected texture coordinates
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .