Parametric Geometry Modeling: Driving Linked Scene Generation with Global Constants

    Learn how to build parametric scenes in which geometry, mechanical assemblies, and character poses respond consistently to changes in global constants. Using a pelican riding a bicycle as an example, this article explains parameter dependencies, chain-path geometry, pose constraints, and validation through a parameter–derivation–assertion workflow.

    Parametric Geometry Modeling: Driving Linked Scene Generation with Global Constants

    1. Why Writing Code Is Not the Same as Building a Model

    In procedural modeling, a script may run successfully and produce a convincing render while still doing little more than “drawing a picture with code.” The defining test of a truly parametric model is whether geometry is separated from fixed, manually tuned values and derived consistently from its parameters.

    Consider a demanding test scene: a pelican riding a dark green steel-frame bicycle along a seaside promenade at dusk. Although whimsical, the scene tests several modeling capabilities at once:

    • Multi-body assembly: The relative positions of the diamond frame, crank drivetrain, chain, and front and rear wheels must remain consistent.
    • Character pose constraints: The pelican’s wings reach forward to the grips, while its webbed feet maintain the required relationship with the pedals.
    • Kinematic phase consistency: At a given crank angle, the pedaling foot must contact the pedal surface, while the other foot remains suspended at the low point of its return pose.
    • Attachment hierarchy: A canvas tool bag on the down tube and a rolled fishing net on the rear rack must belong to the correct parent coordinate systems.

    If these relationships depend on hard-coded coordinates adjusted by eye, changing a parameter can cause intersections, floating parts, or misalignment. The first principle of parametric modeling is therefore simple: derive all geometry from global constants, and avoid magic numbers inside functions that are disconnected from those parameters.

    2. Designing the Parameter System: Express Constraints as Constants

    A robust parametric script declares its key physical constraints together at the top:

    1. PELICAN_WINGSPAN = 1.15 # Wingspan (meters): controls handlebar width and grip spacing
    2. BICYCLE_WHEELBASE = 1.02 # Wheelbase (meters): drives frame geometry
    3. BICYCLE_CHAINRING_TEETH = 44 # Chainring tooth count
    4. BICYCLE_COG_TEETH = 16 # Rear cog tooth count
    5. BICYCLE_CRANK_PHASE = 35.0 # Crank phase angle (degrees)

    These five parameters are not independent settings. They form a dependency chain:

    1. Wingspan → handlebar width: Set the total handlebar width to the wingspan multiplied by a grip ratio. Grip spacing should be slightly smaller than the wingspan so the wing tips naturally reach the grip regions.
    2. Wheelbase → frame triangles: Derive the horizontal relationship between the fork’s steering axis and the bottom bracket from the wheelbase, then calculate the corresponding down-tube, seat-tube, and seatstay angles.
    3. Tooth counts → chain length: The closed chain path depends on the pitch-circle diameters of the chainring and rear cog, along with their center distance. Pitch-circle size is tied to tooth count.
    4. Crank phase → foot pose: The crank angle directly determines the three-dimensional positions of both pedals, which in turn define the rigging targets for the pelican’s feet.

    3. The Acceptance Test: Change Numbers, Not Code

    A genuinely parametric model must pass a straightforward stress test: change only the constants, rerun the script, and inspect the resulting relationships.

    Test 1: Increase Wingspan from 1.15 to 1.35

    The handlebars must become wider, and the pelican’s wing tips must still land within the grip regions.

    If handlebar width is hard-coded, increasing the wingspan can leave the wings grasping empty space. Instead, use the handlebar grip positions as inverse kinematics (IK) targets for the wing-tip joints, or explicitly derive handlebar width from wingspan.

    Test 2: Increase Chainring Tooth Count from 44 to 52

    A larger chainring requires a recalculated chain path.

    Geometrically, the chain follows two external common tangent segments between the chainring and cog pitch circles, connected by two wrap arcs. Changing the chainring radius changes both the tangent points and the wrap angles, so the total path length changes as well.

    A common mistake is to keep the chain path fixed. The enlarged chainring then intersects the chain, or the chain appears stretched and unsupported. The tangent calculation should instead be implemented as a pure geometry function: given the circle centers and radii, it returns the tangent points and arc segments.

    1. def chain_tangents(ring_r, cog_r, center_dist):
    2. # Solve external common tangents:
    3. # tangent angle = acos((ring_r - cog_r) / center_dist)
    4. # Return four tangent-point coordinates for chain-path generation.
    5. ...

    Test 3: Change Crank Phase from 35 Degrees to 140 Degrees

    Changing the crank phase moves both pedals substantially around their rotation path. The sole of the pedaling foot must remain aligned with the pedal’s upper surface, while the suspended foot must satisfy the intended low return pose.

    Foot placement cannot rely on a static offset. Contact targets must be recalculated from the pedals’ world-space coordinates, with an offset along the pedal normal that accounts for foot thickness.

    4. Implementation Guidelines and Best Practices

    1. Maintain a Single Source of Truth

    Define each geometric dimension in only one place.

    If crank length is specified separately in the bicycle modeling function and the foot-rigging function, the two systems can fall out of sync when parameters change, producing subtle alignment defects.

    2. Name Derived Values Explicitly

    Calculate and name intermediate values centrally, such as:

    1. handlebar_width = PELICAN_WINGSPAN * 0.92
    2. chain_length = computed_from(ring, cog, dist)

    Explicit names make the dependency structure easy to inspect and audit.

    3. Use Assertions for Parametric Self-Checks

    Build geometric assertions into the script. For example, verify that the distance between a webbed foot and its pedal surface stays within tolerance, and that the chain path does not intersect the sprocket bodies.

    After a parameter change, the script should report a failed constraint rather than leave every error to visual inspection.

    4. Allow Stylization, but Keep Spatial Relationships Verifiable

    The render can be artistic. The dark green steel frame, warm dusk lighting, and weathered canvas tool bag all allow room for stylistic choices.

    The topology and spatial relationships between components, however, must remain verifiable through parametric checks. These include chain tension, the crank-to-rear-wheel drive relationship, and the fishing net’s attachment points on the rack.

    Style serves expression; parameters serve correctness. Neither should compromise the other.

    5. Conclusion

    Parametric modeling turns a scene’s physical constraints into a small set of editable constants and derives its geometry consistently from them.

    The pelican-on-a-bicycle example brings three classes of constraints into one scene: character posing, mechanical transmission, and assembly relationships. Wingspan drives handlebar width, tooth counts drive the chain path, and crank phase drives foot placement.

    The resulting parameter–derivation–assertion workflow applies to both mechanical assemblies and character rigs. It produces models that can withstand the practical test of changing numbers without changing code.

    The same approach also supports cloud-based batch generation of parametric variants, including e-commerce visuals and digital-twin prototypes. Object storage can manage assets, while a container platform schedules batch rendering, connecting modeling to a production pipeline.