Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Tiles Disappear in Google 3D Tiles Map #8685

Open
2 of 7 tasks
BharathKumarRavichandran opened this issue Mar 20, 2024 · 1 comment
Open
2 of 7 tasks

[Bug] Tiles Disappear in Google 3D Tiles Map #8685

BharathKumarRavichandran opened this issue Mar 20, 2024 · 1 comment
Labels

Comments

@BharathKumarRavichandran
Copy link

BharathKumarRavichandran commented Mar 20, 2024

Description

Hi, I am using deck.gl along with google-3d-tiles to incorporate a 3D Tile Layer. I've encountered an issue where black regions start appearing at the top of the map upon zooming in beyond a certain threshold. The color is black because the background color is black. So I guess the tiles disappear at that place. This only happens after a particular zoom factor, or if the pitch approaches 0, I am not sure what is going wrong here. I've included both the code snippet and screenshots for reference.

The initial view state coordinates of the study area are (29.7335, -95.2987). Interestingly, this issue doesn't occur for the region with coordinates (50.089, 14.42), which is included in the examples.

const newLayers = [
    new Tile3DLayer({
        id: 'google-3d-tiles',
        data: 'https://tile.googleapis.com/v1/3dtiles/root.json',
        onTilesetLoad: tileset3d => {
            tileset3d.options.onTraversalComplete = selectedTiles => {
                const uniqueCredits = new Set();
                selectedTiles.forEach(tile => {
                    const {copyright} = tile.content.gltf.asset;
                    copyright.split(';').forEach(uniqueCredits.add, uniqueCredits);
                });
                setCredits([...uniqueCredits].join('; '));
                return selectedTiles;
            };
        },
        loadOptions: {
            fetch: {headers: {'X-GOOG-API-KEY': import.meta.env.VITE_APP_GOOGLE_MAPS_API_KEY}}
        },
        operation: 'terrain+draw',
        strategy: 'no-overlap',
    })
];

Component:

<DeckGL
    initialViewState={deckGLViewState}
    controller={true}
    layers={layers}
    onViewStateChange={onViewStateChange}
>
    <div className={"credits"}>
        {credits}
    </div>
</DeckGL>

Screenshots for reference:

Screenshot 2024-03-12 at 2 19 45 PM

Screenshot 2024-03-12 at 2 28 12 PM

Screenshot 2024-03-12 at 2 21 14 PM

Screenshot 2024-03-19 at 6 51 42 PM

Discussion Link: #8641

Flavors

  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CartoLayer
  • ArcGIS

Expected Behavior

No response

Steps to Reproduce

import React, {useEffect, useState} from 'react';

import DeckGL from '@deck.gl/react';
import { LinearInterpolator } from 'deck.gl';
import { BitmapLayer, GeoJsonLayer } from '@deck.gl/layers';
import { Tile3DLayer } from '@deck.gl/geo-layers';
import { DataFilterExtension, _TerrainExtension as TerrainExtension } from '@deck.gl/extensions';


const PhotoRealisticMap = ({globalViewState, setGlobalViewState, simulationLayerData, superimposeStyle}) => {

    const [deckGLViewState, setDeckGLViewState] = useState({
        longitude: -95.2987,
        latitude: 29.7335,
        zoom: 18.3,
        pitch: 75,
        bearing: -16.27,
        maxZoom: 21
    });
    const [layers, setLayers] = useState([]);
    const [credits, setCredits] = useState('');

    const loadLayers = (simulationLayerData) => {
        console.debug("Loading photorealistic layers");

        const newLayers = [
            new Tile3DLayer({
                id: 'google-3d-tiles',
                data: 'https://tile.googleapis.com/v1/3dtiles/root.json',
                onTilesetLoad: tileset3d => {
                    tileset3d.options.onTraversalComplete = selectedTiles => {
                        const uniqueCredits = new Set();
                        selectedTiles.forEach(tile => {
                            const {copyright} = tile.content.gltf.asset;
                            copyright.split(';').forEach(uniqueCredits.add, uniqueCredits);
                        });
                        setCredits([...uniqueCredits].join('; '));
                        return selectedTiles;
                    };
                },
                _subLayerProps: {
                    scenegraph: {_lighting: 'flat'}
                },
                loadOptions: {
                    fetch: {headers: {'X-GOOG-API-KEY': import.meta.env.VITE_APP_GOOGLE_MAPS_API_KEY}}
                },
                operation: 'terrain+draw',
            }),
        ];
        setLayers(newLayers);
    };


    useEffect(() => {
        loadLayers(simulationLayerData);
    }, []);

    return (
        <div className={`deck-map-container`}>
            <DeckGL
                initialViewState={deckGLViewState}
                controller={true}
                layers={layers}
                onViewStateChange={onViewStateChange}
            >
                <div className={"credits"}>
                    {credits}
                </div>
            </DeckGL>
        </div>
    );
}

export default PhotoRealisticMap;

Environment

  • Framework version: deck.gl@8.9.35
  • Browser: Brave - Version 1.63.165 Chromium: 122.0.6261.94 (Official Build) (arm64)
  • OS: macOS

Logs

No response

@Pessimistress
Copy link
Collaborator

You may try setting farZMultiplier manually. The default far plane is calculated assuming everything is at sea level.

Meanwhile, I concur that this is not a great default behavior - ideally the camera should point at the altitude on the terrain surface and adjust its frustum accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants