glTF to 3d Tiles Converter. Convert glTF model to Glb, b3dm or 3d tiles format.

Overview

gltf-to-3d-tiles

glTF to 3d Tiles Converter. Convert glTF model to Glb, b3dm or 3d tiles format.

Usage


λ python main.py  --help
Usage: main.py [OPTIONS] COMMAND [ARGS]...

Options:
  --install-completion [bash|zsh|fish|powershell|pwsh]
                                  Install completion for the specified shell.
  --show-completion [bash|zsh|fish|powershell|pwsh]
                                  Show completion for the specified shell, to
                                  copy it or customize the installation.
  --help                          Show this message and exit.

Commands:
  b3dm     convert gltf to b3dm
  glb      convert gltf to glb
  tileset  split gltf model to 3d tiles

Glb

λ python main.py glb --help
Usage: main.py glb [OPTIONS] FIN [FOUT]

  convert gltf to glb

Arguments:
  FIN     input gltf path  [required]
  [FOUT]  Optional output glb path (defaults to the path of the input file)

Options:
  --help  Show this message and exit.

b3dm

 λ python main.py b3dm --help
Usage: main.py b3dm [OPTIONS] FIN [FOUT]

  convert gltf to b3dm

Arguments:
  FIN     input gltf path  [required]
  [FOUT]  Optional output b3dm path(defaults to the path of the input file)

Options:
  --help  Show this message and exit.

3d tiles

 λ python main.py tileset --help
Usage: main.py tileset [OPTIONS] FIN [FOUT]

  split gltf model to 3d tiles

Arguments:
  FIN     input gltf path  [required]
  [FOUT]  Optional output glb path (defaults to the path of the input file)

Options:
  --measure [meter|foot]  measure of attributes in gltf buffers  [default:
                          Measure.METER]
  --help                  Show this message and exit.
Comments
  • read_gltf

    read_gltf

    when i put a gltf path in b3dm() or other function ,it has fault like:
    OSError: [Errno 63] File name too long: '/Users/zc/work/test/data:application/octet-stream;base64
    this is why?how i can solve this problem or how can i convert gltf to b3dm or 3dtiles?

    opened by gisonjourney 7
  • Tiles from GLTF missing texture

    Tiles from GLTF missing texture

    Original GLTF has a texture assigned and is pre-tiled as you can see in the picture Screenshot 2022-11-08 135501 I am trying to generate a tileset based on the GLTF, after executing the command

    python main.py tileset path_to_gltf.gtlf

    the tileset.json as well as the .b3dm files corresponding to the tiles are generated successfully. Upon loading the 3D tiles in a 3D viewer the texture is missing from most of the tiles. I also tried loading the tiles in a Cesium-based viewer and the textures are also missing. What would be the solution here? I saw that there are some recent commits addressing texture issues, maybe this problem is related? Let me know if this information is enough, thanks for looking into it.

    Screenshot 2022-11-08 143437

    opened by ManosAgelidis 6
  • TypeError: 'NoneType' object is not iterable

    TypeError: 'NoneType' object is not iterable

    Execute the command: python .\main.py glb demo.gltf demo.glb prompts the following error,how to fix?

    Traceback (most recent call last): File "\gltf-to-3d-tiles-main\main.py", line 104, in app() File " \lib\site-packages\typer\main.py", line 214, in call return get_command(self)(*args, **kwargs) File " \lib\site-packages\click\core.py", line 1128, in call return self.main(*args, **kwargs) File " \lib\site-packages\click\core.py", line 1053, in main rv = self.invoke(ctx) File " \lib\site-packages\click\core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File " \lib\site-packages\click\core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File " \lib\site-packages\click\core.py", line 754, in invoke return __callback(*args, **kwargs) File " \lib\site-packages\typer\main.py", line 500, in wrapper return callback(**use_params) # type: ignore File " \gltf-to-3d-tiles-main\main.py", line 85, in glb copy_textures(fin, fout, gltf.images) File " \gltf-to-3d-tiles-main\main.py", line 50, in copy_textures for image in images: TypeError: 'NoneType' object is not iterable

    bug 
    opened by Kashgar 5
  • 转换gltf to 3dtils 报错,请问怎么处理

    转换gltf to 3dtils 报错,请问怎么处理

    `PS \gltf-to-3d-tiles-main> python .\main.py tileset .\0input\shenzhenxiaoxue.gltf Traceback (most recent call last):

    File ".\main.py", line 80, in app()

    File ".\main.py", line 33, in tileset gltf_to_tileset(fin, fout, measure, up_direction)

    File "D:\Users\hpl\Downloads\Compressed\gltf-to-3d-tiles-main_2\gltf-to-3d-tiles-main\converter\gltf_to_tileset.py", line 79, in gltf_to_tileset tiles = list(map(lambda id: Tile(content_id=id, instance_box=gltf_slicer.get_bounding_box(

    File "D:\Users\hpl\Downloads\Compressed\gltf-to-3d-tiles-main_2\gltf-to-3d-tiles-main\converter\gltf_to_tileset.py", line 80, in id), instances_matrices=gltf_slicer.get_matrices(id), matrix=Matrix4(), gltf=gltf_slicer.slice_mesh(id).as_bytes(), extras=gltf_slicer.get_extras(id)), range(gltf_slicer.meshes_count)))

    File "D:\Users\hpl\Downloads\Compressed\gltf-to-3d-tiles-main_2\gltf-to-3d-tiles-main\gltf\slicer.py", line 125, in slice_mesh return self.slice_primitives(self.meshes[mesh_id].primitives)

    File "D:\Users\hpl\Downloads\Compressed\gltf-to-3d-tiles-main_2\gltf-to-3d-tiles-main\gltf\slicer.py", line 89, in slice_primitives return Glb([self.__get_buffer(buffer_view_indices)], meshes=self.__get_meshes(primitives, accessor_indices, material_indices), accessors=self.__get_accessors(accessor_indices, buffer_view_indices),

    File "D:\Users\hpl\Downloads\Compressed\gltf-to-3d-tiles-main_2\gltf-to-3d-tiles-main\gltf\slicer.py", line 152, in __get_buffer view = self.buffer_views[index]

    TypeError: list indices must be integers or slices, not NoneType`

    wontfix 
    opened by h-pl 2
  • simple model: too many operations

    simple model: too many operations

    Hi! I have a GLB-file with cube model that I want view in the cesium (cube.glb). Trying to generate tiles produces the result:

    {
        "asset": {
            "version": "1.0",
            "tilesetVersion": "1.0.0.0"
        },
        "geometricError": 6.928203230275509,
        "root": {
            "boundingVolume": {
                "box": [
                    0.0, 0.0, 0.0,
                    2.0, 0, 0,
                    0, 2.0, 0,
                    0, 0, 2.0
                ]
            },
            "geometricError": 6.928203230275509,
            "refine": "ADD",
            "children": [
                {
                    "boundingVolume": {
                        "box": [
                            0.0, 0.0, 0.0,
                            1.0, 0, 0,
                            0, 1.0, 0,
                            0, 0, 1.0
                        ]
                    },
                    "geometricError": 6.928203230275509,
                    "transform": [
                        2.0, 0.0, 0.0, 0.0, 
                        0.0, 2.0, 0.0, 0.0,
                        0.0, 0.0, 2.0, 0.0,
                        0.0, 0.0, 0.0, 1.0
                    ],
                    "content": {
                        "uri": "0.b3dm"
                    }
                }
            ]
        }
    }
    

    Q: Is the transform section positioned correctly?

    In order to get the correct result in a cesium, I have to generate a b3dm file (b3dm mode), replace name inside uri section and move the transform section to the correct place and change it's content. It seems to me that there are too many operations.

    invalid 
    opened by skemaikin 2
  • Default to First Scene if None

    Default to First Scene if None

    I generated a .gltf file using another tool. When processing it with gltf-to-3d-tiles, I found that self.scene = None in Slicer.__init__().

    This is easily fixed by setting self.scene = 0 to make the tool resilient, though it is probably an error in the previous tool that I used that caused no scene to be set in that resulting data.

    A high-level error message could be preferable to this:

    File "...\gltf-to-3d-tiles\gltf\slicer.py", line 24, in __init__
        root = self.scenes[self.scene].nodes[0]
    TypeError: list indices must be integers or slices, not **NoneType**
    
    bug 
    opened by dagrooms52 2
  • Can you provide a valid file?

    Can you provide a valid file?

    Thank you for writing this tool. I want to convert a gltf/glb file to b3dm. But EVERY file I tried throws errors.

    some errors:

     (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 8: invalid continuation byte
    
     Glb(buffers, **gltf.as_dict(False)).as_bytes()).as_bytes())
    TypeError: Glb.__init__() got multiple values for argument 'buffers'
    

    I've tried to tweak some codes but no luck.

    I wonder if my files are broken or my environment got something wrong.

    One of the test files: https://models.babylonjs.com/aerobatic_plane.glb

    What's the expected python version to run this tool? I'm using 3.10.

    opened by yuqianma 1
  • Specify adjustment transform

    Specify adjustment transform

    Hi, is there a way to apply an adjustment transform? I need to adjust the position of the 3d tiles. This works on Cesium ion, it adds a transform array but I would like to be able to do this kind of thing with this library or is there a way to patch the generated tileset.json file?

    opened by adoug 1
  • Option to not apply z-up to y-up transformations

    Option to not apply z-up to y-up transformations

    I have some glTF files which are in z-up coordinates (i.e. they came in UTM-ish coordinates). It would be useful if there was an option to tell the converter not to apply the Z_UP_TO_Y_UP_MATRIX when generating tilesets.

    enhancement 
    opened by Deguerre 1
  • Handle multiple buffers correctly

    Handle multiple buffers correctly

    Handle the case where a glTF file has multiple buffers. This has the nice effect of reducing memory usage and tile size considerably, if you create a glTF with one buffer per mesh or per bufferView.

    There are also some fixes for buffer alignment. Tilesets are now almost clean if you run them through CesiumGS/3d-tiles-validator. (And by "almost", I mean "not yet".)

    opened by Deguerre 0
  • Better transform and texture handling

    Better transform and texture handling

    • Apply translation/rotation/scale if present (and matrix is not).
    • Calculate geometricError on the transformed box, to handle scaling correctly.
    • Fix a couple of bugs in the handling of textures: textures[i].source does not necessarily point to images[i], and samplers were not being copied across to the glbm.
    • Fix handling of metres vs feet.
    opened by Deguerre 0
  • Generated tileset is incorrect

    Generated tileset is incorrect

    opened by adoug 1
  • Big memory usage

    Big memory usage

    Hi,

    I'm trying the CLI to convert a 16MB glTF to 3d-tiles and the process takes more than 10 BG of RAM until it is killed by my kernel.

    The gltf file uses big coordinates (up to ~5 000 000), I don't know if it may be related.

    python main.py tileset building.gltf outputs/
    

    building.zip

    enhancement 
    opened by Amoki 1
Owner
null
Tile Map Service and OGC Tiles API for QGIS Server

Tiles API Add tiles API to QGIS Server Tiles Map Service API OGC Tiles API Tile Map Service API - TMS The TMS API provides these URLs: /tms/? to get i

3Liz 6 Dec 1, 2021
Deal with Bing Maps Tiles and Pixels / WGS 84 coordinates conversions, and generate grid Shapefiles

PyBingTiles This is a small toolkit in order to deal with Bing Tiles, used i.e. by Facebook for their Data for Good datasets. Install Clone this repos

Shoichi 1 Dec 8, 2021
Spatial Interpolation Toolbox is a Python-based GUI that is able to interpolate spatial data in vector format.

Spatial Interpolation Toolbox This is the home to Spatial Interpolation Toolbox, a graphical user interface (GUI) for interpolating geographic vector

Michael Ward 2 Nov 1, 2021
An API built to format given addresses using Python and Flask.

An API built to format given addresses using Python and Flask. About The API returns properly formatted data, i.e. removing duplicate fields, distingu

null 1 Feb 27, 2022
Hapi is a Python library for building Conceptual Distributed Model using HBV96 lumped model & Muskingum routing method

Current build status All platforms: Current release info Name Downloads Version Platforms Hapi - Hydrological library for Python Hapi is an open-sourc

Mostafa Farrag 15 Dec 26, 2022
OSMnx: Python for street networks. Retrieve, model, analyze, and visualize street networks and other spatial data from OpenStreetMap.

OSMnx OSMnx is a Python package that lets you download geospatial data from OpenStreetMap and model, project, visualize, and analyze real-world street

Geoff Boeing 4k Jan 8, 2023
Yet Another Time Series Model

Yet Another Timeseries Model (YATSM) master v0.6.x-maintenance Build Coverage Docs DOI | About Yet Another Timeseries Model (YATSM) is a Python packag

Chris Holden 60 Sep 13, 2022
Django model field that can hold a geoposition, and corresponding widget

django-geoposition A model field that can hold a geoposition (latitude/longitude), and corresponding admin/form widget. Prerequisites Starting with ve

Philipp Bosch 324 Oct 17, 2022
A short term landscape evolution using a path sampling method to solve water and sediment flow continuity equations and model mass flows over complex topographies.

r.sim.terrain A short-term landscape evolution model that simulates topographic change for both steady state and dynamic flow regimes across a range o

Brendan Harmon 7 Oct 21, 2022
ESMAC diags - Earth System Model Aerosol-Cloud Diagnostics Package

Earth System Model Aerosol-Cloud Diagnostics Package This Earth System Model (ES

Pacific Northwest National Laboratory 1 Jan 4, 2022
Using Global fishing watch's data to build a machine learning model that can identify illegal fishing and poaching activities through satellite and geo-location data.

Using Global fishing watch's data to build a machine learning model that can identify illegal fishing and poaching activities through satellite and geo-location data.

Ayush Mishra 3 May 6, 2022
Universal Office Converter - Convert between any document format supported by LibreOffice/OpenOffice.

Automated conversion and styling using LibreOffice Universal Office Converter (unoconv) is a command line tool to convert any document format that Lib

null 2.4k Jan 3, 2023
[WWW 2021 GLB] New Benchmarks for Learning on Non-Homophilous Graphs

New Benchmarks for Learning on Non-Homophilous Graphs Here are the codes and datasets accompanying the paper: New Benchmarks for Learning on Non-Homop

null 94 Dec 21, 2022
Django-Text-to-HTML-converter - The simple Text to HTML Converter using Django framework

Django-Text-to-HTML-converter This is the simple Text to HTML Converter using Dj

Nikit Singh Kanyal 6 Oct 9, 2022
Cloud-optimized, single-file archive format for pyramids of map tiles

PMTiles PMTiles is a single-file archive format for tiled data. A PMTiles archive can be hosted on a commodity storage platform such as S3, and enable

Protomaps 325 Jan 4, 2023
Json2Xml tool will help you convert from json COCO format to VOC xml format in Object Detection Problem.

JSON 2 XML All codes assume running from root directory. Please update the sys path at the beginning of the codes before running. Over View Json2Xml t

Nguyễn Trường Lâu 6 Aug 22, 2022
Png2Jpg tool will help you convert from png image format to jpg images format.

PNG 2 JPG All codes assume running from root directory. Please update the sys path at the beginning of the codes before running. Over View Png2Jpg too

Nguyễn Trường Lâu 2 Dec 27, 2021
Txt2Xml tool will help you convert from txt COCO format to VOC xml format in Object Detection Problem.

TXT 2 XML All codes assume running from root directory. Please update the sys path at the beginning of the codes before running. Over View Txt2Xml too

Nguyễn Trường Lâu 4 Nov 24, 2022
A Python script for rendering glTF files with V-Ray App SDK

V-Ray glTF viewer Overview The V-Ray glTF viewer is a set of Python scripts for the V-Ray App SDK that allow the parsing and rendering of glTF (.gltf

Chaos 24 Dec 5, 2022