Skip to content

Conversation

@sunag
Copy link
Collaborator

@sunag sunag commented May 26, 2023

Fixed #23372

Description

I mixed @Mugen87 and @CodyJasonBennett work into this PR, and I prepared it for WebGPURenderer by removing the hack. I think the idea that @Mugen87 is the best one about Coordinate System, because modifying a little we have access to the Renderer.coordinateSystem and Camera.coordinateSystem can facilitate some necessary paths, like in my recent case I had to change the CubeCamera to the WebGPUCoordinateSystem.

@github-actions
Copy link

github-actions bot commented May 26, 2023

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
642.9 kB (159.1 kB) 643.6 kB (159.4 kB) +660 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
432.9 kB (104.8 kB) 433.5 kB (105 kB) +603 B

@sunag sunag requested a review from Mugen87 May 26, 2023 03:41
@sunag sunag marked this pull request as ready for review May 26, 2023 03:41
export const _SRGBAFormat = 1035; // fallback for WebGL 1

export const WebGLCoordinateSystem = 2000;
export const WebGPUCoordinateSystem = 2001;
Copy link
Contributor

@LeviPesin LeviPesin May 26, 2023

Choose a reason for hiding this comment

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

I think these should be called GLCoordinateSystem and NDCCoordinateSystem?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we assume this, I think we would imply that WebGL does not have an NDC when it's just different. I was inclined to use the term NDC but after implementing CubeCamera I had other issues with the coordinate system. For these reasons I believe that using the name WebGPUCoordinateSystem for example would be easier to create any future path.

@LeviPesin
Copy link
Contributor

I think this is the most cleanest solution to this problem indeed!


camera.coordinateSystem = coordinateSystem;

camera.updateProjectionMatrix();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@mrdoob I fixed ( #23372 (comment) ) issue here. If the camera has updated the projectionMatrix using the WebGL coordinate system, it will now update again with the WebGPU coordinate system.

@mrdoob
Copy link
Owner

mrdoob commented May 30, 2023

Looks good to me! 👍👍

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.

WebGPURenderer's Matrix4 side-effects break tree-shaking and WebGLRenderer

4 participants