Is there a way to do an "slice boolean"-type effect with just geometry nodes and/or material nodes?

Something like the below image, but done either with geometry nodes and/or material nodes. The actual boolean modifier is not desirable here since it requires the affected mesh (the solid cube) to be multiple meshes, where as I'd like it to just be a single mesh.

$$\text{Using Two Materials}$$

Result:

Geometry Nodes:

What the nodes are doing here is calculating the intersect and difference boolean operations and then selecting a material for each before joining them and merging by distance.

It also deletes the internal faces using an anonymous attribute added to the faces of the second cube:

$$\text{For a Single Material}$$

Geometry Nodes:

Naming Attribute:

Single Material:

Here we're adding a boolean attribute with a true value to the resulting mesh from intersect and then passing it to the material using a output attribute.

Remember to set the attribute domain to face:

• Good solution +1 The only thing I would change is using a mesh primitive inside Geometry Nodes for the effector cube, moving it around with a Translate node or something... Because an external cube is not wanted, or at least that's how I understand this sentence: "boolean modifier is not desirable here since it requires the affected mesh (the solid cube) to be multiple meshes, where as I'd like it to just be a single mesh" May 18 at 7:06
• @GordonBrinkmann I think that this sentence refers to the fact that, to get the same results with only boolean modifiers, the solid cube would need to be two objects, one with intersect boolean mode and another with difference mode. But now I'm not so sure as i was. ... Better wait for the question's author so we can find out the exact meaning. May 18 at 7:29
• Oh, I guess you're right... but still it sounds a little confusing. I actually thought when I wrote my comment, there would be a possibility to assign different material slots to different parts of the boolean result. Like the Solidify modifier where you can give the new faces and the rim new materials or with the Cell Fracture tool where you can assign a material to the inside faces. But now that I'm on a PC and opened Blender I realize, this is not the case. So I think you are correct with your assumption. May 18 at 8:18
• Yep, apologies for the confusion. I meant just for the cube that's getting sliced, since using the boolean modifier requires that cube to be split up into 2+ meshes, I am still fine with using another mesh as the actual cutter. May 18 at 9:04