gwaldron / osgearth

3D Maps for OpenSceneGraph / C++14
https://www.pelicanmapping.com/home-1/opensource
Other
1.48k stars 774 forks source link

Cannot load 3dtiles by CesiumNative3DTiles layer #2457

Closed shiner-chen closed 6 months ago

shiner-chen commented 6 months ago

Describe the bug I try to load a local 3DTiles model by osgearthviewer, but It show a white globe and return **"[EarthSerializer2] Failed to find an extension for cesiumnative3dtiles"**. So I tested the online model by the below earth file which come from the offical document, I get the same error.

<map name="CesiumNatives 3DTiles">
    <CesiumNative3DTiles name="agi">
        <url>https://pelican-public.s3.amazonaws.com/3dtiles/agi-hq/tileset.json</url>
    </CesiumNative3DTiles>
</map>

To Reproduce The following is run log:

PS F:\osgearth\tests> osgearth_viewer.exe .\agi-3dtiles.earth
[osgearth info] Hello, world.
[osgearth info] [Capabilities] osgEarth Version:  3.5.0 build 150
[osgearth info] [Capabilities] GDAL Version:      3.8.4
[osgearth info] [Capabilities] OSG Version:       3.6.5
[osgearth info] [Capabilities] OSG GL3 Features:  yes
[osgearth info] [Capabilities] OSG FFP Available: no
[osgearth info] [Capabilities] CPU Cores:         20
[osgearth info] [Capabilities] GL_VENDOR:         NVIDIA Corporation
[osgearth info] [Capabilities] GL_RENDERER:       NVIDIA GeForce RTX 2050/PCIe/SSE2
[osgearth info] [Capabilities] GL_VERSION:        3.3.0 NVIDIA 528.02
[osgearth info] [Capabilities] GL CORE Profile:   yes
[osgearth info] [Map] Map profile is: [srs=WGS84, min=-180,-90 max=180,90 ar=2:1 vdatum=geodetic]
[osgearth info] [Map] [no cache]
[osgearth info] [EarthSerializer2] Failed to find an extension for cesiumnative3dtiles_
[osgearth info] [engine_rex] Activated!
[osgearth info] [TerrainResources] Texture unit 1 reserved for Terrain Color
[osgearth info] [TerrainResources] Texture unit 2 reserved for Terrain Elevation
[osgearth info] [TerrainResources] Texture unit 3 reserved for Terrain Normals
[osgearth info] [TerrainResources] Texture unit 4 reserved for Terrain Parent Color
[osgearth info] [TerrainResources] Texture unit 5 reserved for Terrain Land Cover
[osgearth info] [RexTerrainEngineNode] Creating 2 root keys.
[osgearth info] [MapNodeHelper] Activating logarithmic depth buffer (vertex-only) on main camera
Warning: GraphicsWindowWin32::grabFocus() - Failed grabbing the focus
PS F:\osgearth\tests> cat .\agi-3dtiles.earth
<map name="CesiumNatives 3DTiles">
    <CesiumNative3DTiles name="agi">
        <url>https://pelican-public.s3.amazonaws.com/3dtiles/agi-hq/tileset.json</url>
    </CesiumNative3DTiles>
</map>
PS F:\osgearth\tests>

I try to use the CesiumIon3DTiles layer to load 3dtiles from cesium ion, it can run successfully!, The earth file is as follows:

<map name="Cesium ion">
    <CesiumIonImage name="Bing Maps Aerial With Labels">
        <asset_id>3</asset_id>
    </CesiumIonImage>
    <CesiumIon3DTiles name="Melbourne">
        <asset_id>69380</asset_id>
    </CesiumIon3DTiles>

</map>

Log:

PS F:\osgearth\tests> osgearth_viewer.exe .\cesiumion.earth
[osgearth info] Hello, world.
[osgearth info] [Capabilities] osgEarth Version:  3.5.0 build 150
[osgearth info] [Capabilities] GDAL Version:      3.8.4
[osgearth info] [Capabilities] OSG Version:       3.6.5
[osgearth info] [Capabilities] OSG GL3 Features:  yes
[osgearth info] [Capabilities] OSG FFP Available: no
[osgearth info] [Capabilities] CPU Cores:         20
[osgearth info] [Capabilities] GL_VENDOR:         NVIDIA Corporation
[osgearth info] [Capabilities] GL_RENDERER:       NVIDIA GeForce RTX 2050/PCIe/SSE2
[osgearth info] [Capabilities] GL_VERSION:        3.3.0 NVIDIA 528.02
[osgearth info] [Capabilities] GL CORE Profile:   yes
[osgearth info] [Map] Map profile is: [srs=WGS84, min=-180,-90 max=180,90 ar=2:1 vdatum=geodetic]
[osgearth info] [Map] [no cache]
[osgearth info] [BingImageLayer] Bing Maps Aerial With Labels [srs=Spherical Mercator, min=-20037508.34278925,-20037508.34278925 max=20037508.34278925,20037508.34278925 ar=2:2 vdatum=geodetic] [no cache]
[osgearth info] [CesiumIonImageLayer] Bing Maps Aerial With Labels [srs=Spherical Mercator, min=-20037508.34278925,-20037508.34278925 max=20037508.34278925,20037508.34278925 ar=2:2 vdatum=geodetic] [no cache]
[osgearth info] [CesiumIonImageLayer] Bing Maps Aerial With Labels Map/Layer profiles differ; requesting L2 cache
[osgearth info] [CesiumIonImageLayer] Bing Maps Aerial With Labels L2 cache size = 16
[osgearth info] [engine_rex] Activated!
[osgearth info] [TerrainResources] Texture unit 1 reserved for Terrain Color
[osgearth info] [TerrainResources] Texture unit 2 reserved for Terrain Elevation
[osgearth info] [TerrainResources] Texture unit 3 reserved for Terrain Normals
[osgearth info] [TerrainResources] Texture unit 4 reserved for Terrain Parent Color
[osgearth info] [TerrainResources] Texture unit 5 reserved for Terrain Land Cover
[osgearth info] [RexTerrainEngineNode] Creating 2 root keys.
[osgearth info] [MapNodeHelper] Activating logarithmic depth buffer (vertex-only) on main camera
Warning: GraphicsWindowWin32::grabFocus() - Failed grabbing the focus
Now checking for plug-in osgPlugins-3.6.5/osgdb_fastdxt.dll
osg::Registry::addImageProcessor(ImageProcessor)
Loaded plug-in osgPlugins-3.6.5/osgdb_fastdxt.dll and located ImageProcessor
osg::Registry::removeImageProcessor();
PS F:\osgearth\tests>

screenshot: image

Expected behavior Osgearth_viewer should load the 3dtiles by CesiumNative3DTiles layer. What's wrong wth the osgearth? How to resolve this error?

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

jasonbeverage commented 6 months ago

You need to preload the osgEarthCesium library if your application doesn't link to it by adding it to your earth file like this:

<map name="CesiumNatives 3DTiles">
    <libraries>osgEarthCesium</libraries>
    <CesiumNative3DTiles name="agi">
        <url>https://pelican-public.s3.amazonaws.com/3dtiles/agi-hq/tileset.json</url>
    </CesiumNative3DTiles>
</map>
shiner-chen commented 6 months ago

@jasonbeverage according to your comment, I modified the earth file, but I still get the white globe. The log is as follows:

PS F:\osgearth\tests> osgearth_viewer.exe .\agi-3dtiles.earth
[osgearth info] Hello, world.
[osgearth info] [Capabilities] osgEarth Version:  3.5.0 build 150
[osgearth info] [Capabilities] GDAL Version:      3.8.4
[osgearth info] [Capabilities] OSG Version:       3.6.5
[osgearth info] [Capabilities] OSG GL3 Features:  yes
[osgearth info] [Capabilities] OSG FFP Available: no
[osgearth info] [Capabilities] CPU Cores:         20
[osgearth info] [Capabilities] GL_VENDOR:         NVIDIA Corporation
[osgearth info] [Capabilities] GL_RENDERER:       NVIDIA GeForce RTX 2050/PCIe/SSE2
[osgearth info] [Capabilities] GL_VERSION:        3.3.0 NVIDIA 528.02
[osgearth info] [Capabilities] GL CORE Profile:   yes
[osgearth info] [EarthSerializer2] Loaded library osgEarthCesium.dll
[osgearth info] [Map] Map profile is: [srs=WGS84, min=-180,-90 max=180,90 ar=2:1 vdatum=geodetic]
[osgearth info] [Map] [no cache]
[osgearth info] [engine_rex] Activated!
[osgearth info] [TerrainResources] Texture unit 1 reserved for Terrain Color
[osgearth info] [TerrainResources] Texture unit 2 reserved for Terrain Elevation
[osgearth info] [TerrainResources] Texture unit 3 reserved for Terrain Normals
[osgearth info] [TerrainResources] Texture unit 4 reserved for Terrain Parent Color
[osgearth info] [TerrainResources] Texture unit 5 reserved for Terrain Land Cover
[osgearth info] [RexTerrainEngineNode] Creating 2 root keys.
[osgearth info] [MapNodeHelper] Activating logarithmic depth buffer (vertex-only) on main camera
PS F:\osgearth\tests>
shiner-chen commented 6 months ago

After set environment OSGEARTH_HTTP_DEBUG=1, I get the following log,

PS F:\osgearth\tests> osgearth_viewer.exe .\agi-3dtiles.earth
[osgearth info] Hello, world.
[osgearth info] [Capabilities] osgEarth Version:  3.5.0 build 150
[osgearth info] [Capabilities] GDAL Version:      3.8.4
[osgearth info] [Capabilities] OSG Version:       3.6.5
[osgearth info] [Capabilities] OSG GL3 Features:  yes
[osgearth info] [Capabilities] OSG FFP Available: no
[osgearth info] [Capabilities] CPU Cores:         20
[osgearth info] [Capabilities] GL_VENDOR:         NVIDIA Corporation
[osgearth info] [Capabilities] GL_RENDERER:       NVIDIA GeForce RTX 2050/PCIe/SSE2
[osgearth info] [Capabilities] GL_VERSION:        3.3.0 NVIDIA 528.02
[osgearth info] [Capabilities] GL CORE Profile:   yes
[osgearth info] [EarthSerializer2] Loaded library osgEarthCesium.dll
[osgearth info] [Map] Map profile is: [srs=WGS84, min=-180,-90 max=180,90 ar=2:1 vdatum=geodetic]
[osgearth info] [Map] [no cache]
[osgearth info] [HTTPClient] HTTP debugging enabled
[osgearth info] [engine_rex] Activated!
[osgearth info] [TerrainResources] Texture unit 1 reserved for Terrain Color
[osgearth info] [TerrainResources] Texture unit 2 reserved for Terrain Elevation
[osgearth info] [TerrainResources] Texture unit 3 reserved for Terrain Normals
[osgearth info] [TerrainResources] Texture unit 4 reserved for Terrain Parent Color
[osgearth info] [TerrainResources] Texture unit 5 reserved for Terrain Land Cover
[osgearth info] [RexTerrainEngineNode] Creating 2 root keys.
[osgearth info] [MapNodeHelper] Activating logarithmic depth buffer (vertex-only) on main camera
[osgearth info] [HTTPClient] GET(200) application/json: https://pelican-public.s3.amazonaws.com/3dtiles/agi-hq/tileset.json (Wed, 30 Sep 2020 15:44:02 GMT) t=1.466s

I have verified the http link, I can get the context from chrome browser. image

jasonbeverage commented 6 months ago

You'll have to zoom into Exton PA to see the dataset, it's just a small building and not a whole globe dataset.

On Sun, Mar 3, 2024 at 8:11 PM shiner-chen @.***> wrote:

After set environment OSGEARTH_HTTP_DEBUG=1, I get the following log,

PS F:\osgearth\tests> osgearth_viewer.exe .\agi-3dtiles.earth [osgearth info] Hello, world. [osgearth info] [Capabilities] osgEarth Version: 3.5.0 build 150 [osgearth info] [Capabilities] GDAL Version: 3.8.4 [osgearth info] [Capabilities] OSG Version: 3.6.5 [osgearth info] [Capabilities] OSG GL3 Features: yes [osgearth info] [Capabilities] OSG FFP Available: no [osgearth info] [Capabilities] CPU Cores: 20 [osgearth info] [Capabilities] GL_VENDOR: NVIDIA Corporation [osgearth info] [Capabilities] GL_RENDERER: NVIDIA GeForce RTX 2050/PCIe/SSE2 [osgearth info] [Capabilities] GL_VERSION: 3.3.0 NVIDIA 528.02 [osgearth info] [Capabilities] GL CORE Profile: yes [osgearth info] [EarthSerializer2] Loaded library osgEarthCesium.dll [osgearth info] [Map] Map profile is: [srs=WGS84, min=-180,-90 max=180,90 ar=2:1 vdatum=geodetic] [osgearth info] [Map] [no cache] [osgearth info] [HTTPClient] HTTP debugging enabled [osgearth info] [engine_rex] Activated! [osgearth info] [TerrainResources] Texture unit 1 reserved for Terrain Color [osgearth info] [TerrainResources] Texture unit 2 reserved for Terrain Elevation [osgearth info] [TerrainResources] Texture unit 3 reserved for Terrain Normals [osgearth info] [TerrainResources] Texture unit 4 reserved for Terrain Parent Color [osgearth info] [TerrainResources] Texture unit 5 reserved for Terrain Land Cover [osgearth info] [RexTerrainEngineNode] Creating 2 root keys. [osgearth info] [MapNodeHelper] Activating logarithmic depth buffer (vertex-only) on main camera [osgearth info] [HTTPClient] GET(200) application/json: https://pelican-public.s3.amazonaws.com/3dtiles/agi-hq/tileset.json (Wed, 30 Sep 2020 15:44:02 GMT) t=1.466s

I have verified the http link, I can get the context from chrome browser. image.png (view on web) https://github.com/gwaldron/osgearth/assets/12945934/bebf9206-b779-42b3-b30f-ed479a4142eb

— Reply to this email directly, view it on GitHub https://github.com/gwaldron/osgearth/issues/2457#issuecomment-1975479340, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACPXYTKJRJNVTQ2D2TL6L3YWPC5PAVCNFSM6AAAAABEBIKWF6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZVGQ3TSMZUGA . You are receiving this because you were mentioned.Message ID: @.***>

shiner-chen commented 6 months ago

It's ok now, I can see it, thank a lot! I have another question and I use the same earth just replace the uri with google photorealistic 3d tilesphotorealistic http link as follows, I get error: "Errors when loading tileset: ". How to deal with it? Thanks.

<map>
<libraries>osgEarthCesium</libraries>
<CesiumNative3DTiles name="Google Tiles">
    <url>https://tile.googleapis.com/v1/3dtiles/root.json?key=AIzaSyC9BsFXN7nV2uNlPjk3TfAArSA5FiJOBvc</url>
</CesiumNative3DTiles>
</map>

Log:

PS F:\osgearth\tests> osgearth_viewer.exe .\google-3dtiles.earth
[osgearth info] Hello, world.
[osgearth info] [Capabilities] osgEarth Version:  3.5.0 build 150
[osgearth info] [Capabilities] GDAL Version:      3.8.4
[osgearth info] [Capabilities] OSG Version:       3.6.5
[osgearth info] [Capabilities] OSG GL3 Features:  yes
[osgearth info] [Capabilities] OSG FFP Available: no
[osgearth info] [Capabilities] CPU Cores:         20
[osgearth info] [Capabilities] GL_VENDOR:         NVIDIA Corporation
[osgearth info] [Capabilities] GL_RENDERER:       NVIDIA GeForce RTX 2050/PCIe/SSE2
[osgearth info] [Capabilities] GL_VERSION:        3.3.0 NVIDIA 528.02
[osgearth info] [Capabilities] GL CORE Profile:   yes
[osgearth info] [EarthSerializer2] Loaded library osgEarthCesium.dll
[osgearth info] [Map] Map profile is: [srs=WGS84, min=-180,-90 max=180,90 ar=2:1 vdatum=geodetic]
[osgearth info] [Map] [no cache]
[osgearth info] [HTTPClient] HTTP debugging enabled
[osgearth info] [engine_rex] Activated!
[osgearth info] [TerrainResources] Texture unit 1 reserved for Terrain Color
[osgearth info] [TerrainResources] Texture unit 2 reserved for Terrain Elevation
[osgearth info] [TerrainResources] Texture unit 3 reserved for Terrain Normals
[osgearth info] [TerrainResources] Texture unit 4 reserved for Terrain Parent Color
[osgearth info] [TerrainResources] Texture unit 5 reserved for Terrain Land Cover
[osgearth info] [HTTPClient] GET(0) : https://tile.googleapis.com/v1/3dtiles/root.json?key=AIzaSyC9BsFXN7nV2uNlPjk3TfAArSA5FiJOBvc (Thu, 01 Jan 1970 00:00:00 GMT) t=0.04464s
[osgearth info] [RexTerrainEngineNode] Creating 2 root keys.
[osgearth info] [MapNodeHelper] Activating logarithmic depth buffer (vertex-only) on main camera
[2024-03-04 09:50:06.867] [error] [ErrorList.h:72] Errors when loading tileset:
- Error when parsing tileset JSON, error code 1 at byte offset 0