Download

Recreating lo-res pixel image with individual cubes

Hi there, first post in this forum :slight_smile:

My idea is to create a kind of Pixel Art game with the “pixels” being simple cube meshes. I started preparing this by importing a NES style screenshot as a texture, placing this on a cube and scaling it so each pixel has the size of a default spawned cube. Then I created materials for the individual colors of the original pixel screenshot and started to place a cube of the matching color on each screenshot pixel, so in the end I’d have the entire screenshot recreated with cubes as pixels.

However, I quickly realized this method will require a gigantic amount of redundant manual work where probably a rather simple script could do it within seconds or minutes if it spawned the cubes and set their color and relative position according to the source screenshot. As I started working with blueprints only a few weeks ago, I’m afraid I have no idea how to go about this, so I thought I’d share it with this community, where I’m sure somebody could help me figure out the possibilities…

Did any of you ever do/plan something similar? Might it be possible to do the pixel-to-cube transfer inside a blueprint?

Rama’s got a node that will read an image pixel by pixel to an array.

yeah it’s fairly easy to do this using Rama’s plugin. But note that it’s not very efficient, I used a 3232 texture below, that’s 1024 meshes, 6464 would 4096, meshes, each with their own material instance. Even at 32*32 you will notice a lag when moving the blueprint. Obviously the below could be made more efficient, using instances could work, but you’ll need to know your color palette.

f5606705d730920d517f16bc0a24d09826f7b409.png
CubeSize is the size of the cube mesh, mine is 101010. The Victory Get Pixel T2D is Rama’s node from his plugin https://forums.unrealengine.com/showthread.php?3851-(39)-Rama-s-Extra-Blueprint-Nodes-for-You-as-a-Plugin-No-C-Required!

The texture:
fa963d0c7ff6be2eeae1fb5965493a78eca88a22.png

Result:
50Zxnb8.png

Just so you can see they are actually cubes…