felixpalmer Github contribution chart
felixpalmer Github Stats
felixpalmer Most Used Languages

Activity

01 Dec 2022

Issue Comment

Felixpalmer

Mesh model reversed in globe view

Description

When using a SimpleMeshLayer, the orientation angle of a mesh model is reversed when in GlobeView.

Mapview

Screenshot from 2022-10-28 17-04-26

Globeview

Screenshot from 2022-10-28 17-04-12

Flavors

  • [X] React
  • [ ] Python/Jupyter notebook
  • [ ] MapboxLayer
  • [ ] GoogleMapsOverlay
  • [ ] CartoLayer
  • [ ] DeckLayer/DeckRenderer for ArcGIS

Expected Behavior

The same rendered angle in both views

Steps to Reproduce

import React, { useState } from "react";
import DeckGL from "@deck.gl/react";
import { BitmapLayer } from "@deck.gl/layers";
import { TileLayer } from "@deck.gl/geo-layers";
import { MapView, _GlobeView as GlobeView } from "@deck.gl/core";
import { SimpleMeshLayer } from "@deck.gl/mesh-layers";
import { ConeGeometry } from "@luma.gl/core";

// Viewport settings
const INITIAL_VIEW_STATE = {
  longitude: 0,
  latitude: 0,
  zoom: 5,
  pitch: 0,
  bearing: 0
};

const mapview = {
  map: new MapView({ id: "mapview", controller: true }),
  globe: new GlobeView({ id: "globe", controller: true })
};

const baselayer = new TileLayer({
  // https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#Tile_servers
  data: "https://c.tile.openstreetmap.org/{z}/{x}/{y}.png",

  minZoom: 0,
  maxZoom: 19,
  tileSize: 256,

  renderSubLayers: (props) => {
    const {
      bbox: { west, south, east, north }
    } = props.tile;

    return new BitmapLayer(props, {
      data: null,
      image: props.data,
      bounds: [west, south, east, north]
    });
  }
});

const meshlayer = new SimpleMeshLayer({
  id: "mesh-layer",
  sizeScale: 100000,
  data: [{ position: [0, 0, 10000], angle: [0, 90, 0], color: [0, 0, 0] }],
  mesh: new ConeGeometry(),
  getPosition: (d) => d.position,
  getColor: (d) => d.color,
  getOrientation: (d) => d.angle
});

const layers = [baselayer, meshlayer];

export const App = () => {
  const [view, setView] = useState("map");
  const toggleView = (e) => {
    setView(view === "map" ? "globe" : "map");
  };
  return (
    <DeckGL
      initialViewState={INITIAL_VIEW_STATE}
      controller={true}
      layers={layers}
      views={mapview[view]}
    >
      <button onClick={toggleView}>Toggle view</button>
    </DeckGL>
  );
}; 

Environment

  • Framework version:
  • Browser:
  • OS:

Logs

No response

Forked On 01 Dec 2022 at 12:12:29

Felixpalmer

The angle is not reversed, it is offset by 180 degrees. If the following data is used it is easier to see what is happening.

[
  {position: [0, 1, 100000], angle: [0, 0, 0], color: [255, 0, 0]},
  {position: [-1, 0, 100000], angle: [0, 90, 0], color: [0, 255, 0]},
  {position: [0, 0, 100000], angle: [0, 0, 90], color: [0, 0, 255]}
]; 

MapView

GlobeView

My theory as to why this is happening is due to a different coordinate handedness between the coordinate systems. It is possible to fix this by shifting the yaw (angle[1]) angle by 180 degrees.

Due to the way the transform matrix is constructed (and trig identities) it is possible to apply this shift as a modification to the modelMatrix in the vertex shader:

mat3 modelMatrix = instanceModelMatrix;
  if (project_uProjectionMode == PROJECTION_MODE_GLOBE) {
    // Globe mode uses opposite handedness, need to shift yaw by 180 to compensate
    const vec3 yawShift = vec3(-1.0, -1.0, 1.0);
    modelMatrix[0] *= yawShift;
    modelMatrix[1] *= yawShift;
    modelMatrix[2] *= yawShift;
} 

@Pessimistress what do think of this approach?

Commented On 01 Dec 2022 at 12:12:29

Felixpalmer

Tidy

Pushed On 30 Nov 2022 at 04:13:39

Felixpalmer

Add mask extension

Pushed On 30 Nov 2022 at 04:13:39

Felixpalmer

Mask & Collide working together

Pushed On 30 Nov 2022 at 04:13:39

Felixpalmer

Per-context dummyCollideMap

Pushed On 30 Nov 2022 at 04:13:39

Felixpalmer

Rendering performance improvements

Created On 29 Nov 2022 at 08:50:43
Create Branch
Felixpalmer In CartoDB/carto-react Create Branchfelix/perf-improvements

Felixpalmer

CARTO for React packages

On 29 Nov 2022 at 08:46:27
Issue Comment

Felixpalmer

luma v9.0.0 alpha.5

For #

Background

Change List

Forked On 28 Nov 2022 at 10:02:04

Felixpalmer

I've pulled this branch and tried running the tests. I'm on a M1 Mac and using node 14.18.1 (installed using nvm without issues). The tests (yarn test fast) are not running for me, with the following error:

Running node tests...
deck.gl/node_modules/@luma.gl/test-utils/dist/index.js:1
export { default as SnapshotTestRunner } from './snapshot-test-runner';
^^^^^^

SyntaxError: Unexpected token 'export' 

Comparing node_modules/@luma.gl/test-utils/package.json between v8 & v9, in v9 both the main and module entries point at dist/index.js (an ESM module) while in v8 main points to dist/es5/index.js

Commented On 28 Nov 2022 at 10:02:04
Issue Comment

Felixpalmer

[Feat] support setting opacity of fill and stroke independently in H3 hexagon layer

Target Use Case

We are not able to customize H3 layer to apply opacity to stroke and fill independently. Because H3 layer renders column layer which is not a composite layer. Opacity is applied as a uniform.

H3 layer - opacity is applied to both stroke and fill

With the geojson layer. We can apply opacity to the stroke layer independently by passing _subLayerProps

 _subLayerProps: {
          ...(featureTypes.polygon ? {'polygons-stroke': {opacity: 0.5}} : {}),
          ...(featureTypes.line ? {linestrings: {opacity: 0.5}} : {})
        } 

Proposal

Honestly. I am not sure what would be a good solution here that doesn't affect performance. If we renders a composite layer just for the stroke then we will be passing the same buffer twice. If we use the hi definition prop which renders a geojson layer instead, it also hurts performance.

Forked On 28 Nov 2022 at 09:32:29

Felixpalmer

It could be done perfomantly by adding a new prop (strokeOpacity) and updating the opacity uniform with that value in this draw call:

https://github.com/visgl/deck.gl/blob/8.8-release/modules/layers/src/column-layer/column-layer.ts#L426

However there is no precedent of strokeOpacity in other layers, so it might make more sense for you to create a custom layer for your use case

Commented On 28 Nov 2022 at 09:32:29
Issue Comment

Felixpalmer

[Feat] support setting opacity of fill and stroke independently in H3 hexagon layer

Target Use Case

We are not able to customize H3 layer to apply opacity to stroke and fill independently. Because H3 layer renders column layer which is not a composite layer. Opacity is applied as a uniform.

H3 layer - opacity is applied to both stroke and fill

With the geojson layer. We can apply opacity to the stroke layer independently by passing _subLayerProps

 _subLayerProps: {
          ...(featureTypes.polygon ? {'polygons-stroke': {opacity: 0.5}} : {}),
          ...(featureTypes.line ? {linestrings: {opacity: 0.5}} : {})
        } 

Proposal

Honestly. I am not sure what would be a good solution here that doesn't affect performance. If we renders a composite layer just for the stroke then we will be passing the same buffer twice. If we use the hi definition prop which renders a geojson layer instead, it also hurts performance.

Forked On 25 Nov 2022 at 02:34:25

Felixpalmer

You can apply different opacities by specifying the opacity in the getFillColor & getLineColor accessors.

Commented On 25 Nov 2022 at 02:34:25
Merge

Felixpalmer

chore: Address prop-types feedback

For https://github.com/visgl/luma.gl/pull/1619#discussion_r1029054333

Background

  • Address feedback

Change List

  • Rename PropDef to PropValidator
  • Add JSDoc
  • Clean up variable naming

Forked On 23 Nov 2022 at 12:37:17

Felixpalmer

```suggestion validate?(value: any, propType: PropType): boolean; ```
On 23 Nov 2022 at 12:37:17

Felixpalmer

chore: Address prop-types feedback

For https://github.com/visgl/luma.gl/pull/1619#discussion_r1029054333

Background

  • Address feedback

Change List

  • Rename PropDef to PropValidator
  • Add JSDoc
  • Clean up variable naming

Merged On 23 Nov 2022 at 12:38:26

Felixpalmer

Commented On 23 Nov 2022 at 12:38:26

Felixpalmer

chore: Address prop-types feedback

For https://github.com/visgl/luma.gl/pull/1619#discussion_r1029054333

Background

  • Address feedback

Change List

  • Rename PropDef to PropValidator
  • Add JSDoc
  • Clean up variable naming

Merged On 23 Nov 2022 at 12:38:26

Felixpalmer

Commented On 23 Nov 2022 at 12:38:26

Felixpalmer

Additional ClipExtension and MaskExtension tests

Follow up of #7413

Change List

  • Explicitly check for prop value undefined
  • Unit tests

Merged On 23 Nov 2022 at 09:15:28

Felixpalmer

Commented On 23 Nov 2022 at 09:15:28
Merge

Felixpalmer

CollideExtension

PoC for https://github.com/visgl/deck.gl/issues/7374 - please review new API proposal there

Change List

  • Add new CollideExtension & CollideEffect
  • New supporting CollidePass
  • Support for sorting by priority via getCollidePriority
  • Test app demonstrating usage for point, text and tile layers

Forked On 22 Nov 2022 at 04:55:01

Felixpalmer

Switched to for-loop. I'm not 100% happy with this solution, as the object flicker when the view is tilted as the aliasing produces slightly different results between frame. A better solution might be to add some form of leaky bucket to smooth these high-frequency changes out over a few frames, but I'm not going to attempt that in this PR
On 22 Nov 2022 at 04:55:01

Felixpalmer

CollideExtension

PoC for https://github.com/visgl/deck.gl/issues/7374 - please review new API proposal there

Change List

  • Add new CollideExtension & CollideEffect
  • New supporting CollidePass
  • Support for sorting by priority via getCollidePriority
  • Test app demonstrating usage for point, text and tile layers

Merged On 22 Nov 2022 at 04:55:02

Felixpalmer

Commented On 22 Nov 2022 at 04:55:02

Felixpalmer

Simpler prop override

Pushed On 22 Nov 2022 at 04:51:43

Felixpalmer

Use for loop in collide shader

Pushed On 22 Nov 2022 at 04:51:43

Felixpalmer

More efficient color comparison

Pushed On 22 Nov 2022 at 04:51:43

Felixpalmer

Fix BitmapLayer translucency

For #7427

Background

When the transparentColor prop was added for an Uber internal use case (I believe back during v6), it changed the default behavior of BitmapLayer with opacity < 1. When a layer is drawn into the screen buffer, our default blending settings assume that it is NOT premultiplied. The way BitmapLayer currently handles the blending between transparentColor and the image pixel, it outputs a premultiplied color. For example, if a pixel from image has value [a, a, a, a], with the default transparentColor prop, the fragment shader outputs [a*a, a*a, a*a, a]. This leads to overly muted output as alpha is technically applied twice.

I created a Codepen to showcase the issue in 8.8: https://codepen.io/Pessimistress/pen/JjZpREP?editors=0010.

Change List

  • BitmapLayer blends transparentColor and pixel color more naturally
  • Clarify the purpose of transparentColor in documentation
  • Update render test reference image

Merged On 22 Nov 2022 at 09:33:36

Felixpalmer

Commented On 22 Nov 2022 at 09:33:36

Felixpalmer

Add maskInverted prop to MaskExtension (#7440)

Pushed On 22 Nov 2022 at 09:17:50

Felixpalmer

Add maskInverted prop to MaskExtension

Created On 22 Nov 2022 at 09:17:49
Merge

Felixpalmer

chore(shadertools): Fully eliminate implicit typings

For #1402

Background

  • Shadertools module has a number of complex input structures and overloaded types for hooks, modules etc.
  • Very little type checking makes the module error prone and hard to use.

Change List

  • Set noImplicitAny in shadertools module
  • Add/improves types to fix all errors

Forked On 22 Nov 2022 at 09:10:41

Felixpalmer

I find the types and parameter naming confusing. It's not clear why you chose to swap the names of the types but kept the parameter names.
On 22 Nov 2022 at 09:10:41
Merge

Felixpalmer

chore(shadertools): Fully eliminate implicit typings

For #1402

Background

  • Shadertools module has a number of complex input structures and overloaded types for hooks, modules etc.
  • Very little type checking makes the module error prone and hard to use.

Change List

  • Set noImplicitAny in shadertools module
  • Add/improves types to fix all errors

Forked On 22 Nov 2022 at 09:08:40

Felixpalmer

I think this would be better called `VALIDATOR` or similar
On 22 Nov 2022 at 09:08:40

Felixpalmer

chore(shadertools): Fully eliminate implicit typings

For #1402

Background

  • Shadertools module has a number of complex input structures and overloaded types for hooks, modules etc.
  • Very little type checking makes the module error prone and hard to use.

Change List

  • Set noImplicitAny in shadertools module
  • Add/improves types to fix all errors

Merged On 22 Nov 2022 at 09:16:43

Felixpalmer

Commented On 22 Nov 2022 at 09:16:43

Felixpalmer

chore(shadertools): Fully eliminate implicit typings

For #1402

Background

  • Shadertools module has a number of complex input structures and overloaded types for hooks, modules etc.
  • Very little type checking makes the module error prone and hard to use.

Change List

  • Set noImplicitAny in shadertools module
  • Add/improves types to fix all errors

Merged On 22 Nov 2022 at 09:16:43

Felixpalmer

Commented On 22 Nov 2022 at 09:16:43

Felixpalmer

Update docs/api-reference/extensions/mask-extension.md

Co-authored-by: Xiaoji Chen Pessimistress@users.noreply.github.com

Pushed On 22 Nov 2022 at 08:53:18

Felixpalmer

Add _groupByCollideGroup

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Remove haveCollideLayers in favour of collideGroup

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Remove this.collideMap

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Remove collidePass in favour of collidePasses

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Multiple collideGroups PoC

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Independent collideGroups working

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Shared dummyCollideMap

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Remove collideGroups from moduleParameters

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Cleanup

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Create/delete CollidePasses on demand

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Reinstate oldRenderInfo checks

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Tidy

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Use TextLayer in example

Pushed On 21 Nov 2022 at 04:35:38

Felixpalmer

Add render image

Pushed On 21 Nov 2022 at 10:14:09

Felixpalmer

Add maskInverted prop to MaskExtension

Created On 21 Nov 2022 at 09:38:13
Create Branch
Felixpalmer In visgl/deck.gl Create Branchfelix/mask-invert

Felixpalmer

WebGL2 powered visualization framework

On 21 Nov 2022 at 09:36:50

Felixpalmer

Delete COLLIDE constant

Pushed On 21 Nov 2022 at 08:45:51

Felixpalmer

Move collide_sort code to extension

Pushed On 21 Nov 2022 at 08:45:51

Felixpalmer

Remove unneeded shaderlib module

Pushed On 21 Nov 2022 at 08:45:51

Felixpalmer

Tidy

Pushed On 21 Nov 2022 at 08:45:51