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

WebGPURenderer: Fix color space of clear colors. #30488

Merged
merged 1 commit into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/renderers/common/Backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ class Backend {

renderer.getClearColor( _color4 );

_color4.getRGB( _color4, this.renderer.currentColorSpace );
_color4.getRGB( _color4 );

return _color4;

Expand Down
6 changes: 3 additions & 3 deletions src/renderers/common/Background.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import NodeMaterial from '../../materials/nodes/NodeMaterial.js';

import { Mesh } from '../../objects/Mesh.js';
import { SphereGeometry } from '../../geometries/SphereGeometry.js';
import { BackSide, LinearSRGBColorSpace } from '../../constants.js';
import { BackSide } from '../../constants.js';

const _clearColor = /*@__PURE__*/ new Color4();

Expand Down Expand Up @@ -64,14 +64,14 @@ class Background extends DataMap {

// no background settings, use clear color configuration from the renderer

renderer._clearColor.getRGB( _clearColor, LinearSRGBColorSpace );
renderer._clearColor.getRGB( _clearColor );
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Better to not use LinearSRGBColorSpace and use the default ColorManagement.workingColorSpace which is LinearSRGBColorSpace.

_clearColor.a = renderer._clearColor.a;

} else if ( background.isColor === true ) {

// background is an opaque color

background.getRGB( _clearColor, LinearSRGBColorSpace );
background.getRGB( _clearColor );
_clearColor.a = 1;

forceClear = true;
Expand Down