Preamble: I'm attempting to make this tool to "blockify" any model that's tossed into it. Its goal is to turn the model into a Minecraft block structure. So far, it works perfectly for the basic function of building the pseudo-voxels. I can export this model and run it through other pieces of software to turn it into a usable format for placing in the world.
The Problem: I still want to add the ability for each instanced block to inherit the material from the faces (or vertices) of the original object that they are touching. Right now, I have a custom Suzanne with two materials applied, but it doesn't seem possible to do this without explicitly assigning the materials by hand or making bespoke changes for each new object I'm trying to convert.
The Question: Is it possible with the current geometry nodes to transfer materials to individual instances via proximity to the faces of another object? I plan on having dozens of materials, so I want this tool to assign them in the most generic way possible to avoid having to make any unique changes to the original object or the node network.
Here's what I have so far: Blockify01 (animated)
Here's what I want it to do automatically:
Update 04/09/22: Just to clarify, I'm not spawning these instances on the faces of the object. Instead, I create a cube volume of equally-spaced points and the input model is what selects which of those points to spawn the cube instances at. This is to ensure that the end result is made at a specified resolution and there are no overlapping instances.
Update 2: It seems to work now! Many thanks to Chris and Robin Betts for bringing forth some key pieces to this puzzle. What I have now is a combination of their suggestions Of course, it is a bit janky. The material slots on the target object must contain all the materials in the node network and in the same order as the nodes. Also, it doesn't seem to apply the materials to mesh primitives created by nodes, so an external block object needs to be used.