Skip to content

feat(ColumnLayer): getBevel & getRadius#9933

Closed
charlieforward9 wants to merge 15 commits intovisgl:masterfrom
NEW-HEAT:capshape-pr-clean
Closed

feat(ColumnLayer): getBevel & getRadius#9933
charlieforward9 wants to merge 15 commits intovisgl:masterfrom
NEW-HEAT:capshape-pr-clean

Conversation

@charlieforward9
Copy link
Copy Markdown
Collaborator

@charlieforward9 charlieforward9 commented Jan 8, 2026

image

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 capShape property to ColumnLayer and 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.ts to 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

  • Documented the new capShape property 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

  • Added unit tests to verify geometry generation for all cap shapes and new render test cases for the pointy and rounded cap options. [1] [2]

Internal Layer Logic

  • Updated internal layer methods to pass the capShape property through geometry creation and trigger geometry updates when capShape changes. [1] [2]

These changes collectively provide a more flexible and visually rich column rendering capability for deck.gl.

Copilot AI and others added 11 commits January 8, 2026 15:53
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>
@charlieforward9 charlieforward9 changed the title feat: ColumnLayer.capShape feat: ColumnLayer capShape Jan 8, 2026
@charlieforward9 charlieforward9 changed the title feat: ColumnLayer capShape feat(ColumnLayer): capShape Jan 9, 2026
Copy link
Copy Markdown
Collaborator

@felixpalmer felixpalmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea ❤️ . Did you also consider implementing this as a bevel?

Comment thread docs/api-reference/layers/column-layer.md Outdated
Comment thread docs/api-reference/layers/column-layer.md Outdated
Comment thread examples/get-started/pure-js/column-cap-shape/app.js Outdated
Comment thread modules/layers/src/column-layer/column-geometry.ts Outdated
Comment thread modules/layers/src/column-layer/column-layer.ts Outdated
getElevation: h => h.value * 5000
}
),
genColumnLayerTestCase(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're missing the golden images

@charlieforward9 charlieforward9 changed the title feat(ColumnLayer): capShape feat(ColumnLayer): getBevel Jan 10, 2026
   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>
@charlieforward9
Copy link
Copy Markdown
Collaborator Author

charlieforward9 commented Jan 10, 2026

@felixpalmer , introducing getBevel = (d) => {{segs: d.segs, height: d.heigth, bulge: d.bulge}} | "flat" | "cone" | "dome"

Unintentionally just created the TreeLayer, more on that later haha

getBevel.mov

I put a field into example/layer-browser with a simple select field. I could also land an update to the dataset in https://deck.gl/docs/api-reference/layers/column-layer in a few days

@charlieforward9
Copy link
Copy Markdown
Collaborator Author

Gemini_Generated_Image_gyt77hgyt77hgyt7 (1)

…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>
@charlieforward9 charlieforward9 changed the title feat(ColumnLayer): getBevel feat(ColumnLayer): getBevel & getRadius Jan 11, 2026
…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>
@charlieforward9
Copy link
Copy Markdown
Collaborator Author

Screen.Recording.2026-01-10.at.8.05.31.PM.mov

@charlieforward9
Copy link
Copy Markdown
Collaborator Author

Added getRadius accessor

This commit adds the getRadius accessor for per-instance radius control:

New Features:

  • getRadius prop accepts number or accessor function
  • instanceRadii attribute for per-instance rendering
  • Final radius = radius * getRadius(d) (similar to radiusScale in ScatterplotLayer)
  • Works with all radiusUnits options

Usage:

new ColumnLayer({
  radius: 1,                      // Scale factor
  getRadius: d => d.canopyRadius, // Per-instance radius
  radiusUnits: 'meters',
});

Documentation: Added to docs/api-reference/layers/column-layer.md
Tests: Added accessor and constant value tests in core-layers.spec.ts

in vec4 instanceFillColors;
in vec4 instanceLineColors;
in float instanceStrokeWidths;
in float instanceRadii;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Collaborator Author

@charlieforward9 charlieforward9 Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is beginning to be feature creep, is this really that useful?

Copy link
Copy Markdown
Collaborator Author

@charlieforward9 charlieforward9 Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its added a lot of value to our use case, we'd like to keep it and expand on it in the future.


Comment thread modules/layers/src/column-layer/column-layer.ts
@charlieforward9 charlieforward9 mentioned this pull request Jan 16, 2026
@charlieforward9
Copy link
Copy Markdown
Collaborator Author

charlieforward9 commented Jan 23, 2026

Ill add it to the experimental package

Copilot AI added a commit to NEW-HEAT/deck.gl that referenced this pull request Feb 4, 2026
…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.
@charlieforward9 charlieforward9 linked an issue Feb 20, 2026 that may be closed by this pull request
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

3 participants