The state of 3D models in Cesium

2,159 views
Skip to first unread message

Patrick Cozzi

unread,
Nov 12, 2013, 10:31:18 AM11/12/13
to cesiu...@googlegroups.com
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:


(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 Cozzi

unread,
Jan 20, 2014, 11:55:14 AM1/20/14
to cesiu...@googlegroups.com
Binaries for the COLLADA-to-glTF converter are now available here:


Patrick

dext...@gmail.com

unread,
Feb 3, 2014, 9:51:29 AM2/3/14
to cesiu...@googlegroups.com
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?

Patrick Cozzi

unread,
Feb 3, 2014, 10:03:35 AM2/3/14
to cesiu...@googlegroups.com
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



--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/soK05NfUuM8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--

dext...@gmail.com

unread,
Feb 4, 2014, 8:45:04 AM2/4/14
to cesiu...@googlegroups.com
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?

Patrick Cozzi

unread,
Feb 4, 2014, 9:00:18 AM2/4/14
to cesiu...@googlegroups.com
When you do the COLLADA to glTF conversion, try the -l option:

collada2gltf -f model.dae -l false

Patrick

dext...@gmail.com

unread,
Feb 4, 2014, 9:40:39 AM2/4/14
to cesiu...@googlegroups.com
Thank you for your prompt anwser! Unfortunately, this doesn't seem to help.

Patrick Cozzi

unread,
Feb 4, 2014, 9:49:09 AM2/4/14
to cesiu...@googlegroups.com
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

David E

unread,
Feb 4, 2014, 3:25:59 PM2/4/14
to cesiu...@googlegroups.com
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

Patrick Cozzi

unread,
Feb 4, 2014, 4:02:06 PM2/4/14
to cesiu...@googlegroups.com
David - if you can send me your models, I can take a look.

Patrick

David E

unread,
Feb 4, 2014, 4:42:18 PM2/4/14
to cesiu...@googlegroups.com
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

dext...@gmail.com

unread,
Feb 5, 2014, 7:46:02 AM2/5/14
to cesiu...@googlegroups.com
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.

Patrick Cozzi

unread,
Feb 6, 2014, 5:00:25 PM2/6/14
to cesiu...@googlegroups.com
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

David E

unread,
Feb 6, 2014, 6:12:45 PM2/6/14
to cesiu...@googlegroups.com
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

dext...@gmail.com

unread,
Feb 7, 2014, 8:23:16 AM2/7/14
to cesiu...@googlegroups.com
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.

Patrick Cozzi

unread,
Feb 18, 2014, 11:25:15 AM2/18/14
to cesiu...@googlegroups.com
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
MESSENGER2FS.glsl
MESSENGER4FS.glsl

dext...@gmail.com

unread,
Feb 19, 2014, 4:43:03 AM2/19/14
to cesiu...@googlegroups.com
Great catch Patrick, that is exactly what is happening on my models as well. The diffuse light vector only has 0. elements.

David E.

unread,
Feb 19, 2014, 10:06:41 AM2/19/14
to cesiu...@googlegroups.com
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.

Patrick Cozzi

unread,
Feb 27, 2014, 4:59:30 PM2/27/14
to cesiu...@googlegroups.com, da...@empireofgames.com
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

Tom Fordon

unread,
Apr 11, 2014, 4:14:44 PM4/11/14
to cesiu...@googlegroups.com
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
NPP_Collada.zip

Patrick Cozzi

unread,
Apr 16, 2014, 7:52:29 AM4/16/14
to cesiu...@googlegroups.com
Tom,

Thanks for all the details.

Are you sure that "diffuse.xyz *= diffuseLight;" was removed from all the shaders?  It is still in the *FS.glsl files in the zip.  When I comment it out, the solar panel shows up correctly, but the foil is still wrong (white in this case and some parts have incorrect texture coordinates) so perhaps it looks the same as the glTF Viewer?

If you know Blender, you can probably change the export options or materials to export something more friendly; given that the XCode workaround was needed, there was export issue.  However, since the attached COLLADA file loads in Mac Preview, it should still convert to glTF OK.  Submit an issue for the converter, which could also reference the diffuse issue (#231) that we see with these NASA models.

Patrick



--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/soK05NfUuM8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.

Patrick Cozzi

unread,
May 22, 2014, 4:00:16 PM5/22/14
to cesiu...@googlegroups.com
We deployed a new version of the model converter that should fix this: http://cesiumjs.org/convertmodel.html

Patrick
To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages