CesiumGS / 3d-tiles-tools

Apache License 2.0
290 stars 43 forks source link

Consider convenience functions to create instanced models #84

Open javagl opened 10 months ago

javagl commented 10 months ago

There currently is a glbToI3dm command that takes a GLB file and generates an I3DM from that. This I3DM contains a single instance. This is of somewhat limited use, considering that I3DM is now considered a 'legacy' format, and there is no longer any benefit of wrapping a GLB into such an I3DM.

We could consider to create utility functions for creating real instanced models.

(The output should preferably be GLBs with EXT_mesh_gpu_instancing extension, but we could also look at creating I3DM (maybe with URI as payload), if it's considered to be worth the effort)

In terms of implementing the functionality itself, this could be a pretty low-hanging fruit. The ExtInstanceFeaturesDemo.ts already shows that creating such a GLB from a bunch of translations is trivial.

The main degree of freedom is: Where does the instancing information come from?

A pragmatic (and generic) first shot could be to just use some JSON file with information like

{
    translations: [
        [1,2,3],
        [2,3,4],
    },
    rotations: [
        [0,0,0,1],
        [0,1,0,0],
    },
    scales: [
        [1,1,1],
        [2,2,2],
    }
}

Apparently, there are sources for data that could be relevant for creating such instanced models. For example, @bertt mentioned in the forum that opentrees.org could be a source for creating instanced tree models. Other sources of instancing information could be databases with the locations of wind power plants, for example. Maybe there could even be a thin convenience layer that takes longitude/latitude/height information and converts that into the low-level translation/rotation/scale information.

qwork2010 commented 2 weeks ago

Hello ! I have already created a windmill gltf model and want to generate 1000 instances of this windmill (Instanced 3D Model, i3dm). I already have 1000 coordinates (longitude, latitude, altitude) and directions (azimuth, elevation). How should I use these positions and directions to generate corresponding 1000 windmill instance 3D models?

老师,您好! 我现在已经创建了一个风车gltf模型,想生成这个风车模型的1000个实例(Instanced 3D Model,i3dm)。已经有了1000个坐标(经度、维度、高度)和方向(方位角、俯仰角),请问应该怎么利用这些位置和方向生成对应的1000个风车实例三维模型?

bertt commented 2 weeks ago

@qwork2010 one option https://github.com/Geodan/i3dm.export

javagl commented 2 weeks ago

@qwork2010 The required functionality has not (yet) been implemented as part of the 3D Tiles Tools. But you could give the tool that bertt linked to a try

qwork2010 commented 1 week ago

@qwork2010 one option https://github.com/Geodan/i3dm.export

@bertt
Hello! Thank you very much for your answer!The rotation in the code "rotation - double with horizontal rotation angle (0 - 360 degrees);" only allows for horizontal rotation. Can I perform a vertical rotation (with a vertical pitch angle value)?Because our requirement is to rotate both horizontally and vertically, how can we achieve this goal?

The details are that I have a gltf windmill model and a shapefile file (point file, which stores the coordinates (longitude, latitude, and altitude) and direction (horizontal azimuth and vertical pitch) of 1000 points), and I want to generate 1000 instances of the windmill based on this (1000 i3dm instances with different positions, horizontal orientations, and vertical elevations).Is there any implementation method?Or I have already got 1000 instances of i3dm, how can I modify the pitch angle in the vertical direction?

老师,您好! 非常感谢您的回答!“. rotation - double with horizontal rotation angle (0 - 360 degrees);”这里面的旋转只有水平旋转,请问如果需要进行竖直方向的旋转(有竖向俯仰角值)可以吗?因为我们的需求是“水平方向和竖直方向”都要旋转,请问怎么实现这个目标?

详细情况是,我有一个gltf风车模型和一个shapefile文件(point文件,存储了1000个点的坐标(经度、维度、高度)和方向(水平方位角、竖向俯仰角)),想基于此生成风车模型的1000个实例i3dm(1000个i3dm具有不同位置、水平朝向、竖直仰角)。请问有实现方法吗?或者我已经有了1000个实例i3dm,再如何修改其竖直方向的俯仰角?

bertt commented 1 week ago

@qwork2010 use option --use_gpu_instancing, rotation angles must be in columns roll, pitch, yaw

qwork2010 commented 1 week ago

@qwork2010 use option --use_gpu_instancing, rotation angles must be in columns roll, pitch, yaw @bertt

Hello! Thank you very much for your response!I have already obtained the Instanced 3D Model of the windmill (i3dm, see the figure below). Is there any way to modify the pitch angle in the vertical direction? tw1 tw2

qwork2010 commented 1 week ago

@bertt Hello! Thank you very much for your response!I have already obtained the Instanced 3D Model of the windmill (i3dm). Is there any way to modify the pitch angle in the vertical direction?

bertt commented 1 week ago

In I3dm.export you must have the model (glb not I3dm) and model positions and rotations (roll pitch, yaw) in the database table.

qwork2010 commented 5 days ago

@bertt Hello ! On the path“ https://github.com/Geodan/i3dm.export ”I downloaded the program.

1b

1] Use pre-built binaries from release

1

Run the program i3dm.xport.exe, the software crashes.

2] Use . NET Tool Prerequisite: .NET 8.0 SDK is installed https://dotnet.microsoft.com/download/dotnet/8.0 use. NET tool, the result information shows an error.

2 3 4

May I ask how to solve this problem?

mittermichal commented 5 days ago

postgres is not running or maybe it is blocked by windows firewall

mittermichal commented 5 days ago

you should ask questions regarding i3dm.export in its issue tracker instead: https://github.com/Geodan/i3dm.export/issues