Giter VIP home page Giter VIP logo

gltf-to-3d-tiles's Introduction

gltf-to-3d-tiles's People

Contributors

crubier avatar deguerre avatar xuzhusheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gltf-to-3d-tiles's Issues

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

Error converting glb files to 3d tiles

system Env: windows 10
python Version: 3.10.6

Traceback (most recent call last):
File "C:\Users\ming\Desktop\work\gltf-to-3d-tiles\main.py", line 80, in
app()
File "C:\Users\ming\AppData\Local\Programs\Python\Python310\lib\site-packages\typer\main.py", line 214, in call
return get_command(self)(*args, **kwargs)
File "C:\Users\ming\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1130, in call
return self.main(*args, **kwargs)
File "C:\Users\ming\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1055, in main
rv = self.invoke(ctx)
File "C:\Users\ming\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\ming\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\ming\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke
return _callback(*args, **kwargs)
File "C:\Users\ming\AppData\Local\Programs\Python\Python310\lib\site-packages\typer\main.py", line 500, in wrapper
return callback(**use_params) # type: ignore
File "C:\Users\ming\Desktop\work\gltf-to-3d-tiles\main.py", line 33, in tileset
gltf_to_tileset(fin, fout, measure, up_direction)
File "C:\Users\ming\Desktop\work\gltf-to-3d-tiles\converter\gltf_to_tileset.py", line 75, in gltf_to_tileset
gltf, buffers = io.read_gltf(fin)
File "C:\Users\ming\Desktop\work\gltf-to-3d-tiles\gltf\io.py", line 14, in read_gltf
data = json.load(f)
File "C:\Users\ming\AppData\Local\Programs\Python\Python310\lib\json_init
.py", line 293, in load
return loads(fp.read(),
File "C:\Users\ming\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x88 in position 8: invalid start byte

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.

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

tiles set values incorrect

I converted some models into tiles-set getting incorrect bounding box volume values, that reason only some tiles loading on fit view.

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?

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

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.

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

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.

转换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`

Assign latitude/longitude ?

Hello, is it possible with this exporter to assign latitude/longitude/altitude for tileset calculations ?

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?

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.