feat(ColumnLayer): getBevel & getRadius#9933
feat(ColumnLayer): getBevel & getRadius#9933charlieforward9 wants to merge 15 commits intovisgl:masterfrom
getBevel & getRadius#9933Conversation
Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
Co-authored-by: charlieforward9 <62311337+charlieforward9@users.noreply.github.com>
ColumnLayer capShapecapShape
felixpalmer
left a comment
There was a problem hiding this comment.
Nice idea ❤️ . Did you also consider implementing this as a bevel?
| getElevation: h => h.value * 5000 | ||
| } | ||
| ), | ||
| genColumnLayerTestCase( |
There was a problem hiding this comment.
You're missing the golden images
capShapegetBevel
per-instance bevel control with getBevel
accessor
Replace capShape prop with unified getBevel
accessor that supports:
- 'flat': No bevel (flat top)
- 'dome': Rounded dome with smooth normals
- 'cone': Pointed cone shape
- {segs, height, bulge?}: Full per-instance
control
- segs: shape type (0-1=flat, 2=cone,
3+=dome)
- height: bevel height in world units
(unbounded)
- bulge: curve factor affecting radius (-1
to 1+)
Layer-level bevelSegments prop controls
geometry resolution.
Changes:
- Add BevelProp type with string shortcuts
and object form
- Add three instanced attributes for
per-instance bevel control
- Update vertex shader to decode bevel
parameters and apply bulge
- Add wireframe rendering for bevel cap
- Update layer-browser with 3-select dropdown
for getBevel
- Remove old column-cap-shape example
- Update documentation
Co-Authored-By: Claude Opus 4.5
<noreply@anthropic.com>
|
@felixpalmer , introducing Unintentionally just created the getBevel.movI put a field into |
…butes Changed instanceBevelHeights, instanceBevelSegs, and instanceBevelBulge from inline accessor functions to string accessors with transform functions. This fixes an issue where inline accessor functions captured `this` at definition time, causing stale props when layers were matched and state transferred between instances. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
getBevelgetBevel & getRadius
…ntrol - Add getRadius prop that returns radius values per-instance - Add instanceRadii attribute to support per-instance rendering - Update vertex shader to multiply radius uniform by instanceRadii - radius prop acts as a scale factor (similar to radiusScale in ScatterplotLayer) - Final radius = radius * getRadius(d) - Add tests for getRadius accessor with function and constant values - Add documentation with usage examples Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Screen.Recording.2026-01-10.at.8.05.31.PM.mov |
Added
|
| in vec4 instanceFillColors; | ||
| in vec4 instanceLineColors; | ||
| in float instanceStrokeWidths; | ||
| in float instanceRadii; |
There was a problem hiding this comment.
Adding extra attributes has a cost and will slow down the layer even if they are unused. There is also a hard cap on how many attributes a shader can have and this can prevent extensions working (as they add their own). I would recommend removing them.
There was a problem hiding this comment.
I do notice performance impact so I would like to find some ways of achieving the same functionality without the cost.
Would SimpleMeshLayer be a better base?
I cant think of a more efficient way of generating the shape of a tree without combining multiple sublayers.
| * - {segs, height, bulge?}: Full control | ||
| * - segs: number of bevel segments (0-1=flat, 2=cone, 3+=dome) | ||
| * - height: bevel height in world units (must be > 0, unbounded) | ||
| * - bulge: curve factor (-1 to 1+), 0=standard dome, negative=concave, positive=convex bulge |
There was a problem hiding this comment.
I think this is beginning to be feature creep, is this really that useful?
|
Ill add it to the experimental package |
…port This extension adds per-instance bevel shapes (dome, cone, flat) and radius scaling to ColumnLayer for hierarchical/tree visualizations. Based on: - visgl/deck.gl-community#470 (ExperimentalColumnLayer) - visgl#9933 (Original getBevel & getRadius) Following the recommendation from Chris Gervant to implement this as an extension rather than a new layer.




Screen.Recording.2026-01-08.151234.mp4
Background
Change List
This pull request adds support for customizable cap shapes to the
ColumnLayer, allowing users to render columns with flat, rounded (dome), or pointy (cone) tops. The implementation includes updates to the geometry generation logic, new documentation, an interactive example, and tests to ensure correctness.Column Cap Shape Feature
Added a new
capShapeproperty toColumnLayerand its geometry, supporting'flat','rounded', and'pointy'options for the top cap. This is reflected in the layer props, geometry props, and default values. [1] [2] [3] [4]Updated the geometry generation logic in
column-geometry.tsto create the appropriate vertex and normal data for each cap shape, including new algorithms for dome and cone tops. [1] [2] [3]Documentation and Example
capShapeproperty in the API reference and added a dedicated interactive example with usage instructions and controls for cap shape and disk resolution. [1] [2] [3] [4] [5]Testing
pointyandroundedcap options. [1] [2]Internal Layer Logic
capShapeproperty through geometry creation and trigger geometry updates whencapShapechanges. [1] [2]These changes collectively provide a more flexible and visually rich column rendering capability for deck.gl.