Giter Club home page Giter Club logo

Comments (24)

vvoovv avatar vvoovv commented on September 23, 2024 2

An example b3dm file from the Aarhus data set: Tile_69_L18_00110.zip. Unzip it first.

The following code does convert the attached file Tile_69_L18_00110.b3dm to the glb format which Blender's glTF built-in addon can import.

The package py3dtiles is required:

pip install py3dtiles
from pathlib import Path

from py3dtiles.tileset.content import read_binary_tile_content

# input file
b3dmFile = "Tile_69_L18_00110.b3dm"
# output file
glbFile = "Tile_69_L18_00110.glb"

b3dm = read_binary_tile_content(Path(b3dmFile))
gltf = b3dm.body.gltf
with Path(glbFile).open('wb') as f:
    f.write(gltf.to_array())

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024 2

The following code does convert the attached file Tile_69_L18_00110.b3dm to the glb format which Blender's glTF built-in addon can import.

That code generates a glb file positioned at the origin. However it must be positioned somewhere on the Earth surface as it is the case with the Google 3D Tiles in the glb format.

I've found how to achieve that, so 3D tiles in both glb and b3dm formats can be processed in the same way by the Blosm addon.

from pathlib import Path

from py3dtiles.tileset.content import read_binary_tile_content

# input file
b3dmFile = Tile_69_L18_00110.b3dm"
# output file
glbFile = b3dmFile[:-4] + "glb"

b3dm = read_binary_tile_content(Path(b3dmFile))
gltf = b3dm.body.gltf
rtc_center = b3dm.body.feature_table.header.data.get("RTC_CENTER")
if rtc_center:
    gltf.header["nodes"] = [
        {'mesh': 0, 'translation': [rtc_center[0], rtc_center[2], -rtc_center[1]]}
    ]
with Path(glbFile).open('wb') as f:
    f.write(gltf.to_array())

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024 2

A new GUI:

image

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024 2

@jo-chemla

Both glb and b3dm tiles will be supported, as long as the resulting glb files can be imported by Blender's glTF importer.

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024 2

I was able to import some data sets:

  • Aarhus:

image

  • San-Francisco by Aerometrex:

image

I've been relying on the parameter geometricError to import a specific Level of Details. However the scales of this parameter are different in Google 3D Tiles and the above data sets. This has to be reconsidered.

The bounding volume is defined by a box in the Google 3D Tiles, while it's defined by a sphere in the above data sets. The intersection test of a box and a sphere also needs more attention.

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024 2

The scale of the geometric error is different from the one in Google 3D Tiles. I ended up entering it as a number.

The smaller the geometric error, the more detailed the imported scene will be. The first tile in the tileset's tree of tiles with the geometric error equal or less than the given one, will be imported.

To get a more detailed scene, the current value of the geometric error can be divided by two.

from blosm.

jo-chemla avatar jo-chemla commented on September 23, 2024 2

🚀 Impressive feature to allow importing of arbitrary tileset! Just added a few more open-data tileset.json to the other thread in case you want to try them out.

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024 2

the value region for the attribute boundingVolume

This feature is implemented. The remaining feature to be implemented is the attribute transform.


  • Saint Etienne by CRAIG:

image

from blosm.

jo-chemla avatar jo-chemla commented on September 23, 2024 1

Quick comment, b3dm is the ancestor version of OGC/Cesium 3D-tiles spec (the tiled mesh pendant of 3d-tiles, similar to pnts for tiled pointclouds, i3dm for instances and cmpt for composite) - see the release post introducing 3d-tiles next now 3d-tiles 1.1 spec - also see version history. So if you can read Google Photorealistic Cities, you already read OGC/3D-tiles 1.1 format.

CesiumGS/3d-tiles-tools and donmccurdy/glTF-Transform are useful tooling to convert and upgrade tilesets from the 1.0 version to the newest 1.1 version - but it usually requires processing the whole tileset, not meant for on-the-fly conversion. Although these are js packages, so you could use some of the underlying methods rather than using the CLI.

A long discussion here discusses whether the portion to merge tiles of a tileset to a single mesh should be part of 3d-tiles-tools or belong somewhere else. Also, donmccurdy was thinking about integrating 3d-tiles IO tooling to gltf-transform, see discussion here. Hope this is useful!

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024 1

Batched 3D Model (b3dm) was deprecated in 3D Tiles 1.1. See b3dm migration guide. From here.

image

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024 1

I think the feature is ready to be released.

Aarhus:

image


Helsinki:

image

from blosm.

jo-chemla avatar jo-chemla commented on September 23, 2024 1

The whole 3D-tiles spec is pretty complex, these are probably additions that you can bring forward in future iterations of your implementation:

  • regarding the boundingVolume, this can take 3 different forms from the spec, see here, box, region or sphere
  • tile transform is children matrixTranform relative to parent, see this extract or the more complex section 6.1.7.6 of the OGC spec

from blosm.

jo-chemla avatar jo-chemla commented on September 23, 2024 1

Really impressive work, congrats on your implementation!

Also looks like this is laying groundwork for a potential real-time implementation, like domlysz/BlenderGIS does for 2d tiles tms streaming

In that event, 3DTilesRendererJS, loadersgl and cesiumjs are great reference js implementations for selection of which tiles to load given a viewport.

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024 1

The current implementation is now released publicly. Install the version 2.7.9 of the addon.

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024

The first task is to load files with the extension b3dm into Blender. There is no built-in importer for them in Blender.

Google 3D Tiles use files with the externsion glb which can be loaded by Blender's built-in glTF importer.

An example b3dm file from the Aarhus data set: Tile_69_L18_00110.zip. Unzip it first.

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024

Neither py3dtiles nor the online viewer https://www.3dpea.com/en/view-B3DM-online can process b3dm files from the Helsinki data set.

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024

I added a stripped off package py3dtiles to blosm/threed_tiles. The package py3dtiles is required to read a b3dm file and save it as a glb file.

Below is the description of what was modified in the package py3dtiles (version 7.0.0 downloaded from here).

  • py3dtiles/typing.py: comment out from pyproj import CRS (line 17)

  • Remove unneeded folders:
    py3dtiles/tilers
    py3dtiles/reader

  • Remove unneeded files:
    py3dtiles/command_line.py
    py3dtiles/constants.py
    py3dtiles/convert.py
    py3dtiles/export.py
    py3dtiles/info.py
    py3dtiles/merger.py
    py3dtiles/merger.py
    py3dtiles/utils.py

from blosm.

jo-chemla avatar jo-chemla commented on September 23, 2024

Nice to see that custom tileset url within the UI! Will this work - in the end - only with version 1.0 3D-tiles tilesets (with tiles stored as b3dm) or also with 1.1 3D-Tiles (where tiles are actually glb)?

from blosm.

luccagandra avatar luccagandra commented on September 23, 2024

I'm trying to import NASA AMMOS's b3dm tile "https://raw.githubusercontent.com/NASA-AMMOS/3DTilesSampleData/master/msl-dingo-gap/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_colorize/0528_0260184_to_s64o256_colorize_tileset.json", but I'm getting the error 'BaseManager' object has no attribute 'setGeometricErrorRange'. Do you know how can I approach this problem?

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024

Hi @luccagandra

Import OGC is not yet available in the release version of the Blosm addon. The remaining think is implement checking if a sphere and a box intersect.

What is that data about?

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024

It's a pity that only 2 public data sets (Aarhus and Helsinki) are known at the moment. The data sets by Aerometrex are for a demonstration and of a low resolution.

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024

Just added a few more open-data tileset.json to the other thread in case you want to try them out.

The Blosm can not import any of them due to some features of the 3D Tiles specification that are not present in Google 3D Tiles and other data sets tested so far. Namely:

  • the attribute transform
  • the value region for the attribute boundingVolume

The task for now is to implement those missing features.

from blosm.

vvoovv avatar vvoovv commented on September 23, 2024

Also looks like this is laying groundwork for a potential real-time implementation

@jo-chemla What you use-cases do you see for this interactive viewing experience?

from blosm.

softyoda avatar softyoda commented on September 23, 2024

If I may respond, as a 3D graphic designer and not a developer, I think the addition of an "interactive" viewer (similar to Google Earth) could be a significant advantage in content creation, to move beyond the beaten paths of Google Earth Studio, and far beyond that, the uses are multiple. @jo-chemla has already opened a proposal on blender.community.

The support of an IO viewer (viewport as well as render) that has the ability to load tiles of certain detail levels (depending of pixel-projection-error) would have a real advantage, whether it's streamed data cached for rendering/preview, or data that would load more quickly from an NVMe drive. This would finally allow Blender to enter the competition of loading large scenes that were previously impossible (Blender limited between 10M and 100M poly depending on the hardware) where only Unreal Engine 5 or Clarisse IFX (or other internal software in large studios) have the capacity to render larger scenes.

I think that from my point of view, this greatly limits Blender's ability to cope with the multiple and varied uses sometimes required. Photogrammetry is almost inaccessible to Blender outside of scenes worked on and optimized only for a camera point of view (which greatly increases work friction and prevents the creative freedoms offered by new rendering engines with acceleration structures allowing the display of large content (via LOD/HLOD, Clusterized-decimation, virtual-texture and meshes, etc.)

I think having ways to load tiles from point of view (with/without frustum depending on if panoramic camera or else) would really help.
WCCFunrealengine52

from blosm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.