Any way to make an object that changes the material of the object behind it without compositing?

To better explain it, i want to be able to use a sort of screenspace mask that will use the shape of the plane as a mask that will apply an override material onto the sphere. The mask should be able to change color as well as metalness/gloss values of the sphere. If anyone has any leads i can follow, id appreciate it. This example was made with compositing nodes btw.

you can use animated boolean modifiers with different copys of your model. and using show hide animations.

Blender file:
Bool_Trick.blend (850.1 KB)

It’ll be a little bit uggly on the borders so you have to tweek and split with modifiers like edge split

If for Cycles, you can try giving the plane a 1.0 IOR refraction BSDF. Then, you can use light paths/is transmission ray to mix between materials (well, between node groups inside of a single material.)

Note that there are plenty of reasons why this might not be what you want. If you’re using other transmission materials, they’ll do the same mix. And consider that reflections (incl. light bounces) won’t necessarily do what you want (although they wouldn’t with compositing either): if you put a mirror off to the side, it will reflect the “blue” sphere, not the masked blue-and-red sphere.

I don’t believe anything similar is possible for Eevee-- for it to be considered, the plane has to be “rendered” after the sphere, at which point rendering data like world pos no longer exists for the sphere.

If you want to try skuax’s boolean trick, it can be difficult to make a procedural projection mesh. (Unless your plane acts as if parented to the camera, then the projection never needs to change shape.) Maybe it could be done with some armature tricks, I’m not sure. You can fix the normals by creating a third copy of the sphere, non-rendering, with no boolean, and use a data transfer modifier to copy normals from it to your booleaned meshes to handle the edges.

huh. Thats pretty interesting. I’ll give this one a try. THANKS!

Why not a TransparentBSDF, and check for Light_Path.Transparent_Depth > 0? :slight_smile:

That’s probably simpler, yeah :slight_smile:

Figured out how to make a dynamic projection mesh, demonstrated in projectionmesh.blend (593.1 KB)

Involved a bug report and some work arounds. Manipulate Cube-- it’s designed to always create a shadow volume behind it (from the camera POV in that file).