CesiumGS / CesiumGS/cesium

Adding a silhouette to glTF crashes when no normals are found

Open
#7,586 1 comment 2 reactions 0 assignees View on GitHub
category - model/gltf type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

[Forum thread](https://groups.google.com/d/msg/cesium-dev/_bl0dk26X8U/ulEApR5XBAAJ). The glTF in [this Sandcastle](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=vVZbb9s2FP4rRPYgGZBlO5e2c5xgTdptAZa1a5ICQ9wHWjq2iFKkQFJO3CH/fYekbpadrRu6CTAs8dy/c+FZU0XWDB5AkTMi4IFcgmZlHn90Z2GQuM9LKQxlAlQQkT/mguDDxFJeyEcyJUvKNUT+VAOHxDAprkTKEmqk6jNkNJUPeudUljx9LVhODSDNqBLm4mlwOhdzsUYXQRhmNu5zWQpngazAXEou1QUHkV7LFMJk63NQu6rAlErUkW3L3G/LxEbeFQWoS6ohHHxCg097bXpTv9IcIkJ5kdHGmPXWERHPrsX7RmLXxjNOxksl89dWuzcXkYIqDT9ySU3orQ5qD0cjcpuBS6WNgyOENPmsicFDbSyqcklkqUjOBCO0KLhND4YUe4BbwbM6Es04pgWMAecNpiX4AGkQ7aXajN57Ogl+UgDCvlzwEuz/78C5fPAkugk+7ehwUaKKSTzeod2wL7YmDuMxxnpaBYsVuQZlXHyt7znkC0BfmDCSfBYy+SxLQ+RCg1rTBQeN0VYI19TYARU2Oga1hQsm0p56VGoP3ry7JljnORaltrDas7sr/KOGJJRzskS0mKmQNVLyBbXlkMqktEIxVtFbL3+xuUrDoGIJrO2+ezZVG+sLEyvduhnVer2/u3Jo410Td1cu6GUuGMS6XOhEsQWEHvu63EMcCB8p5rCpbvv4Xoxzqy7uF8lZ2yK1cNQiGPcyPqiKH0vYx/FvonCa/rMo9vl+6bux0fstorBV/q2CcB1z1p0Wz7raTLZEAU4J51dYKvQtA7bKTDvX3IUQO4sMG0lBLteIPQ+9onr2FVIzp7Adf1QZfKPiyA20N7DC8aDD4eTwKB6/PD5+Mfk+IsfH8fhkfPRy/KKxfNoqzYDa+m91XlOT4Rz9gMdU6HBydNJlL5hJMmQed86U5Lx3lBW9S+9nb+a9Ff+A/GFlN/IaI6eka0gqhoDQ7XhvFbqEIyDXcdZT+FuJGCth81njFFk3Wgh9RlFZH2+apmEn8wIvEhyKNlPtYYP9tHntULvOTrtfHR5XSUjtWLJPqdiOMceOl0le5u/ZI/BqTE8OX/WZ6KNlusHR6Ob4GJ8ey+5V8zX99/xYeVZ95WSnM/YpsVyDVsVT1TNN5n1q3MUB6ds6Y82O8lRvLbKw8Gqk3VeAGng09iJ9zVSi6NLUtylyuc3J7kV1x291erc9g8yYQk9HI30Ul3oIVJvhYUxz+kUK+qDjROajhMsypZncDF1K9SiFJS05ziJulngRn2AS4nFnHDx9cjV4Q0WaoEIOtuJu/R1zDaIMq2AGe9lWKw4XpTHodnDjV7wgqoGqdr6oDS3JwELXHy71cnhGKobTZgk8iA5m2mw4nHuJH1heSLz/sSbDOB4ZyAuOAOnRokRBEyda18F9V9/AHTgXmLqVkqVIp0StFjQ8PsQZVP3G8ata1nUVRohNPCXHxWPneCFVCmqosMNL3SU+9cwyUeAS0jFuFxfcvviQcrYSU+yiNOWwa3FoZIH9smW1Ji0kgp13qX2zbvjAVtRLXOOHD266TtF/nrais1GN7ixla8LSs/lBb/efH5CEU62Rsiy56/f5wflshPxbYthW1sV3GCanG8uSTc5/8YdxHM9G+LkrVbmN7N6nmbGX5fnMLGS6ac4UHqSNGz5CFPHr2U3TwLORSdEGsreCLQyo4tyNEMe2fT6r+jClhg4XuHahmarypzs7L1a4vVR3CA4Wr+i8Y+MvHXKDa49D25Ns5ovJbApAx/CiWWEO7BjGL+xn+04f8X3i3rWBwhMm+NUNacdvZ76K565AVqQGzljQpGS/E3akWVtYDvh18lWGtlR+LUK24L4dQON/ipA1/38AVPXV3+Iz8p2B/65RbAv7nvoT) crashes when `silhouetteSize` is set.

This seems to be because one of the primitives in the glTF does not have normals defined. If I hardcoded `hasNormals = true` in `processPbrMaterials` in `generateTechnique`, it works, I think:

![silhouette](https://user-images.githubusercontent.com/1711126/53102744-4ffd9d00-34fa-11e9-8c08-12fdc4b7e6da.png)

@lilleyse is this expected? If so , maybe it could throw a more descriptive error.

Contributor guide

Open the contributing guide

Research direction

Start with the glTF in the linked Sandcastle and inspect processPbrMaterials in generateTechnique, focusing on how missing normals interact with silhouetteSize. Reproduce the crash with that asset, then verify the chosen behavior for primitives without normals, including whether the failure should become a descriptive error. Confirm that the silhouette path no longer crashes unexpectedly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.