HI
I have been playing around with the new model support and hit a problem with what appear to be materials.
I have grabbed a Blender model from the Nasa website and exported it from Blender with and without materials. When exporting without materials the model renders ok in the Sandcastle running locally. When exporting the model with materials the following error is thrown
An error occurred while rendering. Rendering has stopped. TypeError: images[textures[name].source] is undefined
parseTextures@http://sandcastle.local/Source/Scene/Model.js:617
parse@http://sandcastle.local/Source/Scene/Model.js:703
Model.prototype.update@http://sandcastle.local/Source/Scene/Model.js:1826
CompositePrimitive.prototype.update@http://sandcastle.local/Source/Scene/CompositePrimitive.js:390
updatePrimitives@http://sandcastle.local/Source/Scene/Scene.js:873
Scene.prototype.render@http://sandcastle.local/Source/Scene/Scene.js:929
CesiumWidget.prototype.render@http://sandcastle.local/Source/Widgets/CesiumWidget/CesiumWidget.js:539
Viewer.prototype.render@http://sandcastle.local/Source/Widgets/Viewer/Viewer.js:822
render@http://sandcastle.local/Source/Widgets/Viewer/Viewer.js:77
In both cases the model was converted to glTF using the online conversion tool (http://cesiumjs.org/convertmodel.html)
Attached Files
works.zip (264 KB)
fails.zip (575 KB)
635572main_jpl-vtad-Deep_Space_1.zip (1.91 MB)
Alex,
This is either a Blender exporter bug or COLLADA-to-glTF converter bug. Can you please send me the COLLADA model exported from Blender so I can narrow it down and submit a bug against the converter (which should handle this better even if the issue is in the exporter).
In the meantime, here is a workaround to get the model showing up in Cesium (but with incorrect textures and lighting).
- Open “Deep Space 1_11.json.” At the bottom of the file, change
“source”: “image_3”
to
“source”: “image_2”
- Open each file ending in “FS.glsl” (there are three) and change
diffuse.xyz *= diffuseLight;
to
//diffuse.xyz *= diffuseLight;
Patrick
Patrick
Thanks for the heads up, I will try that later.
Attached are the collada exports from Blender. Each folder has a screenshot of the export options selected just in case that helps
Regards
Alex
collada.zip (3.19 MB)
Alex,
When exporting the materials from Blender, I believe you want to check “Include UV Textures.”
The exporter also isn’t creating valid COLLADA (it doesn’t load in Mac preview), but it will open in Xcode and can then be saved to create a valid COLLADA file as explained in the tutorial. If you have the time, it is worth submitting a bug agaisnt the Blender exporter since a few folks have tried to use these NASA models with similar results.
Also, if the model shows up black in Cesium, remember to use the workaround to the *FS.glsl files. The COLLADA-to-glTF bug for this is #231.
Finally, if you have 3DS Max or another modeling tool, you could try to export from Blender to .fbx and then import into 3DS Max and export to COLLADA to avoid the buggy export.
Patrick
Patrick
Thanks for then speedy reply.
I will have a play with various other apps to see if I can get valid collada. I will also send a bug report to Blender given that others may use it and I have some examples that don’t work.
I did try with the UV option selected but got the same results
I will let you know how I get on
Alex
Patrick
Ran it thru xcode on my mac and after altering the shaders the model displays in the Sandcastle so thanks for the help.
I am putting together a test case to report the Collada issue to Blender
Alex
Thanks for the update. Please post a link to the Blender issue here so we can point folks to it if they run into a similar issue.
Patrick
We deployed a new version of the model converter that should fix this: http://cesiumjs.org/convertmodel.html
Patrick
Apparently, the problem has not been solved: http://www.filedropper.com/test_46