Mario Sunshine paint effect

Always more theory based questions to see how people would do things!
What do you guys think would be the most efficient way to code the paint mesh as seen all over Super Mario Sunshine? (which was probably coded in C++ so it's on topic kind of).

It looks like they use bitmaps to store if paint exists or not -- which is fine. Reminds me of texture splatting for terrain.
http://tcrf.net/Super_Mario_Sunshine
http://tcrf.net/File:SMSpollution00.PNG

But I don't understand how you go from something like that to something with full collision/ability to destroy any part of it "without" using thousands of triangles (which just could be the answer), the Gamecube wasn't amazingly powerful though. As shown here it's not just a simple shape cut out of it each time http://puu.sh/cGuqS/4a046b0c4a.jpg. Any ideas?
Two texture layers: one normal and second "pollution" one. Removing or adding pollution is as simple as changing transparency of second layer.
I understand that if it was done entirely in a shader, you could just read that bitmap to see where to place it then you wouldn't need 1000 vertices to make it look good.

But you can't handle collision in GLSL (well...you can but I doubt they did) so that is where I get lost. Not sure if I'm missing the point?
Last edited on
But you can't handle collision
Which collisions? I did not play Mario Sunshine, so I do not follow you here.
Are polluted parts somehow change collision mesh of the terrain?
My mistake, I shouldn't assume everyone has played every Mario game ;). Didn't want opening post to be too long though.

Touching any polluted part will hurt you (eventually) and it seems to be very accurate. You can clean 99% of it away and it will still register the tiny part of the texture that is left. Maybe it is using bigger triangles for it and I'm just not seeing it?

In my head it's doing something like if(TextureRightBelowYou == Polluted) GetHurt(); but it doesn't make any sense to do that on a tiny level.

The quantum of pollution can be seen in provided screenshot. It is not really large, but it is not tiny either. I suspect that maps are not really large and something like 1024x1024 alpha texture would be enough. Additionally you only need one byte per 8 points (as it is probably monochrome). This would be only about 128kb of memory used. It can use something like quad-trees to further decrease amount of stored information.
Right, I think the images are 512x512 and there are several for each "world".
I guess quadtrees would help but if you are generating a triangle for each white pixel it would be 36 bytes for each triangle (3 vertices each with 3 floats). That would add up pretty fast with a 512x512 image if there was a lot of pollution.

Of course the shader wouldn't care about all of those triangles, they are only there to see if you hit them or not.

EDIT:
I guess if you split the map into chunks very carefully you could just use a 2D array and check each grid cell without any interfering terrain above it etc. Thanks for the ideas MiiNiPaa.
Last edited on
Topic archived. No new replies allowed.