+3 votes

Wanting to make a mechanic like Splatoon has.

  • 2D or 3D objects
  • can manipulate fluids in the environment that have their own texture (they would have a shader perhaps? idk)
  • if the fluids overlap with an object, it's possible to "paint" the fluids texture over the underlying 2D/3D texture.
  • There is a way to calculate how much of the object's area/surface area is covered by the fluid.
  • The functionality can account for multiple types of fluids and compare the results (top-most fluids win-out).

I'm not sure how you would actually program the "fluid sticking to object" and "calculate surface area covered" parts. Obviously you should be able to create a fluid dynamics simulation with Bullet or something (though I haven't learned how you would do that either)...

in Engine by (183 points)

I think I've found something that might be useful: https://www.reddit.com/r/Unity3D/comments/4y4jwf/recreating_the_splatoon_effect_best_way_to_start/

It's not a complete answer, but at least it shows where you should start.

Thanks, I'll look into this.

1 Answer

0 votes
Best answer

Quotes from reduz/Juan in the FB group:

"I would probably add something that maps triangles to UV and then have a manually unwrapped unique texture for the whole level where you paint. A 3D App can probably do such unwrap. You may need to do this in C++ for performance (using GDNative)."

"I think this needs to be done mostly in CPU and, at most, upload a texture to a shader to show different inks"

"You probably need to create a custom data structure for this on CPU, since you will need to splat around triangles and stuff.

I would use a BVH with triangles, and would store UVs for each triangle (you can search for how to build a BVH in a lot of articles).

you can raycast into the BVH to obtain a collision with a triangle, and then you can splat ink around by checking neighobouring triangles.

In the end all this works to splat on a texture where you store who owns the ink.

You can use the same when checking collision against the floor, to check who owns the ink."

"You will probably need to generate a secondary UV map (like, UV2) that covers all your paintable area in the scene and unwrap all your scene together. Blender can do this easily (just select all objects, press space and search for unwrap, it will unwrap all together to a single texture)."


So my understanding from that was that I have a texture broken up into tons of tiny transparent triangles. This texture is on all of the paintable materials wrapping the objects to make them paintable.

I could shoot a projectile of paint, have it "explode" a bit when it hits something, pop out a few smaller projectile CollisionObjects (bits of paint), all hidden within a particle effect. Then, when the bits of paint hit objects with a paintable material, I could grab the collision point, fetch which triangle it is on the paintable texture, and then color it and some neighboring triangles to simulate paint sticking onto the object.

This will do as an answer until a more detailed implementation can be made by someone down the line.

by (183 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.