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

StereoEffect: Handle clear differently. #29125

Merged
merged 2 commits into from
Aug 13, 2024
Merged

StereoEffect: Handle clear differently. #29125

merged 2 commits into from
Aug 13, 2024

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Aug 13, 2024

Related issue: -

Description

I was testing what type of effects already work with WebGPURenderer(it's AsciiEffect and PeppersGhostEffect, btw). StereoEffect does not work because of the way the clear happens in render().

When defining a scissor area, WebGL honors it during the clear. That does not work with WebGPU where the clear value is loaded for the entire framebuffer.

StereoEffect clears now the entire framebuffer once before rendering the left and right view.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Aug 13, 2024

@WestLangley StereoCamera manipulates the projection matrices for the left and right eye to achieve an off-axis stereoscopic effect. It seems these changes do not work with WebGPU (using WebGPURenderer in webgl_effects_stereo produces a wrong image), probably because it has different NDC conventions. We have different code paths for WebGL and WebGPU in Matrix4.makePerspective() and we probably need something similar in StereoCamera. Do you know what part of the matrix computation in StereoCamera.update() must be changed to make it compatible to WebGPU?

@Mugen87 Mugen87 added this to the r168 milestone Aug 13, 2024
@Mugen87 Mugen87 merged commit 9405496 into mrdoob:dev Aug 13, 2024
11 checks passed
@WestLangley
Copy link
Collaborator

@Mugen87 If I am not mistaken, StereoCamera does not know the correct coordinateSystem.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Aug 13, 2024

We can inject the coordinate system from outside, e.g. StereoEffect, AnaglyphEffect or ParallaxBarrierEffect. These classes have a reference to the renderer and can assign the value when creating a stereo camera.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Aug 13, 2024

The following line can be added to the constructor of StereoCamera.

this.coordinateSystem = WebGLCoordinateSystem;

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.

2 participants