I’m trying to create and load 3D objects into Cesium. I need to create these objects programmatically (by using some import-transformation service, .NET platform used) from various sources
I have experience of doing it in THREEJS. I read DXF file, convert entities into PostGIS geometries, triangulate (to create surface from elevation data), tessellate geometries and finally construct THREEJS-compatible scene (JSON format, Gzipped, THREE.BufferGeometry used). This works pretty well: no problems with loading hungreds of thousands triangles/points. Sometimes I use webworkers jist to request and parse JSON.
Also, I was able to load pretty big (40mb) geojson into my OpenLayers client app without any problem (Map and WebGLMap)
But I can’t load even 20mb geojson (polylines) into cesium (1.51.0)!
An error occurred while rendering. Rendering has stopped.
RangeError: Array buffer allocation failed
RangeError: Array buffer allocation failed
at arrayBufferConstructor_DoNotInitialize (<anonymous>)
at new Float64Array (<anonymous>)
at Object.o.createTypedArray (http://localhost:9090/public/ThirdParty/Cesium/Workers/combineGeometry.js:227:18570)
at H (http://localhost:9090/public/ThirdParty/Cesium/Workers/combineGeometry.js:230:21640)
at j (http://localhost:9090/public/ThirdParty/Cesium/Workers/combineGeometry.js:230:22200)
at ne (http://localhost:9090/public/ThirdParty/Cesium/Workers/combineGeometry.js:230:30083)
at Object.ae.splitLongitude (http://localhost:9090/public/ThirdParty/Cesium/Workers/combineGeometry.js:231:7036)
at v (http://localhost:9090/public/ThirdParty/Cesium/Workers/combineGeometry.js:231:10398)
at Object.M.combineGeometry (http://localhost:9090/public/ThirdParty/Cesium/Workers/combineGeometry.js:231:13298)
at r (http://localhost:9090/public/ThirdParty/Cesium/Workers/combineGeometry.js:231:18552)
Why is that? What can I do? GLTF/GLB/3D tiles are pretty complex formats. There is no rich tools sets to customize/control object creation using these formats. I do not want to buy super-duper (really) FME Server to create GLTFs… May be I can use czml to load complex geometries, using polylines etc)?
Sorry to hear you’re running into this!
This is the closest GitHub discussion I found:
This same error happened with KML, I believe because they’re processed in very similar ways. As Hannah explained there I believe the plan is to eventually be able to tile GeoJSONs with Cesium ion (cesium.com/ion) so you can just drag and drop your big GeoJSONs and get nicely tiled data that streams in efficiently. We do have an experimental 3D Tiles vector format if you want to see an example of what a tiled GeoJSON would look like:
But there are currently no public tools that can generate that.
With that in mind, I would say your best bet is to split up the GeoJSON into multiple files that you can load, or try CZML. The CesiumJS engine itself has no trouble with hundreds of thousands of triangles/points (more on that here https://cesiumjs.org/tutorials/Geometry-and-Appearances/ ), I believe the memory issue it’s running into is when it tries to batch all the geometry together into one typed array and the browser can’t allocate a contiguous block of memory that big. This batching usually means loading is a lot faster but in this case it’s the limiting factor.
Oh, and just to help us get a better idea of applications, what kind of project are you doing this for?
Cesium’s entity API (which CZML, GeoJSON, and KML all use) is super flexible and can do amazing things with time-dynamic anything, but it has major CPU overhead and massive memory overhead. And that’s especially a shame when you’re talking about a format like GeoJSON where everything is static anyway.
The answer is things like glTF, low-level Cesium primitives (maybe), and (for really big datasets) Cesium 3D Tiles.
Since you’re starting with DXF, there’s a chance your tool can export glTF directly. I believe some Autodesk products can. If not, you can try exporting an OBJ or Collada/DAE file and then convert that to glTF using https://github.com/AnalyticalGraphicsInc/obj2gltf or the online converter (https://cesiumjs.org/convertmodel.html).
I have met this problem. Is there a good solution now?
在 2018年11月17日星期六 UTC+8上午1:44:29，Omar Shehata写道：
What type of data do you have? Kevin’s response above still describes the best solution I think. You can see what formats are supported on Cesium ion here (https://cesium.com/docs/tutorials/uploading/). If it’s supported you can just upload your data to Cesium ion and get an optimized 3D Tileset.