Skip to content

feat(ColumnLayer): add cap prop for dome and cone top geometry#10221

Open
charlieforward9 wants to merge 1 commit intovisgl:masterfrom
NEW-HEAT:cap-prop-column-layer
Open

feat(ColumnLayer): add cap prop for dome and cone top geometry#10221
charlieforward9 wants to merge 1 commit intovisgl:masterfrom
NEW-HEAT:cap-prop-column-layer

Conversation

@charlieforward9
Copy link
Copy Markdown
Collaborator

@charlieforward9 charlieforward9 commented Apr 14, 2026

Summary

Adds a geometry-only cap prop to ColumnLayer that shapes the top of each extruded column. No new accessors, no shader changes, no per-instance attributes — zero performance impact on existing usage.

Value Description
'flat' (default) Current behavior, unchanged
'dome' Smooth hemispherical cap with normals curving from outward to upward
'cone' Pointed conical cap tapering to a single apex

Cap height equals the column radius. Only applies when extruded: true.

new ColumnLayer({
  data,
  getPosition: d => d.coords,
  getElevation: d => d.height,
  cap: 'dome',   // or 'cone' | 'flat'
  extruded: true
})

Why this belongs in the base layer

  • Zero cost when unusedcap: 'flat' (the default) produces the exact same geometry as before. The cap is built at geometry-construction time, not per-instance.
  • Generic applicability — dome/cone tops are useful anywhere extruded columns appear: 3D bar charts wanting softer tops, terrain/elevation vis, environmental data, architectural previews. This was also requested in 2020.
  • Composable — since HexagonLayer renders ColumnLayer under the hood, this flows through to aggregation-based hexagon maps.
  • Minimal surface area — one prop, three string values. Follows @felixpalmer's recommendation to keep scope limited to geometry modification.

Demo

agintel.ai use case for allowing users to swap between 3D TreeLayer and '2D' ColumnLayer - preserving aesthetic depth and visibility of tree (in contrast to the flat Scatterplot layer that can be a little more difficult to contrast and style.

Screen.Recording.2026-04-14.142120.mp4

Changes

  • ColumnGeometry: When cap is not 'flat' and extruded: true, replaces the flat top tessellation with interleaved ring triangle strips. Dome uses max(2, round(diskResolution / 4)) rings along a quarter-circle arc; cone uses 1 ring to a single apex.
  • ColumnLayer: Added cap prop (default 'flat'), forwarded through getGeometryColumnGeometry, wired into updateState geometry-regeneration check.
  • Tests: Vertex counts, apex position, side geometry preservation, and height=0 passthrough.
  • Docs: Added cap entry to column-layer.md.

Fixes #9942

Test plan

  • Unit tests for cone/dome vertex counts, apex positions, side geometry preservation
  • cap: 'flat' produces identical geometry to current behavior
  • cap ignored when height=0 (not extruded)
  • Visual verification (screen recording above)

Adds a geometry-only `cap` prop to ColumnLayer that shapes the top of
each column when extruded. No per-instance attributes — zero rendering
overhead on existing usage.

- `'flat'` (default): current behavior, unchanged
- `'dome'`: smooth hemispherical cap with proper normals
- `'cone'`: pointed conical cap

Fixes visgl#9942
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Trees

1 participant