I have a sphere intersecting with a plane -- I would like to be able to use the occluded portion of the sphere as a mask, or to appear in a particular colour or pattern. Is this possible in Eevee?
-
$\begingroup$ Does the plane need to be visible? Does it need a texture? $\endgroup$– BenusCommented Jan 23, 2022 at 0:06
-
$\begingroup$ The plane needs to be visible, the intended behaviour is as the sphere passes through the plane, the portion of the sphere that is behind the plane is sort of x-rayed into view $\endgroup$– JoshCommented Jan 23, 2022 at 0:30
-
$\begingroup$ is this going to be a still render? $\endgroup$– AswinCommented Jan 23, 2022 at 0:32
1 Answer
EDIT: Removed old answer completely as it was overcomplicated. This solution uses cryptomattes which I did not know is now supported in Eevee!
Duplicate the sphere and assign a different material. Create an empty and animate that through the plane. Snap the two spheres on the empty and parent them to it.
Create two collections. Place one sphere and the plane in one, place the other sphere in the other. Go to the View Layer panel, check the Cryptomatte > Objects box. Create a new view layer on the top right and copy settings. In one view layer, disable one of the two collections, and in the other view layer, disable the other collection.
Now in the Compositor, make the following node tree.
-
2$\begingroup$ Mind bending animation, I definitely have to play with this... $\endgroup$ Commented Jan 23, 2022 at 1:29