Procedural Houdini LEGO-ifier to convert any mesh into a model of LEGO pieces with a variety of shapes and sizes as well as accurate color. The LEGO pieces included are as follows:
- 2x2 brick
- 2x1 brick
- 1x1 brick
- sloped brick
- flat 1x1 brick
- flat 2x1 grill brick
The Houdini file includes controls for a user to customize brick size, frequency of "top" (flat) bricks being placed, and angular threshold for placing sloped bricks.
LegoDemo2.1.mp4
- The group of points encompassing the mesh are determined as follows:
- (1) VDBfrompolygons node -> ConvertVDB node to compute closed volume
- (2) Pointsfromvolume node on bounding box of mesh
- Create group of points by taking all points in (2) that are inside (1)
- Blast all points outside of group
- Attribute transfer Color and Normal point data from the mesh to the points
- This requires using attribfrommap node and texture file to convert primitive material attribute to point Cd attribute
- The normal data is corrected with VEX code (explained further)
- After getting the group of points, they are partitioned based on their location
- Partitioning "angled" points involves a VEX function determining the difference between the transferred normal data and {0, 1, 0}.
- Partitioning "top" points involves a VEX function querying every point and whether a point was above it or below it
- Prioritizing larger bricks over smaller bricks requires a for-loop
- Iterates over each point, adds a single point for each desired block-shape bounding box that fits
- For example: iterate over points, if point fits a 2x2 brick along with 3 others, it is added to the final group & the other 3 are removed
- The desired brick is then copied to this group with copytopoints node
- Node parameters:
- Brick Size is a parameter for particle separation from Pointsfromvolume node
- Range: 0-0.3
- Slope Threshold is a parameter for how far the normal separation from {0, 1, 0} has to be for the slope brick to appear
- Range: 0-1
- Top-Brick Percentage is a parameter for how many of the "top" bricks appear as opposed to an empty space
- Range: 0-1
- Brick Size is a parameter for particle separation from Pointsfromvolume node
https://drive.google.com/file/d/1Coxo1xLHG-ALQGJ5SC2TZj1ZmM-i4lcl/view?usp=drive_link




