3
$\begingroup$

Goal

The yellow color should only appear within the area where the water droplets contact the purple wall. Consequently, the wall area outside of the water droplets should be purple; and the wall area inside of the water droplets should be yellow. (Cycles rendering can see inside the water droplets) enter image description here

Hint

After reading the previous post and hours of experimenting by myself, this is too difficult for me, because through the View node or through Spreadsheet, it is still hard to understand what those nodes are actually doing. And it is also harder to debug a node-based program than debugging regular a text-based program.

Hint 2

It seems that using Geometry Proximity is only able to find the intersection between the faces of the droplet and the face of the wall, and can not compute the intersection between the volume of the droplet and the volume of the wall. Can Raycast do that? So far I don't know.

$\endgroup$

1 Answer 1

2
$\begingroup$

If you use Boolean Mesh, you can not only sum up the area of mesh islands but also create such geometry, that there's a separate shader for the insides of the droplets, getting rid of the problems of detecting distance to an edge:

Shader can now use the area attribute:

With the result:

$\endgroup$
3
  • $\begingroup$ The intersection area can even have a gradient color, which changes according to the position of the droplets! What a really nice answer! However, nothing is perfect - after the boolean operation, lots of N-gons are generated, so that the topology becomes messy, and computer performance becomes rather slow as the number of droplets increase. It would be better if the intersection area changes color, but no geometry is actually cut by boolean. The shader editor receives the corresponding color info, and that is all it needs, and actually cutting the geometry is costly. $\endgroup$ Commented Jul 26, 2023 at 4:33
  • 1
    $\begingroup$ @BlenderLake You can get rid of ngons by… Triangulating 😜 " It would be better if the intersection area changes color, but no geometry is actually cut by boolean." - it wouldn't, as I hinted at the very beginning. You need to somehow pass the information about the shape of intersection to a shader, and really the 'pipeline' (the way in which you can pass that information) doesn't allow to do that precisely. So splitting the geometry absolutely is the correct solution here. Not necessarily Boolean, I could figure a more efficient algorithm… $\endgroup$ Commented Jul 26, 2023 at 6:55
  • $\begingroup$ As for the edit, my comment better fits the question, e.g. there are no intersections of the droplets in this example, which I ensured to limit the scope of the problem. Similarly with the boolean, the answer aims to show the possibility, not to tackle the problem performance-wise. Cheers! $\endgroup$ Commented Jul 26, 2023 at 7:02

You must log in to answer this question.

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