Custom primitive disappears when camera tilt near horizontal plane

Hi everyone,

1. A concise explanation of the problem you’re experiencing.

I create a custom edge primitive and use drawCommand to render in the scene. But when I tilt the camera near the terrain surface, the edge primitive disappeared.

P.S. Other primitive I created before has the same problem.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

This is how I create the drawCommand.

//creating buffers

//creating renderState

EdgeLoader.object.rs = RenderState.fromCache({

depthTest : {

enabled : true

},

depthMask : true,

blending : BlendingState.DISABLED

}

);
//do other thing


//creating drawcommand

EdgeLoader.object.drawCommand = new DrawCommand({

cull : false,

modelMatrix : modelMatrix,

primitiveType : PrimitiveType.LINES,

boundingVolume : bs,

vertexArray : EdgeLoader.object.va,

shaderProgram : EdgeLoader.object.shaderProgram,

uniformMap : uniformMap,

renderState : EdgeLoader.object.rs,

pass : Pass.OPAQUE,

pickId :pickId

});

``

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I want to draw edges of a model.

4. The Cesium version you’re using, your operating system and browser.

Cesium 1.54

Win 10

Chrome 72.0.3626.119

Any help appreciated.

Chris

Here is the result of two view point. In frist pic, the edge is displayed. In the second one, the edge primitive disappears.

在 2019年4月2日星期二 UTC+8上午11:21:50,Chris Wang写道:

Hi guys,

I figure out that it’s because I pass the wrong boundingSphere to the drawCommand. Now I can display the edge correctly.
在 2019年4月2日星期二 UTC+8上午11:26:31,Chris Wang写道:

Thanks for posting your solution! It looks like Scene.js (see Scene.prototype.isVisible) uses the bounding volume to determine whether the primitive is visible or not.

You could set cull: false to disable this when constructing the DrawCommand. This could be useful for debugging (or if you want something to always be displayed etc.)