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

Camera non-default viewport size ignores camera clear color #6231

Closed
MarlonLam opened this issue Apr 9, 2024 · 1 comment · Fixed by #6241
Closed

Camera non-default viewport size ignores camera clear color #6231

MarlonLam opened this issue Apr 9, 2024 · 1 comment · Fixed by #6241
Assignees
Labels
area: graphics Graphics related issue bug

Comments

@MarlonLam
Copy link

Description

When changing the camera viewport from default (0, 0, 1, 1) to non-default values e.g. (0.01, 0, 1, 1), the camera's clear color is ignored.

Test URL

Test project: https://playcanvas.com/editor/scene/1980662

Screenshots

(0, 0, 1, 1):
image

(0.01, 0, 1, 1):
image

Platform

Tested in Edge

Steps to Reproduce

  1. Set camera viewport size to something other than (0, 0, 1, 1)
  2. Launch

Additional Notes

From my own digging around, I found a property assignment for "clearColor":

if (!firstRenderAction || !camera.camera.fullSizeClearRect) {
options.clearColor = renderAction.clearColor;
options.clearDepth = renderAction.clearDepth;
options.clearStencil = renderAction.clearStencil;
}
renderer.renderForwardLayer(camera.camera, renderAction.renderTarget, layer, transparent,
shaderPass, renderAction.viewBindGroups, options);

But in "renderForwardLayer" function, the property read is "clearColors":

const clearColor = options.clearColors ?? false;
const clearDepth = options.clearDepth ?? false;
const clearStencil = options.clearStencil ?? false;
if (clearColor || clearDepth || clearStencil) {
this.clear(camera, clearColor, clearDepth, clearStencil);
}

@mvaligursky
Copy link
Contributor

Thanks for this, easy to fix if you just point it out to us!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants