Color mapping intrusion depth onto the mesh

The idea that I implemented is for a cone penetrating a sphere towards its center. If you want to use other objects, e.g. a spoon penetrating a block of tofu, then the idea will not work. It is important for you to fix the initial conditions and then to look for the simplest solution for these conditions. Looking for the most general solution may be overkill.

  1. CSG is slower, but you can use other shapes, not just cone and sphere. There are CSG implementations that are rather fast nowadays. For some of them you can find info in this forum (e.g. three-bvh-csg)

  2. Yes, it will be harder, but you can also modify the UV coordinates of vertices, so that it looks good. The alternative is to move the coloring in a custom shader.

  3. Conceptually, your idea is OK. This is how some algorithms for shadows work. However, it will take a lot of debugging until you get it working well.

In any case, good luck with your project. I’ll be waiting for some promising results.

1 Like