-
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
Automatic Globe depth texture #2506
Conversation
@@ -203,6 +205,19 @@ define([ | |||
|
|||
/** | |||
* @memberof UniformState.prototype | |||
* @type {Texture} | |||
*/ | |||
globeDepthTexture : { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just replace this with a regular property. It will be slightly faster and more concise.
@chris-cooper just a heads up that this branch may cause some merge conflicts for the |
function destroyTextures(scene) { | ||
scene._colorTexture = scene._colorTexture && !scene._colorTexture.isDestroyed() && scene._colorTexture.destroy(); | ||
scene._depthStencilTexture = scene._depthStencilTexture && !scene._depthStencilTexture.isDestroyed() && scene._depthStencilTexture.destroy(); | ||
scene._depthStencilCopyTexture = scene._depthStencilCopyTexture && !scene._depthStencilCopyTexture.isDestroyed() && scene._depthStencilCopyTexture.destroy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not declared in the constructor function. Why not name it _depthStencilGlobeTest
? "Copy" is too generic, especially as we move towards a post-processing framework.
I get culling/blending issues in the Geometry and Appearances Sandcastle example (but not on cesiumjs.org). For example, zoom into the corridors near Alaska and they disappear and reappear. |
'void main() { gl_FragColor = vec4(texture2D(depthTexture, v_textureCoordinates).r); }\n'; | ||
scene._copyDepthCommand = context.createViewportQuadCommand(copyDepthFS, { | ||
renderState : context.createRenderState(), | ||
uniformMap : {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just remove this and use the default, right?
I couldn't reproduce this. Is it the blinking that I showed you? I figured out that the blinking is caused when the |
On Windows, this happens in Chrome, but not IE and Firefox. All of which support floating-point textures, but only Chrome supports multiple render targets, so perhaps this is an OIT issue when MRT is available. (This didn't happen on Chrome/Mac, which I bet doesn't have MRT, but I have to check). If I try to disable OIT in the Geometry and Appearances example, var viewer = new Cesium.Viewer('cesiumContainer', {
orderIndependentTranslucency : false,
infoBox : false }); we crash:
|
Have you stepped through the code? Do you know if Are we somehow reading and writing to the same texture. Have we tried different texture formats? How can we narrow it down?
Probably, but I couldn't reproduce the blinking in the same way you had it. |
As discussed offline, I think this branch accidentally fixes #2327 as well. I have no idea why. While I'm not qualified to review this code, I did notice harsher edges in this branch compared to master. For example, the box geometry demo: |
Conflicts: CHANGES.md Source/Scene/Scene.js
…depth test. Slightly offset billboard z.
Billboard depth
Ah, is this because the peak is so steep and it is getting a lower height next to it? Unless you have a simple solution, make a note of this in #2685. |
@@ -144,6 +144,50 @@ | |||
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE); | |||
}); | |||
|
|||
Sandcastle.addToolbarButton('Pick position', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, its picking the depth plane. The regular pick to see if the model is under the mouse cursor checks a 3x3 pixel region. Picking the position only uses the center pixel.
* Added new `PointPrimitive` and `PointPrimitiveCollection`, which are faster and use less memory than billboards with circles. | ||
* Changed `Entity.point` back-end graphics to use the new `PointPrimitive` instead of billboards. No change to the `Entity.point` API. | ||
* Added optional drilling limit to `Scene.drillPick`. | ||
* Added optional `ellipsoid` parameter to construction options of imagery and terrain providers that were lacking it. Note that terrain bounding spheres are precomputed on the server, so any supplied terrain ellipsoid must match the one used by the server. | ||
* Upgraded Autolinker from version 0.15.2 to 0.17.1. | ||
* Fixed documentation for `Context.drawingBufferHeight` and `Context.drawingBufferWidth`. | ||
* Added debug option to `Scene` to show the depth buffer information for a specified view frustum slice and exposed capability in `CesiumInspector` widget. | ||
* Removed `Scene.fxaaOrderIndependentTranslucency`. Use `Scene.fxaa` which is now `true` by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we talk about this already?
Shouldn't we deprecate this (over one release is fine) so we output the console warning in the setter?
Right the position of that billboard is actually slightly yo the left of the peak. I'll make a note of it. |
*/ | ||
this.fxaaOrderIndependentTranslucency = true; | ||
this.debugShowDepthFrustum = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be debugShowGlobeDepthFrustum
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its also used for showing the pick depth buffer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, OK.
* @default false | ||
* @private | ||
*/ | ||
this.copyGlobeDepth = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a unit test for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How should I test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we set it to true and then test for the automatic uniform?
This works well enough. Just those minor comments then let's get this merged. @mramato we should probably do the entity API changes post 1.10. |
@pjcozzi This is ready for another look. |
Creates an automatic uniform for the depth texture after the globe is rendered.