Convert meshes to Lego bricks

calendar_today

20.06.2022

label

Modeling, Hard-surface

mouse

Houdini 19.0

1 Introduction

Copying one-unit Lego bricks to a grid of points that are oriented to perpendicular volume gradients.

2 VEX wrangles

Sampling gradients from volume:

v@grad = normalize(volumegradient(1, 'surface', v@P));

Perpendicular point normals based on gradient vectors:

v@N = v@grad;

int side = abs(v@N.x) > abs(v@N.z);

v@N.y = 0.0;
v@N.x = side ? sign(v@N.x) : 0;
v@N.z = side ? 0 : sign(v@N.z);

v@up = {0,1,0};

Assigning variant numbers (0 or 1) based on the longest gradient vector component:

float angle = chf('angle');

i@variant = max(abs(v@grad)) < angle;
download

Downloads