Skip to content
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

Add enableDebugWireframe to use wireframes for ModelExperimental in WebGL1 #10344

Merged
merged 4 commits into from
May 4, 2022

Conversation

j9liu
Copy link
Contributor

@j9liu j9liu commented May 3, 2022

Closes #10340. Currently wireframes in ModelExperimental require the indices to be loaded as typed arrays for WebGL1. However, this will result in performance costs for users that don't need the debugWireframe option.

The preferred solution is to require an option, enableDebugWireframe, to be explicitly set as true in the ModelExperimental constructors. If this is true, then debugWireframe will work for models in WebGL1. However, if this is not true, then toggling debugWireframe will have no effect. This will not affect models in WebGL2 because in WebGL2, data can be pulled from GPU buffers.

ModelExperimental Sandcastle and 3D Tiles sandcastle for testing. I left comments for the lines that should be toggled on / off for testing.

@cesium-concierge
Copy link

Thanks for the pull request @j9liu!

  • ✔️ Signed CLA found.
  • CHANGES.md was not updated.
    • If this change updates the public API in any way, please add a bullet point to CHANGES.md.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.

@j9liu j9liu requested a review from IanLilleyT May 3, 2022 17:40
@@ -269,6 +267,7 @@ describe(

afterAll(function () {
scene.destroyForSpecs();
sceneWithWebgl2.destroyForSpecs();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice catch!

const useUint8Array = indicesBuffer.sizeInBytes === indicesCount;
originalIndices = useUint8Array
? new Uint8Array(indicesCount)
: IndexDatatype.createTypedArray(vertexCount, indicesCount);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lilleyse do you know why IndexDatatype.createTypedArray doesn't output 8-bit indices, and if there's any code that depends on it outputting 16/32 only? Or if there's any code that also has this workaround.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, going to leave this code in, and address it in a future PR

@IanLilleyT
Copy link
Contributor

I turned wireframe on and off (both before and after this PR) in WebGL1 in the Model Experimental 3D Model Sandcastle and the memory reduction is working as expected!

New + No Wireframe:

Screen Shot 2022-05-03 at 2 04 52 PM

New + Wireframe:

Screen Shot 2022-05-03 at 2 04 59 PM

Old + No Wireframe:

Screen Shot 2022-05-03 at 2 08 33 PM

Old + Wireframe:

Screen Shot 2022-05-03 at 2 08 03 PM

@IanLilleyT
Copy link
Contributor

Thanks @j9liu !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better handling of ModelExperimental indices in WebGL1
3 participants