cesium icon indicating copy to clipboard operation
cesium copied to clipboard

glTF model clippingPlanes removeall error

Open changqingom opened this issue 5 years ago • 5 comments

Cesium version : 1.68

chrome version : 80.0.3987.149

when excute glTFModel.clippingPlanes.removeAll() i got a rendering error : gltf_clippingPlanes UniformSampler value is undefined

I've tried other models . I think the multi Bounding Volume model has this problem.

model link : https://sketchfab.com/3d-models/white-silver-green-residence-ec516ba32f03403f97954472c5d4b2cf#download

image

window.viewer = new Cesium.Viewer("cesiumContainer", {
  // terrainProvider: createWorldTerrain()
  imageryProvider: false,
  animation: false, 
  baseLayerPicker: false, 
  geocoder: false, 
  timeline: false, 
  sceneModePicker: false, 
  navigationHelpButton: false,
  infoBox: false, 
  fullscreenButton: false, 
  homeButton: false, 
  selectionIndicator: false, 
  navigationInstructionsInitiallyVisible: false,
  shouldAnimate: true,
});

const options = {
  id: "example-model",
  // url: '/model/Duck.glb',
  // scale:400000,
  /*-------------------------------------------------------- */
  url: "/model/white_silver_green_residence/scene.gltf",
  scale: 400,
  position: [108.947048, 34.259415],
};

window.model = Cesium.Model.fromGltf({
  modelMatrix: Cesium.Transforms.headingPitchRollToFixedFrame(
    Cesium.Cartesian3.fromDegrees.call(null, ...options.position),
    new Cesium.HeadingPitchRoll(
      Cesium.Math.toRadians(0),
      Cesium.Math.toRadians(0),
      Cesium.Math.toRadians(0)
    )
  ),
  ...options,
  url: options.url,
  clippingPlanes: new Cesium.ClippingPlaneCollection({
    edgeWidth: 1,
    planes: [new Cesium.ClippingPlane(new Cesium.Cartesian3(-1, 0, 0), 0)],
  }),
});

viewer.scene.primitives.add(model);

viewer.camera.setView({
  destination: new Cesium.Cartesian3(
    -1953829.2409311095,
    6618724.811636659,
    3227893.906284791
  ),
  orientation: {
    heading: 0.24165191356149585,
    pitch: -0.9933975711287646,
    roll: 6.283006645076183,
  },
});

changqingom avatar Apr 07 '20 08:04 changqingom

There does seem to be something about this model that causes the renderer to be in an invalid state when the clipping plane is removed. Running it myself I get a different stack trace sometimes:

TypeError: Cannot read property '6' of undefined
TypeError: Cannot read property '6' of undefined
    at regenerateShaders (http://localhost:8080/Source/Scene/Model.js:4981:49)
    at Model.update (http://localhost:8080/Source/Scene/Model.js:4835:17)
    at PrimitiveCollection.update (http://localhost:8080/Source/Scene/PrimitiveCollection.js:374:27)
    at updateAndRenderPrimitives (http://localhost:8080/Source/Scene/Scene.js:3010:27)
    at executeCommandsInViewport (http://localhost:8080/Source/Scene/Scene.js:2836:13)
    at Scene.updateAndExecuteCommands (http://localhost:8080/Source/Scene/Scene.js:2644:13)
    at render (http://localhost:8080/Source/Scene/Scene.js:3319:15)
    at tryAndCatchError (http://localhost:8080/Source/Scene/Scene.js:3338:13)
    at Scene.render (http://localhost:8080/Source/Scene/Scene.js:3413:13)
    at CesiumWidget.render (http://localhost:8080/Source/Widgets/CesiumWidget/CesiumWidget.js:704:25)

OmarShehata avatar Apr 08 '20 03:04 OmarShehata

I think it is related. There is a list of uniforms out of which there is one UniformSampler named "model_clipping_planes" with value as undefined. MicrosoftTeams-image

prasuncct avatar Sep 07 '22 09:09 prasuncct

@prasuncct or @changqingom could you check if this is fixed for you in the latest release CesiumJS 1.97? We refactored the model loading code and this may have been fixed.

lilleyse avatar Sep 07 '22 12:09 lilleyse

@lilleyse I am not loading the gltfmodel but the pointcloud (las). It does not seem to be fixed yet.
cesium_error

prasuncct avatar Sep 08 '22 03:09 prasuncct

Point clouds and glTF models now use the same Model class under the hood so the behavior should be similar.

Would you be able to put together a sandcastle that demonstrates the problem?

lilleyse avatar Sep 08 '22 12:09 lilleyse

Point clouds and glTF models now use the same Model class under the hood so the behavior should be similar.

Would you be able to put together a sandcastle that demonstrates the problem?

@lilleyse Can you see this sandcastle? Click the removeAll button twice , all types fail

Hello World - Cesium Sandcastle

jinjun1994 avatar Sep 27 '22 01:09 jinjun1994

This could be related to https://github.com/CesiumGS/cesium/issues/10811. CC @j9liu

lilleyse avatar Sep 27 '22 12:09 lilleyse