2
$\begingroup$

I started by creating a simple Rubik's Cube and duplicating it several times into a collection and randomizing the colors for each face of the cube. I then added a plane and made a geometry to randomize a grid of the cubes. as you can see, the pink top is where the mosaic should go. I can add a realize geometry node and apply. But that will blow up my laptop from the amount of objects that came from the geometry node. The question I have would be is there a way I can keep it in the geometry node without applying it and display an image on the pink parts.

Blend file link with the sample mosaic image to display on pink: https://file.io/nKW1nJbDRhYu

I got the idea from a YouTube video (https://www.youtube.com/watch?v=2cztCIYmIjU&t=1619s) of the guy making Lego blocks and displaying it like a mosaic so I'm hoping I can kinda do the same thing somehow but by using the geometry nodes so I don't have to apply the node and crash my laptop.

enter image description here

I would prefer to find a way I can make this work by using the geometry node to make it happen. if there is another way that won't burn down my house from overheating, please let me know, but first I prefer to go the route I'm trying to do first.

I definitely recommend watching the video I posted above to see exactly what I'm trying to do. keep in mind in that video the guy is duplicating a single Lego piece in an array so it won't be stressful on my laptop, but each cube of mine is 27 objects joined to make a single object so when I make a mosaic out of 400 cubes in the end there will be a total of 10,800 objects once I apply the modifier and separate them by loose pieces and then selecting only the pink faces to UV project the mosaic only to those pieces. even if I removed the pieces of the cube that you don't see, there will still be a lag and hard time making my model from the 4,079 objects. here is the model after crashing blender a few times from doing it that way.

enter image description here

I deleted all the objects that you can't see, and this is the 4,079 objects that are left from the bottom view.

enter image description here

$\endgroup$
2
  • $\begingroup$ Hello. This is a very common problem in voxel world display. You don't want to instantiate every single cube since most of them will never be visible. You should use quads and instantiate that everywhere instead of complete rubik's cubes $\endgroup$
    – Gorgious
    Apr 17, 2023 at 18:40
  • $\begingroup$ Also, while it's typically harder to do, avoiding realizing instances is a difference between smooth or slightly lagging, and heavily lagging or outright crashing. $\endgroup$ Apr 17, 2023 at 18:47

1 Answer 1

2
$\begingroup$

Starting with the most basic thing, optimize your instances. The Rubik's cube consists of 26 smaller cubes. If you never want to animate them, then each small cube has at most 3 of its sides visible - the rest can be removed:

That's a corner-cube, which with the complexity as displayed on the right image, takes 108 vertices. Further removing one side for an edge-cube gets it down to 88, and removing one more for a side-cube (middle, centered on a side) to 56 verts.

There are some limitations of this technique: obviously your Rubik's cube no longer can be semi-transparent, as well as due to rounded corners you can now discover the optimization by peeking near the corners of the side-cube. This can be solved by adding a black triangle or quad behind the hole:

You can now manually build a Rubik's cube from these 3 objects as your building blocks, and spawn your Rubik's cubes, but then you will again produce unnecessarily much geometry, because not an entire Rubik's cube is visible in your setup. Since this answer is getting long, I'll just rush to the optimized solution - using just those 3 pieces as instances, with some creativity to rotate them properly:

This doesn't yet spawn the top, as it's the most trivial part (notice the only unconnected output socket, which belongs to Separate Geometry node, it contains the points to spawn the "middle" object - which you need to rotate by $90°$ around Y axis first). Here's a screenshot still without the top, so you can see no unnecessary geometry is generated:

So now I add the top, and modify the source of the instances (the 3 objects) to have only 2 materials: black and color, then add some shading that differentiates on Z to either produce a random Rubik color, or an image pixel:

How to fit your image/animation exactly onto the voxels:

Stadium Seating Letters

Here I play an animation that goes smoothly at 128×72 resolution:

enter image description here

$\endgroup$
4
  • $\begingroup$ Additional optimizations: obviously you could simplify the small cubes to just be 1 or 2 or 3 quads. The shader can draw black pixels on borders. Otherwise, you can assign a single material to entire small cubes, rather than dividing to black and color - again the shader may decide what's supposed to be black based on normals - this saves a lot of vertices, because while Blender reports the same number of vertices, internally it needs to duplicate vertices on material boundaries. $\endgroup$ Apr 17, 2023 at 20:16
  • $\begingroup$ I thank you for your hard work. pls don't delete this because I'll come to it in the future for another idea. I think I understand why you are suggesting making the cube over again to help with the computing and strain on the pc. but I plan to make pan out from up close and I prefer to make it as realistic as possible. @sweetpealowe on IG shows how much I prefer the real look. I figured I can make model mosaics faster than using real cubes. it also appears your cubes have the same sticker color according to the corner pieces in the sample video. I'm going to see if I can tweak my geometry... $\endgroup$ Apr 17, 2023 at 22:26
  • $\begingroup$ ... nodes more to randomize my colors more per instance of the cube while only keeping one cube in the collection instead of having 8 cubes to instance from in the collection with each having their own random colors. I think that may be my real problem. I have found how to still use my original setup and display a mosaic correctly (tinyurl.com/3eh2bjct) but using only one cube I can see a repetitive pattern in the random colors per instance of the single cube. $\endgroup$ Apr 17, 2023 at 22:30
  • $\begingroup$ @AlexWillis21 given some constraints like rendering time or RAM size, faking stuff will increase your realism. $\endgroup$ Apr 18, 2023 at 8:02

You must log in to answer this question.

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