The state of 3D models in Cesium

All,

Here’s an update on 3D models in Cesium.

We are adding support for glTF, an upcoming open-standard for 3D models on the web by the Khronos Group (the consortium for WebGL, OpenGL, COLLADA, etc.). COLLADA files are easily converted to glTF with an open-source converter. In addition to coding a lot of the Cesium implementation, I am also one of the creators of glTF.

I expect initial support for glTF to be in Cesium in 2-3 months. I don’t expect that the glTF 1.0 spec will be finalized by then; however, this shouldn’t be a concern to most users like those converting from COLLADA.

We are currently working in the gltf branch. Using that branch, you can view test models with the following URLs:

http://localhost:8080/Apps/CesiumViewer2/index.html?model=Gallery/model/SuperMurdoch/SuperMurdoch.json

http://localhost:8080/Apps/CesiumViewer2/index.html?model=Gallery/model/rambler/Rambler.json

http://localhost:8080/Apps/CesiumViewer2/index.html?model=Gallery/model/wine/wine.json

http://localhost:8080/Apps/CesiumViewer2/index.html?model=Gallery/model/duck/duck.json

(If you’ve never built and ran Cesium from the GitHub repo, see the Contributor’s Guide. A lot of folks do it.)

Our glTF implementation is now in-sync with the open-source COLLADA-to-glTF converter so you can use that project to convert your COLLADA files and view them in Cesium. Once built, using the converter can be as simple as:

collada2gltf -f mymodel.dae

Please submit converter questions and bugs to the glTF github page, not to Cesium. Bugs in Cesium should, of course, be reported too. If you are able to include, or send me privately, your test model, it will help us address issues.

To keep up-to-date with our progress, keep an eye on the models roadmap.

Regards,

Patrick

Binaries for the COLLADA-to-glTF converter are now available here:

Converter Builds · KhronosGroup/glTF Wiki · GitHub

Patrick

Is there any way to add a 3d model to a cesiumWidget instance? (the one you get from the tutorials)

Or it is just possible to use 3d model with the CesiumViewer2 code?

Right now, we need to use the gltf branch to use 3D models. This can be done with the Cesium Widget in that branch. CesiumViewer2 is just a test app.

Patrick

Thank you for your input! I've finally succeeded in using a custom, textured model in CesiumJS by using the latest GLTF branch. It was a bit tricky to get the conversion to *.gltf pipeline right, but works like a charm!

There's only one glitch, and I'm not sure wheter it is a bug or not. The imported model is partially black (see http://postimg.org/image/ah1zs7oez/), as if it is illuminated by only one light and has no ambient illumination. Is this the normal behaviour?

Is there any way to add ambient light to models shown in CesiumJS?

When you do the COLLADA to glTF conversion, try the -l option:

collada2gltf -f model.dae -l false

Patrick

Thank you for your prompt anwser! Unfortunately, this doesn't seem to help.

Perhaps something is wrong with the model or converter. Does the COLLADA version load OK in Mac preview? Does the converted glTF load OK in the glTF viewer? If the answer to both of these is yes, then there is an issue in Cesium.

Patrick

I’m seeing the same no-light behavior in my own models (now that the previous bug with the converter was fixed).

I’ve previously tested my COLLADA models in THREE.js without issues providing that I add in appropriate light sources (typically an ambient source + a point source). In Cesium it is behaving as if there is no existing light source (ie: the sun) in the scene.

‘npm install’ fails so I can’t test the gLTF viewer.

A second issue that I’m seeing in one version of my model (which also happens to be the only one that is correctly lit) is a strange behavior where certain surfaces are transparent from the outside, but the far wall (inside the model) is opaque. As the model is rotated, this is true from any angle. It’s actually a neat effect that might be useful in different cases if I could recreate it on demand, but is clearly a bug of either Cesium or of the converter.

thanks,

  • David

David - if you can send me your models, I can take a look.

Patrick

The MESSENGER model I downloaded evokes the no-light behavior and can be downloaded from http://www.nasa.gov/multimedia/3d_resources/assets/eoss-messenger.html I can send you the exported COLLADA or gLTF file if you need it.

Unfortunately the other models I’m working with (such as the one with the funky one-sided transparency) are internal and I may need to get approval before I can share them.

  • David

I can confirm the behaviour: the COLLADA works just fine in Blender, Sketchup and other viewers, while every converted gLTF model shows an odd lighting. Unfortunaly, I have no access to a Mac and I can't figure out how to properly show my models in gLTF web viwer.

David,

For your model (http://www.nasa.gov/multimedia/3d_resources/assets/eoss-messenger.html), the export I get from Blender is not valid COLLADA (it does not load in Mac preview), but if I open it in Xcode and save it, it then loads in Mac preview, but without the materials (I believe I exported them correctly). Then, the conversion to glTF yields some warnings:

The tangent source #geometrySource25 has a wrong dimension of 4. Dimensions must be 3.

The tangent source #geometrySource32 has a wrong dimension of 4. Dimensions must be 3.

Then, the output .json has an image that references a file that doesn’t exist:

“image_3”: {

“path”: “Tex_dark”

},

If I change that to an image that does exist, I get a dark model in Cesium. This could be an issue in Cesium, but since there are so many other issues, I can’t justify the time to look at it anymore. If you are working with someone at AGI, you can ping them to see if we can get more of my time for this. Otherwise, I would submit an issue to https://github.com/KhronosGroup/glTF and Fabrice may at least be able to pinpoint the problems.

Patrick

I uploaded a tar file of the exported GLTF model to GDrive at https://drive.google.com/file/d/0ByQK8VRy-TyUaTR3dFcyelpTVW8/edit?usp=sharing Since the other user that had these issues (giorno marted?) hasn’t responded lately, I’m guessing he can’t post his problem model.

The COLLADA file for the MESSENGER model loaded in THREE.js without errors, so I find it surprising that there are issues with it. I just confirmed that all of the COLLADA .dae files I have cannot be opened in Preview, but some quick Googling shows that Preview in general has issues with many COLLADA files so that might not mean much.

The converter worked for me without any warnings, though I am using the latest dev4 branch release. If you output to a different directory, the converter does fail to copy over any dependent .png files from the original COLLADA and I now remember that the original Blender->Collada export adds some odd “.001.” extensions to the files that may need to be removed.

I guess there are some bugs in Blender’s Collada exporter. Given how many translations these models are going through (2-4), I can imagine that errors could be building up anywhere in the chain.

I appreciate your help and understand if you need to move on to other issues.

thanks,

  • David

Sorry for the late reply, I've just uploaded my model here: https://dl.dropboxusercontent.com/u/10671464/BancoDiNapoli.7z . I've used Blender as well for the export (OBJ->Collada) but the Collada->Gltf didn't output any warning.

David,

This is a bug in the COLLADA-to-glTF converter probably due to an invalid COLLADA file. For full details, see the issue I submitted: https://github.com/KhronosGroup/glTF/issues/231

As a workaround, comment out this line in the three *FS.glsl files (which are also attached with the workaround):

diffuse.xyz *= diffuseLight;

I don’t have access to dropbox here at the office, but I suspect this will work for the other model as well.

Patrick

MESSENGER0FS.glsl (888 Bytes)

MESSENGER2FS.glsl (943 Bytes)

MESSENGER4FS.glsl (547 Bytes)

Great catch Patrick, that is exactly what is happening on my models as well. The diffuse light vector only has 0. elements.

That worked nicely, thanks.

Fyi, there is still an issue with the foil texture not showing up on the Messenger model, though that is not an issue that I care about at the moment.

On another model I’m working with the same fix had the odd effect of turning the model completely white, but I suspect that may be an issue with the model itself.

Today support for 3D models were merged to master (#1482). On Monday, they will ship as part of b26 along with a tutorial and web tool for converting COLLADA models to glTF.

We’ll continue to improve models in the coming months, keep an eye on the roadmap.

Patrick

I’ve been having trouble converting the following blender file: http://www.nasa.gov/multimedia/3d_resources/assets/jpl-vtad-npp.html
I can get the model to show up in cesium, but there are no textures displayed and the model is black. I can see from the network traffic that the textures are being downloaded. Does anybody have any suggestions on a next step?

I did the following:

Opened the file in blender.

Exported a collada file, making sure to export the UV and Material textures

Opened the collada file in xcode, then saved it back out. (this definitely helped)

Used the collada->gltf tool

Removed the “diffuse.xyz *= diffuseLight” line from my *FS.glsl files

Ensured the gltf loads in the gltf viewer (the foil textures aren’t displaying, but everything else is.)

After doing this, the models are still showing up black. I am able to display EOSS Messenger model that David E. was working with in cesium. I’ve attached the collada zip and the gltf zip.

Thank you for any help.

GLTF_NPP.zip (2.44 MB)

NPP_Collada.zip (2.54 MB)