Skip to content

[Feat] Better control over actual color of extruded SolidPolygonLayer surfaces #10424

Description

@zbigg

Target Use Case

Extruded polygons rendered with SolidPolygon exhibit different coloring behavior than than non-extruded ones.

That's because extruded polygons are rendered with lightning enabled and thus they render color that is combination of what getFillColor returns and how light interacts with given surface.

That means that developer have hard time understanding what will be the final color of his polygpn and it's common that rendered color doesn't align with "expected" color, for example on legends. Of course, there is documentation about controling material, but in my opinion main problem comes from fact that top surface interacts with light at all. It should be possible to disable that while still maintaining shading/lighthing of sides/walls.

(It appears that for good visualization, it's useful that wall faces still interact with light - shading applied only to walls gives great feedback about shape)

Example:

US states colored by population with colors as in legend (most right exhibit):

  • left: extruded (default lightning properties) - darker than legend
  • center: same props, not-extruded - colors match legend
  • right: expected: extruded, colors matching those not extruded and legend that just uses CSS colors
Image

Taking into account that deck.gl is visualization library actual colors matter (esp when they should align with other parts of UI of app like legend) and it would be great if extruded SolidPolygonLayer have possibility to control colors explicltiy possibly by removing interaction with lightning completly.


Note, i've tried several combination of material options, but given that then apply same logic to side and top i believe it's impossible to have strict colors on top and useful shading of sides/walls.

Proposal

SolidPolygonLayer in extruded mode already renders using two materials - top and side.

Make properties of both materials configurable, so user can configure top and side material separately:

Proposed props for SolidPolygonLayer

  • material: current property - control both
  • topMaterial: (new) control only top material
  • sideMaterial: (new) control only side material

Semantics:

  • when passing object - use current semantics
  • with possible one addition false or null or "disabled" - as easy api to completly disable interaction with light (not sure if it's same as same as {ambient: 1, ...rest: 0})

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions