Modular Procedural Pipes
I built this Houdini HDA to fit modular pieces like pipes and conduits along a user-drawn spline. Through Houdini Engine for Unreal, artists can feed it any number of static mesh pieces and get procedural layouts directly in-engine. The advantage over fully procedural geometry is that it works with hand-crafted modular pieces, so artists keep creative control over the individual shapes.
For fully procedural geometry generation, see my Procedural Rocks system which uses similar Houdini and VEX techniques.
Features
- Input modular segments of any size; HDA optimally fits or scales each segment.
- Adjust scale of pieces.
- Appropriately fits pieces within each curve segment.
- Aligns elbow pieces to correct angles.
- Adds 3-way and 4-way connectors at curve intersections.
- Rotates repeating segments at 45-degree intervals to vary texture.
- Insert valves at user-defined intervals.
- Place mounts at specified intervals, aligning with reference geometry.
- Option for curve to snap to reference geometry and generate vertical segments.
- Generate offset curves from the original for modular pieces to follow.
- Batches pieces to minimize draw calls.
Inputs
Modular Pieces
- Repeating Segments
- Corners
- Set piece angle
- Define flange circumference and width
- Intersections
- Supports 3-way and 4-way
- Secondary Pieces (e.g., valves)
- Mounts (for attachment to other objects)
Curves
User-generated splines that define the pipe routing paths.
Snapping to Length
The system automatically calculates optimal placement of modular segments along curve lengths, ensuring proper fitting without gaps or overlaps.
Calculating Corner Pieces
In order to place the correct corner pieces I measure the angle, adjust normals and calculate the amount to bevel the curve to fit the corner mesh.
- Calculate the angle of each corner point (90, 45, 18.75, etc). This tells it what piece to use.
- Orient the corner piece by setting the N to point at the previous point and the up direction at the next point.
- Calculate the bevel amount to subtract from the curve to fit the corner piece. To do this I use some trigonometry in VEX.
Example for 45 degree elbow: X+width of flange = amount to bevel corners to make space for the corner geometry.