visgl / visgl/deck.gl

Mesh model reversed in globe view

Open
#7,362 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
14.6k
Forks
2.3k
Avg merge
2d 9h
Merged PRs (30d)
42

Description

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
  • 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox reproduction and compare SimpleMeshLayer orientation between MapView and GlobeView, using the provided ConeGeometry example and getOrientation values. Trace the GlobeView and SimpleMeshLayer rendering paths to identify why the angle is reversed, then verify that the mesh renders at the same angle in both views.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.