-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
CubeCamera: Force autoClear. #32697
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
base: dev
Are you sure you want to change the base?
CubeCamera: Force autoClear. #32697
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes an issue where fromEquirectangularTexture could produce blank cubemaps when renderer.autoClear is set to false. The fix ensures that autoClear is temporarily forced to true during the cubemap rendering operation, then restored to its original value.
Key Changes:
- Added save/restore logic for
renderer.autoClearin thefromEquirectangularTexturemethod to guarantee proper clearing behavior
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Do you mind explaining in more detail how a "blank cubemap" can happen when a clear is missing? I'm also thinking about use cases were are potentially missing that break with this change. I wonder if there are scenarios where a clear during the update process of a cube map isn't wanted. With this change, there is no way to force "no clear". The previous code was more flexible since you can enable auto clear on app level before updating a cube camera. |
|
In my case, I did two things:
As a result, I unexpectedly got a black background. This happens because the engine internally calls fromEquirectangularTexture, which creates a render target and a mesh. That mesh is not rendered due to depth testing in WebGPU. Now, when I think about it probably, the issue could be resolved by disabling depth testing for that mesh. I'll check it tomorrow. |
If that works our for you, I would frankly prefer to not change the |
|
@Mugen87 I have just updated |
Is it possible for your to demonstrate the issue with a live example first? |
| side: BackSide, | ||
| blending: NoBlending | ||
| blending: NoBlending, | ||
| depthTest: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I don't understand how this fixes any issues since CubeCamera only renders the mesh defined by the cube render target the equirectangular texture is projected on.
Description
Force
autoClear. The engine can usefromEquirectangularTextureunder the hood, and if the user setsrenderer.autoClear = false, they may unexpectedly get a blank cubemap fromfromEquirectangularTexture.