Skip to content

wc41/hw03-legos

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LEGO-ifying Meshes

Project Overview

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.

image image image

LegoDemo2.1.mp4

Process

  • 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

image

  • Partitioning "angled" points involves a VEX function determining the difference between the transferred normal data and {0, 1, 0}.
    • image
    • These angled points are then partitioned into 4 directions, based on their X and Z normal values
    • Their normals are adjusted so that the slope brick faces the correct direction
    • All un-angled points are corrected so their normals are {1, 0, 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

Source Files

https://drive.google.com/file/d/1Coxo1xLHG-ALQGJ5SC2TZj1ZmM-i4lcl/view?usp=drive_link

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published