Compare commits

...

8 Commits

Author SHA1 Message Date
Jeshurun Hembd cfbdbf9732
Merge 2d0e881db0 into 41a0f18ba9 2025-11-25 13:16:23 -05:00
Don McCurdy 41a0f18ba9
Merge pull request #13018 from CesiumGS/billboard-depth-regression-fix
Fixes model-billboard depth interactions
2025-11-25 18:03:41 +00:00
Don McCurdy 8bd8ae7f63
Merge branch 'main' into billboard-depth-regression-fix 2025-11-25 13:02:57 -05:00
Matt Schwartz 020749de32 Add to CHANGES.md 2025-11-05 09:27:19 -05:00
Matt Schwartz f4e49d7b64 Fixes model-billboard depth interactions 2025-11-05 09:12:11 -05:00
Jeshurun Hembd 2d0e881db0 Update playwright config for new Chrome headless 2025-06-05 16:15:41 -04:00
Jeshurun Hembd b8ee60182e Revert GPU args in playwright launch config 2025-06-04 17:58:43 -04:00
Jeshurun Hembd e87a069808 Update playwright version, yargs syntax 2025-06-04 16:24:05 -04:00
7 changed files with 47 additions and 24 deletions

View File

@ -1,11 +1,12 @@
# Change Log
## 1.136
## 1.136 - 2025-12-01
### @cesium/engine
#### Fixes :wrench:
- Fixed depth testing bug with billboards and labels clipping through models [#13012](https://github.com/CesiumGS/cesium/issues/13012)
- Billboards using `imageSubRegion` now render as expected. [#12585](https://github.com/CesiumGS/cesium/issues/12585)
- Improved scaling of SVGs in billboards [#13020](https://github.com/CesiumGS/cesium/issues/13020)
- Fixed unexpected outline artifacts around billboards [#13038](https://github.com/CesiumGS/cesium/issues/13038)

View File

@ -1,14 +1,16 @@
import { defineConfig, devices } from "@playwright/test";
import yargs from "yargs";
const argv = yargs(process.argv).options({
"update-snapshots": {
alias: "u",
description: "Update test snapshots.",
type: "boolean",
default: false,
},
}).argv;
const argv = yargs(process.argv)
.options({
"update-snapshots": {
alias: "u",
description: "Update test snapshots.",
type: "boolean",
default: false,
},
})
.parse();
const baseUrl = `http://localhost:3000`;
const updateSnapshots = argv["update-snapshots"];
@ -53,10 +55,11 @@ export default defineConfig({
name: "chromium",
use: {
...devices["Desktop Chrome"],
channel: "chromium",
viewport: defaultViewport,
launchOptions: {
// this forces chrome to use the gpu for webgl which greatly speeds up tests
args: ["--use-angle=gl"],
args: ["--use-angle=gl", "--enable-features=Vulkan"],
},
},
},

View File

@ -57,7 +57,7 @@ const noDevelopmentGallery =
taskName === "release" ||
taskName === "makeZip" ||
taskName === "websiteRelease";
const argv = yargs(process.argv).argv;
const argv = yargs(process.argv).parse();
const verbose = argv.verbose;
const sourceFiles = [

View File

@ -56,7 +56,7 @@
},
"devDependencies": {
"@cesium/eslint-config": "^12.0.0",
"@playwright/test": "^1.41.1",
"@playwright/test": "^1.52.0",
"chokidar": "^4.0.1",
"cloc": "^2.6.0-cloc",
"compression": "^1.7.4",

View File

@ -34,6 +34,7 @@ import SDFSettings from "./SDFSettings.js";
import TextureAtlas from "../Renderer/TextureAtlas.js";
import VerticalOrigin from "./VerticalOrigin.js";
import Ellipsoid from "../Core/Ellipsoid.js";
import WebGLConstants from "../Core/WebGLConstants.js";
const SHOW_INDEX = Billboard.SHOW_INDEX;
const POSITION_INDEX = Billboard.POSITION_INDEX;
@ -2039,7 +2040,8 @@ BillboardCollection.prototype.update = function (frameState) {
) {
this._rsOpaque = RenderState.fromCache({
depthTest: {
enabled: false,
enabled: true,
func: WebGLConstants.LESS,
},
depthMask: true,
});
@ -2059,7 +2061,10 @@ BillboardCollection.prototype.update = function (frameState) {
) {
this._rsTranslucent = RenderState.fromCache({
depthTest: {
enabled: false,
enabled: true,
func: useTranslucentDepthMask
? WebGLConstants.LEQUAL
: WebGLConstants.LESS,
},
depthMask: useTranslucentDepthMask,
blending: BlendingState.ALPHA_BLEND,

View File

@ -131,7 +131,9 @@ void doThreePointDepthTest(float eyeDepth, bool applyTranslate) {
}
#endif
void doDepthTest() {
// Extra manual depth testing is done to allow more control over how a billboard is occluded
// by the globe when near and far from the camera.
void doDepthTest(float globeDepth) {
float temp = v_compressed.y;
temp = temp * SHIFT_RIGHT1;
float temp2 = (temp - floor(temp)) * SHIFT_LEFT1;
@ -156,14 +158,10 @@ void doDepthTest() {
}
#endif
// Automatic depth testing of billboards is disabled (@see BillboardCollection#update).
// Instead, we do one of two types of manual depth tests (potentially in addition to the test above), depending on the camera's distance to the billboard fragment.
// If we're far away, we just compare against a flat, camera-facing depth-plane at the ellipsoid's center.
// If we're close, we compare against the globe depth texture (which includes depth from the 3D tile pass).
vec2 fragSt = gl_FragCoord.xy / czm_viewport.zw;
float globeDepth = getGlobeDepthAtCoords(fragSt);
if (globeDepth == 0.0) return; // Not on globe
if (globeDepth == 0.0) return; // Not on globe
float distanceToEllipsoidCenter = -length(czm_viewerPositionWC); // depth is negative by convention
float testDistance = (eyeDepth > -u_coarseDepthTestDistance) ? globeDepth : distanceToEllipsoidCenter;
if (eyeDepth < testDistance) {
@ -175,7 +173,10 @@ void main()
{
if (v_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;
if (v_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;
doDepthTest();
vec2 fragSt = gl_FragCoord.xy / czm_viewport.zw;
float globeDepth = getGlobeDepthAtCoords(fragSt);
doDepthTest(globeDepth);
vec4 color = texture(u_atlas, v_textureCoordinates);
@ -243,6 +244,18 @@ void main()
out_FragColor = color;
#ifdef LOG_DEPTH
czm_writeLogDepth();
// If we've made it here, we passed our manual depth test, above. But the automatic depth test will
// still run, and some fragments of the billboard may clip against the globe. To prevent that,
// ensure the depth value we write out is in front of the globe depth.
float depthArg = v_depthFromNearPlusOne;
if (globeDepth != 0.0) { // On the globe
float globeDepthFromNearPlusOne = (-globeDepth - czm_currentFrustum.x) + 1.0;
float nudge = max(globeDepthFromNearPlusOne * 5e-6, czm_epsilon7);
float globeOnTop = max(1.0, globeDepthFromNearPlusOne - nudge);
depthArg = min(depthArg, globeOnTop);
}
czm_writeLogDepth(depthArg);
#endif
}

View File

@ -37,7 +37,8 @@ const argv = yargs(process.argv)
description: "If true, skip build step and serve existing built files.",
},
})
.help().argv;
.help()
.parse();
// These functions will not exist in the production zip file but they also won't be run
const { getSandcastleConfig, buildSandcastleGallery, buildSandcastleApp } =