-
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
Billboard depth fail #5166
Billboard depth fail #5166
Conversation
Fixes #5121 |
Also fixes #2694 |
For the API and naming, perhaps just:
When it's |
Source/Scene/Billboard.js
Outdated
Billboard.NUMBER_OF_PROPERTIES = 15; | ||
var DISABLE_DEPTH_DISTANCE = Billboard.DISABLE_DEPTH_DISTANCE = 15; | ||
var ALWAYS_DISABLE_DEPTH = Billboard.ALWAYS_DISABLE_DEPTH = 16; | ||
Billboard.NUMBER_OF_PROPERTIES = 17; |
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.
Do you have ideas for avoiding going above 16 attributes?
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.
Nevermind, I see that we are good.
Source/Scene/PointPrimitive.js
Outdated
@@ -100,7 +102,9 @@ define([ | |||
var PIXEL_SIZE_INDEX = PointPrimitive.PIXEL_SIZE_INDEX = 5; | |||
var SCALE_BY_DISTANCE_INDEX = PointPrimitive.SCALE_BY_DISTANCE_INDEX = 6; | |||
var TRANSLUCENCY_BY_DISTANCE_INDEX = PointPrimitive.TRANSLUCENCY_BY_DISTANCE_INDEX = 7; | |||
var DISTANCE_DISPLAY_CONDITION_INDEX = PointPrimitive.DISTANCE_DISPLAY_CONDITION = 8; | |||
var DISTANCE_DISPLAY_CONDITION_INDEX = PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX = 8; | |||
var DISABLE_DEPTH_DISTANCE_INDEX = PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX = 15; |
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.
Why 15 and 16? Not 9 and 10?
attribute vec4 eyeOffset; // eye offset in meters, 4 bytes free (texture range) | ||
attribute vec4 scaleByDistance; // near, nearScale, far, farScale | ||
attribute vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale | ||
attribute vec4 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthDistance, alwaysDisableDepth |
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.
Could alwaysDisableDepth
be the sign of disableDepthDistance
?
@@ -246,8 +246,8 @@ void main() | |||
#endif | |||
|
|||
#ifdef DISTANCE_DISPLAY_CONDITION | |||
float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x; | |||
float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y; | |||
float nearSq = distanceDisplayConditionAndDisableDepth.x * distanceDisplayConditionAndDisableDepth.x; |
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.
Unrelated to this PR, but why don't we store the squared distance in the vertex attribute to avoid this computation?
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.
Not sure, updated here: 18b6769
Is it possible to get this somewhere higher in the API, like dataSources or viewer/scene? Label clipping issues especially have been a pain point, and I don't see an issue overriding labels especially to never depth test. |
…depth test. If it is positive infinity, we never depth test.
Seconded @denverpierce's comment. We load pins from KML files with label clipping. |
@bagnell what do you think of a min distance on |
Added in e990328 |
@pjcozzi This is ready for another look. |
@@ -258,6 +258,24 @@ void main() | |||
gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); | |||
v_textureCoordinates = textureCoordinates; | |||
|
|||
#ifdef DISABLE_DEPTH_DISTANCE | |||
float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z; | |||
if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0) { |
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.
Put {
on a new line in GLSL.
|
||
bool clipped = gl_Position.z < -gl_Position.w || gl_Position.z > gl_Position.w; | ||
float distance = length(positionEC.xyz); | ||
if (!clipped && (disableDepthTestDistance < 0.0 || (distance > 0.0 && distance < disableDepthTestDistance))) |
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 might have already asked this, but should be store squared distance instead to avoid the length
above? Or are you concerned about overflow? We would treat infinity as a special case.
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.
You asked about it for the distance display conditions, which I fixed, but somehow forgot this. It's been updated.
Add this to a Sandcastle example. |
@bagnell feel free to push this 1.33, up to you. |
Google Earth doesn't depth test labels, but it does test icons. |
@pjcozzi This is ready for another look. |
All looks good. Please also merge into |
Adds
disableDepthDistance
andalwaysDisableDepth
properties to labels/billboards/points.alwaysDisableDepth
will always draw the billboard in front of everything.disableDepthDistance
will always draw the billboard when the distance to the camera is less than thatdisableDepthDistance
.Fixes #5121.