-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix model shader generation when normals are missing #5838
Comments
See implementation note: AnalyticalGraphicsInc/gltf-vscode#28 (comment)
|
Hm.. that might not look good for photogrammetry. |
Came up on the forum: https://groups.google.com/forum/#!topic/cesium-dev/eXxk3Oi0hEM |
We ran into this as well. With GLTF 1.0, Cesium seemed happy to compute normals from our models, which isn't happening with GLTF 2.0. I tried the --materialCommon hint from the linked forum topic, but that appears to be the worst of both worlds (missing textures in Cesium; incompatibility in other GLB viewers). Is there a current suggested fix for this, other than expanding the size of our models with explicit normals? |
@lilleyse Apologies for the highlight and double comment on this; I wanted to check if there was anything else I could do to help to investigate or work around this issue, especially since GLTF 1.0 models appear to work (ie, generate normals) as expected. Thanks in advance for your help. |
@KermMartian I'm not sure if we ever generated normals for 1.0 models on load. I tried a simple box model and it shows the image below. If you are able to send me one of your models I could confirm. But I do think we should generate normals for 2.0 models eventually, including options for smooth normals vs. hard normals like gltf-pipeline has. Cesium even has a built-in methods for doing this but no one has gotten around to integrating it yet. Until then I don't have a suggested fix. |
@lilleyse Do you know if perhaps the 1.0 branch of KhronosGroup/COLLADA2GLTF was generating the normals unbidden, or perhaps creating a shader to generate the normals on the fly (and 2.0 doesn't)? I'll see if I can answer that question for myself if I can reproduce the GLTF 1 behavior, and I'm happy to send you one of those models, if I reproduce it. Making our DAE-to-CMPT pipeline generate normals along the way isn't too bad, but I'd like to avoid it there's an easy fix in COLLADA2GLTF, since it sounds like an easy fix in Cesium is out for the time being. |
I'm not sure. @tfili do you know if |
I don't think it does. That's why we use gltfPipeline to do it. |
Duly noted; thanks for the help, everyone! In the end, we just generate normals ourselves before they get to COLLAGA2GLTF (and thence Cesium), so everything is resolved for us as below. I'm afraid that doesn't help those using models without normals, so definitely a strong vote for me in favor of Cesium eventually being able to compute those normals on the fly. |
Came up on the forum again: https://groups.google.com/forum/#!topic/cesium-dev/se_9ov5HwA8 |
BabylonJS has an option to createNormals based on the mesh: https://doc.babylonjs.com/api/classes/babylon.abstractmesh#createnormals Might be worth looking at it and get inspiration from here: |
Lately I've been pondering whether Cesium could just show "unlit" materials ( |
@emackey I think that's a great idea |
Congratulations on closing the issue! I found these Cesium forum links in the comments above: https://groups.google.com/forum/#!topic/cesium-dev/eXxk3Oi0hEM If this issue affects any of these threads, please post a comment like the following:
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
processPbrMetallicRoughness
always expects normals to exist, but that is not always the case. We should have a separate shader path for those models that would look similar to the constant lighting inprocessModelMaterialsCommon
.This will fix #5835.
The text was updated successfully, but these errors were encountered: