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

Multisampling effectively disables Depth Texture #23604

Closed
vanruesc opened this issue Feb 27, 2022 · 1 comment · Fixed by #23611
Closed

Multisampling effectively disables Depth Texture #23604

vanruesc opened this issue Feb 27, 2022 · 1 comment · Fixed by #23611

Comments

@vanruesc
Copy link
Contributor

Describe the bug

WebGLMultisampleRenderTarget was removed in #23455 and the functionality was added to WebGLRenderTarget with the new samples property. However, when using a DepthTexture attachment on a render target with multisampling enabled, the depth texture remains empty because depth is being invalidated for performance reasons regarding WebXR. This behaviour was the same with WebGLMultisampleRenderTarget, but that class had an undocumented ignoreDepthForMultisampleCopy property that allowed to preserve depth. I don't think this property was carried over in r138.

To Reproduce

Steps to reproduce the behavior:

  1. Render a scene into a multisample render target that has a depth texture attachment.
  2. Render the contents of the depth texture to screen.
  3. See empty image.

Live example

Uncomment line 60 in index.js: Sandbox

Expected behavior

Depth should be preserved if the multisample render target has a depth texture attachment.

Platform:

  • Device: Desktop
  • OS: Linux
  • Browser: Firefox (white screen), Brave (black screen)
  • Three.js version: r138
@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 28, 2022

I think we can fix this issue by changing the following line:

const ignoreDepthValues = ( renderTargetProperties.__ignoreDepthValues !== undefined ) ? renderTargetProperties.__ignoreDepthValues : true;

If __ignoreDepthValues is undefined, the line returns false. That should solve the issue.

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

Successfully merging a pull request may close this issue.

2 participants