Recently I came across some cool Lego mosaics on Reddit and decided to make my own. I started out using Houdini to generate and render them but later decided to replicate the work in Unreal Engine. This first set of images was rendered using Houdini Mantra:

Unreal Engine 4

I originally decided to port this project over to UE4 because I was tired of waiting for renders to finish. As it turns out, it's also pretty cool being able to run around the mosaic from an ant's point of view.

The Process

I created the base Lego brick using a simple combination of a box and a cylinder. 

LegoSides.gif
LegoHeight.gif

I then used Substance Designer to create a basic paint texture with subtle brush strokes, bubbles, and scratches which I observed in online reference of real-world Lego blocks.

As it turns out, the "pixelizing" of the image is quite easy to accomplish with just a simple down-res and up-res of the image while making sure that the image is not cleverly filtered with some nearest-neighbor interpolation scheme when being up-sampled again. In Houdini I used a basic COP network to do the pixelizing, but when implementing it in UE4 I realized that I could accomplish a similar effect by just fiddling with the UV coordinates during the texture lookup.

The material network for the "pixelizing" effect in UE4. I had to use customized UV coordinates in order to extract the world-space position of the instanced static meshes. 

The blueprint for generating the mosaic geometry had just a single instanced static mesh component and I used the scale factor from the pixelizing effect to determine how many blocks to generate.

I used instanced static meshes to render the individual blocks since I knew there would be many of them and I wanted to minimize draw calls for performance reasons.

It occurred to me to use Houdini Engine inside of UE4, but the way I originally structured my .hip file wasn't very conducive to creating a nicely packaged HDA. I made heavy use of image processing in a COP network and the takes system for overriding certain values for renders. I also experienced quite a bit of instability, presumably due to the COP network, so I wanted to avoid it and would have re-implemented a portion of the logic inside UE4 anyways. 

Future Work

Currently I'm only creating single blocks per pixel, but it'd be cool to consolidate contiguous blocks of the same color into larger blocks (2x2, 4x4, 2x4, 1x4, etc.) in order to get a bit more segmentation and visual interest out of the mosaics. 

I'd also like to create a lenticular mosaic which displays two separate images based on viewpoint. 

Comment