Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
1d02adc
save change
danielzhong Aug 6, 2025
b1970e6
save work
danielzhong Aug 7, 2025
7ee0e74
save
danielzhong Aug 7, 2025
3ab4db2
add temp test for decode gltf
danielzhong Aug 8, 2025
1afc12c
save
danielzhong Aug 8, 2025
5a19ba9
save
danielzhong Aug 9, 2025
f79b50f
test decoding with cesium outline
danielzhong Aug 11, 2025
3f0ce2c
save
danielzhong Aug 12, 2025
48509e6
Proving Draw Command Succesfully
danielzhong Aug 12, 2025
6e0013e
working for quad
danielzhong Aug 13, 2025
8d41bfb
Created LUT for hard edge
danielzhong Aug 14, 2025
172a3f9
save normal in shader
danielzhong Aug 15, 2025
2a28ea2
showing edge color
danielzhong Aug 18, 2025
7bd1517
change pass
danielzhong Aug 19, 2025
6400cef
save
danielzhong Aug 20, 2025
07bae45
save
danielzhong Aug 20, 2025
6a7c003
save
danielzhong Aug 20, 2025
31ed492
save
danielzhong Aug 20, 2025
ad8d074
save
danielzhong Aug 20, 2025
cb73143
save
danielzhong Aug 21, 2025
bf97892
save
danielzhong Aug 21, 2025
549a08e
solve bug, clean up code
danielzhong Aug 21, 2025
93ddaae
Silhoutte Normal Save
danielzhong Aug 21, 2025
af97e57
Edge + geometry rendering
danielzhong Aug 22, 2025
78c4d02
z fighting save
danielzhong Aug 23, 2025
7f33eee
MRT save
danielzhong Aug 23, 2025
1ceba1d
MTR printing color
danielzhong Aug 25, 2025
0017b85
MTR debuging id
danielzhong Aug 25, 2025
bf7e9fd
MTR fix
danielzhong Aug 26, 2025
3b136de
MTR clean up
danielzhong Aug 26, 2025
1736aa8
feature id temp save
danielzhong Aug 26, 2025
d2bf276
feature id temp save
danielzhong Aug 26, 2025
7873a4f
clear framebuffer temp save
danielzhong Aug 26, 2025
cd5e791
clear framebuffer solved
danielzhong Aug 26, 2025
604dac1
feature id save
danielzhong Aug 27, 2025
88ac62c
feature id save
danielzhong Aug 27, 2025
8394f7c
clean up
danielzhong Aug 27, 2025
bcefc61
clean up
danielzhong Aug 27, 2025
530d806
Merge branch 'main' into danielzhong/edge_line_unique_VAO
danielzhong Aug 27, 2025
5cac3a7
CONTRIBUTOR.md
danielzhong Aug 27, 2025
aa0b59e
CHANGES.md
danielzhong Aug 27, 2025
4785ee4
fix PR build/test error
danielzhong Aug 27, 2025
7bf643d
Feature ID + Depth
danielzhong Aug 28, 2025
cee379e
Clean up
danielzhong Aug 28, 2025
2dbc3d8
Clean up
danielzhong Aug 28, 2025
172f7f3
Merge branch 'main' into danielzhong/edge_line_unique_VAO
danielzhong Aug 28, 2025
3482808
resolve conflict with OIT color attachment
danielzhong Aug 28, 2025
34521d1
resolve conflict with OIT color attachment
danielzhong Aug 28, 2025
3fa39bf
Silhoutte Bug Fix
danielzhong Aug 28, 2025
c0f9081
upload test files
danielzhong Aug 28, 2025
95f6ccc
Merge branch 'main' into danielzhong/edge_line_unique_VAO
danielzhong Aug 28, 2025
14e6a07
Merge branch 'danielzhong/edge_line_unique_VAO' of https://github.com…
danielzhong Aug 28, 2025
c6beb0a
clean
danielzhong Aug 29, 2025
3f695be
test file
danielzhong Aug 29, 2025
0a7208d
gltf loader unit tests
danielzhong Aug 29, 2025
935187d
Merge branch 'main' into danielzhong/edge_line_unique_VAO
danielzhong Aug 29, 2025
25f40e2
unit tests
danielzhong Aug 30, 2025
dd7107a
unit tests
danielzhong Aug 30, 2025
98cdacd
unit tests
danielzhong Aug 30, 2025
095e0de
unit tests
danielzhong Aug 30, 2025
3d801d1
Merge branch 'main' into edge_line_unique_VAO
ggetz Sep 9, 2025
1c9ba9d
Merge branch 'main' into edge_line_unique_VAO
danielzhong Sep 9, 2025
a508201
Update packages/engine/Source/Scene/Scene.js
danielzhong Sep 16, 2025
70b2118
EdgeVisibility.glb
danielzhong Sep 16, 2025
1646383
Revert "EdgeVisibility.glb"
danielzhong Sep 16, 2025
81a1132
glb
danielzhong Sep 16, 2025
43abed5
adding comments
danielzhong Sep 16, 2025
a90a594
refactor loadIndices
danielzhong Sep 16, 2025
c63bb6a
EdgeVisibility Scene Toggle
danielzhong Sep 16, 2025
59ed55e
Edge Depth
danielzhong Sep 18, 2025
7da8453
optimize scene edge visibility toggle
danielzhong Sep 18, 2025
afe6e41
temp edge color: white
danielzhong Sep 18, 2025
bc16ca0
Merge branch 'main' into edge_line_unique_VAO
danielzhong Sep 18, 2025
90699e1
Revert "Merge branch 'main' into edge_line_unique_VAO"
danielzhong Sep 18, 2025
bcc5f55
Revert "optimize scene edge visibility toggle"
danielzhong Sep 18, 2025
5a00918
Reapply "optimize scene edge visibility toggle"
danielzhong Sep 18, 2025
b896c22
Reapply "Merge branch 'main' into edge_line_unique_VAO"
danielzhong Sep 18, 2025
25d8eb3
Merge branch 'main' into edge_line_unique_VAO
danielzhong Sep 18, 2025
04d429a
Update packages/engine/Source/Scene/Model/EdgeVisibilityPipelineStage.js
danielzhong Sep 19, 2025
4f4a1d5
Update packages/engine/Source/Scene/Model/EdgeVisibilityPipelineStage.js
danielzhong Sep 19, 2025
38a6680
remove edge visibility extra v_positionView
danielzhong Sep 19, 2025
6b43c56
Optimize using Cartesian3 and leas heap allocations
danielzhong Sep 19, 2025
335d7bc
handel case when positions are quantized
danielzhong Sep 19, 2025
bad1aa1
Revert "handel case when positions are quantized"
danielzhong Sep 19, 2025
688a5a4
Reapply "handel case when positions are quantized"
danielzhong Sep 19, 2025
2a356aa
fix
danielzhong Sep 19, 2025
f3e807f
Merge branch 'main' into edge_line_unique_VAO
danielzhong Sep 19, 2025
5036f73
Merge branch 'main' into edge_line_unique_VAO
danielzhong Sep 23, 2025
92ef75f
Adding FeatureID check
danielzhong Sep 24, 2025
3916a99
Fix
danielzhong Sep 25, 2025
dd67f96
Fix
danielzhong Sep 25, 2025
c69f8a0
fix bug
danielzhong Sep 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#### Additions :tada:

- Added support for the [EXT_mesh_primitive_edge_visibility](https://github.com/KhronosGroup/glTF/pull/2479) glTF extension. [#12765](https://github.com/CesiumGS/cesium/issues/12765)
- Adds an async factory method for the Material class that allows callers to wait on resource loading. [#10566](https://github.com/CesiumGS/cesium/issues/10566)

## 1.133.1 - 2025-09-08
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
- [Paul Connelly](https://github.com/pmconne)
- [Jason Crow](https://github.com/jason-crow)
- [Erin Ingram](https://github.com/eringram)
- [Daniel Zhong](https://github.com/danielzhong)
- [Mark Schlosser](https://github.com/markschlosseratbentley)
- [Flightradar24 AB](https://www.flightradar24.com)
- [Aleksei Kalmykov](https://github.com/kalmykov)
Expand Down
Binary file not shown.
10 changes: 10 additions & 0 deletions Specs/getWebGLStub.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ const instancedArraysStub = {
vertexAttribDivisorANGLE: noop,
};

// WEBGL_draw_buffers
const drawBuffersStub = {
drawBuffersWEBGL: noop,
};

function noop() {}

function createStub() {
Expand Down Expand Up @@ -208,6 +213,11 @@ function getExtensionStub(name) {
return {};
}

// EdgeFramebuffer and other MRT features require draw buffers
if (name === "WEBGL_draw_buffers") {
return drawBuffersStub;
}

// No other extensions are stubbed.
return null;
}
Expand Down
61 changes: 61 additions & 0 deletions packages/engine/Source/Renderer/AutomaticUniforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,67 @@ const AutomaticUniforms = {
},
}),

/**
* An automatic GLSL uniform representing a texture containing edge IDs
* from the 3D Tiles edge rendering pass. Used for edge detection and
* avoiding z-fighting between edges and surfaces.
*
* @example
* // GLSL declaration
* uniform sampler2D czm_edgeIdTexture;
*
* // Get the edge ID at the current fragment
* vec2 coords = gl_FragCoord.xy / czm_viewport.zw;
* vec4 edgeId = texture(czm_edgeIdTexture, coords);
*/
czm_edgeIdTexture: new AutomaticUniform({
size: 1,
datatype: WebGLConstants.SAMPLER_2D,
getValue: function (uniformState) {
return uniformState.edgeIdTexture;
},
}),

/**
* An automatic GLSL uniform containing the edge color texture.
* This texture contains the edge content rendered during the CESIUM_3D_TILE_EDGES pass.
*
* @example
* // GLSL declaration
* uniform sampler2D czm_edgeColorTexture;
*
* // Sample the edge color at the current fragment
* vec2 coords = gl_FragCoord.xy / czm_viewport.zw;
* vec4 edgeColor = texture(czm_edgeColorTexture, coords);
*/
czm_edgeColorTexture: new AutomaticUniform({
size: 1,
datatype: WebGLConstants.SAMPLER_2D,
getValue: function (uniformState) {
return uniformState.edgeColorTexture;
},
}),

/**
* An automatic GLSL uniform containing the packed depth texture produced by the
* edge visibility pass. The depth is packed via czm_packDepth and should be
* unpacked with czm_unpackDepth.
*
* @example
* // GLSL declaration
* uniform sampler2D czm_edgeDepthTexture;
*
* vec2 coords = gl_FragCoord.xy / czm_viewport.zw;
* float d = czm_unpackDepth(texture(czm_edgeDepthTexture, coords));
*/
czm_edgeDepthTexture: new AutomaticUniform({
size: 1,
datatype: WebGLConstants.SAMPLER_2D,
getValue: function (uniformState) {
return uniformState.edgeDepthTexture;
},
}),

/**
* An automatic GLSL uniform representing a 4x4 model transformation matrix that
* transforms model coordinates to world coordinates.
Expand Down
19 changes: 10 additions & 9 deletions packages/engine/Source/Renderer/Pass.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ const Pass = {
COMPUTE: 1,
GLOBE: 2,
TERRAIN_CLASSIFICATION: 3,
CESIUM_3D_TILE: 4,
CESIUM_3D_TILE_CLASSIFICATION: 5,
CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW: 6,
OPAQUE: 7,
TRANSLUCENT: 8,
VOXELS: 9,
GAUSSIAN_SPLATS: 10,
OVERLAY: 11,
NUMBER_OF_PASSES: 12,
CESIUM_3D_TILE_EDGES: 4,
CESIUM_3D_TILE: 5,
CESIUM_3D_TILE_CLASSIFICATION: 6,
CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW: 7,
OPAQUE: 8,
TRANSLUCENT: 9,
VOXELS: 10,
GAUSSIAN_SPLATS: 11,
OVERLAY: 12,
NUMBER_OF_PASSES: 13,
};
export default Object.freeze(Pass);
12 changes: 12 additions & 0 deletions packages/engine/Source/Renderer/UniformState.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ function UniformState() {
* @type {Texture}
*/
this.globeDepthTexture = undefined;
/**
* @type {Texture}
*/
this.edgeIdTexture = undefined;
/**
* @type {Texture}
*/
this.edgeColorTexture = undefined;
/**
* @type {Texture}
*/
this.edgeDepthTexture = undefined; // packed depth color attachment from edge pass
/**
* @type {number}
*/
Expand Down
245 changes: 245 additions & 0 deletions packages/engine/Source/Scene/EdgeFramebuffer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
import defined from "../Core/defined.js";
import destroyObject from "../Core/destroyObject.js";
import PixelFormat from "../Core/PixelFormat.js";
import Color from "../Core/Color.js";
import PixelDatatype from "../Renderer/PixelDatatype.js";
import FramebufferManager from "../Renderer/FramebufferManager.js";
import ClearCommand from "../Renderer/ClearCommand.js";

/**
* Creates and manages framebuffers for edge visibility rendering.
*
* @param {Object} options Object with the following properties:
*
* @alias EdgeFramebuffer
* @constructor
*
* @private
*/
function EdgeFramebuffer(options) {
options = options || {};

// Create framebuffer manager with multiple render targets (MRT)
// Color attachment 0: edge color output (visualization / debug)
// Color attachment 1: R: edge type, G: featureId (metadata / ids)
// Color attachment 2: packed depth (czm_packDepth) for edge fragments
this._framebufferManager = new FramebufferManager({
colorAttachmentsLength: 3, // MRT: Color + ID + Depth (packed RGBA)
createColorAttachments: true,
depthStencil: true,
supportsDepthTexture: true,
color: true,
});

this._framebuffer = undefined;
this._colorTexture = undefined;
this._idTexture = undefined;
this._depthTexture = undefined; // packed depth color attachment (location = 2)
this._depthStencilTexture = undefined;

this._clearCommand = new ClearCommand({
color: new Color(0.0, 0.0, 0.0, 0.0),
depth: 1.0,
stencil: 0,
owner: this,
});
}

Object.defineProperties(EdgeFramebuffer.prototype, {
/**
* Gets the framebuffer for edge rendering.
* @memberof EdgeFramebuffer.prototype
* @type {Framebuffer}
* @readonly
*/
framebuffer: {
get: function () {
return this._framebuffer;
},
},

/**
* Gets the color texture.
* @memberof EdgeFramebuffer.prototype
* @type {Texture}
* @readonly
*/
colorTexture: {
get: function () {
return this._colorTexture;
},
},

/**
* Gets the ID texture.
* @memberof EdgeFramebuffer.prototype
* @type {Texture}
* @readonly
*/
idTexture: {
get: function () {
return this._idTexture;
},
},

/**
* Gets the packed depth texture written during the edge pass.
* @memberof EdgeFramebuffer.prototype
* @type {Texture}
* @readonly
*/
depthTexture: {
get: function () {
return this._depthTexture;
},
},

/**
* Gets the depth-stencil texture.
* @memberof EdgeFramebuffer.prototype
* @type {Texture}
* @readonly
*/
depthStencilTexture: {
get: function () {
return this._depthStencilTexture;
},
},
});

/**
* Updates the framebuffer.
*
* @param {Context} context The context.
* @param {Viewport} viewport The viewport.
* @param {boolean} hdr Whether HDR is enabled.
* @param {Texture} [existingColorTexture] Optional existing color texture to reuse.
* @param {Texture} [existingDepthTexture] Optional existing depth texture to reuse.
*
* @returns {boolean} True if the framebuffer was updated; otherwise, false.
*/
EdgeFramebuffer.prototype.update = function (
context,
viewport,
hdr,
existingColorTexture,
existingDepthTexture,
) {
const width = viewport.width;
const height = viewport.height;

const pixelDatatype = hdr
? context.halfFloatingPointTexture
? PixelDatatype.HALF_FLOAT
: PixelDatatype.FLOAT
: PixelDatatype.UNSIGNED_BYTE;

const changed = this._framebufferManager.update(
context,
width,
height,
1, // No MSAA
pixelDatatype,
PixelFormat.RGBA,
);

// Always assign framebuffer if FramebufferManager has one
if (this._framebufferManager.framebuffer) {
this._framebuffer = this._framebufferManager.framebuffer;

// Get the textures from the framebuffer manager or use existing ones
this._colorTexture = defined(existingColorTexture)
? existingColorTexture
: this._framebufferManager.getColorTexture(0); // Color attachment 0
this._idTexture = this._framebufferManager.getColorTexture(1); // Color attachment 1: ID texture
this._depthTexture = this._framebufferManager.getColorTexture(2); // Color attachment 2: packed depth
this._depthStencilTexture = defined(existingDepthTexture)
? existingDepthTexture
: this._framebufferManager.getDepthStencilTexture();
}

return changed;
};

/**
* Clears the framebuffer using ClearCommand.
* @deprecated Use getClearCommand() instead for proper MRT clearing.
*
* @param {Context} context The context.
* @param {PassState} passState The pass state.
* @param {Color} clearColor The clear color.
*/
EdgeFramebuffer.prototype.clear = function (context, passState, clearColor) {
const clearCommand = this.getClearCommand(clearColor);
clearCommand.execute(context, passState);
};

/**
* Gets the clear command for this framebuffer.
*
* @param {Color} [clearColor] The clear color to use. If undefined, uses the default.
* @returns {ClearCommand} The clear command.
*/
EdgeFramebuffer.prototype.getClearCommand = function (clearColor) {
this._clearCommand.framebuffer = this._framebuffer;

if (defined(clearColor)) {
Color.clone(clearColor, this._clearCommand.color);
}

return this._clearCommand;
};

/**
* Gets the edge framebuffer, creating it if necessary.
*
* @param {Context} context The context.
* @param {Viewport} viewport The viewport.
* @param {Texture} [existingColorTexture] Optional existing color texture to reuse.
* @param {Texture} [existingDepthTexture] Optional existing depth texture to reuse.
*
* @returns {Framebuffer} The edge framebuffer.
*/
EdgeFramebuffer.prototype.getFramebuffer = function (
context,
viewport,
existingColorTexture,
existingDepthTexture,
) {
this.update(
context,
viewport,
false,
existingColorTexture,
existingDepthTexture,
);
return this._framebuffer;
};

/**
* Returns true if this object was destroyed; otherwise, false.
*
* @returns {boolean} True if this object was destroyed; otherwise, false.
*/
EdgeFramebuffer.prototype.isDestroyed = function () {
return false;
};

/**
* Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
* release of WebGL resources, instead of relying on the garbage collector to destroy this object.
* <br /><br />
* Once an object is destroyed, it should not be used; calling any function other than
* <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
* assign the return value (<code>undefined</code>) to the object as done in the example.
*
* @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
*/
EdgeFramebuffer.prototype.destroy = function () {
this._framebufferManager =
this._framebufferManager && this._framebufferManager.destroy();
this._clearCommand = undefined;
return destroyObject(this);
};

export default EdgeFramebuffer;
Loading