1
\$\begingroup\$

Im trying to paint an object partially from a raycasthit so it looks partially painted like in Splatoon or e.g.

Is there a way to get this working in 3d, without creating a new gameobject everytime? And is there a possibility getting the pixels of a texture in 3d to calculate the painted percentage of the object?

I tried using 2D sprites and get the pixels from a raycasthit2d, but it didnt work out well. Has anyone an idea? Or has anyone an example for this?

I found some examples on grafittis and footsteps but they are either too old or dont fit...

\$\endgroup\$
1
\$\begingroup\$

You could use a black texture and for example with compute shader, paint pixels white aroud position you want to be painted, then in fragment shader you would just multiply color you want, by color from this texture. And for percentage, just have a counter of pixels that you painted white and divide it by texture resolution^2.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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