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

ToneMappingNode: properly handle alpha #29076

Merged
merged 1 commit into from
Aug 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Properly handle alpha
  • Loading branch information
WestLangley committed Aug 7, 2024
commit 138a89c2b4f06443bd22e9a34b576ba5b8fcb8c3
6 changes: 3 additions & 3 deletions src/nodes/display/ToneMappingNode.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import TempNode from '../core/TempNode.js';
import { addNodeClass } from '../core/Node.js';
import { addNodeElement, Fn, nodeObject, float, mat3, vec3, If } from '../shadernode/ShaderNode.js';
import { addNodeElement, Fn, nodeObject, float, mat3, vec3, vec4, If } from '../shadernode/ShaderNode.js';
import { rendererReference } from '../accessors/RendererReferenceNode.js';
import { select } from '../math/CondNode.js';
import { clamp, log2, max, min, pow, mix } from '../math/MathNode.js';
Expand Down Expand Up @@ -194,14 +194,14 @@ class ToneMappingNode extends TempNode {

if ( toneMapping === NoToneMapping ) return colorNode;

const toneMappingParams = { exposure: this.exposureNode, color: colorNode };
const toneMappingParams = { exposure: this.exposureNode, color: colorNode.rgb };
const toneMappingNode = toneMappingLib[ toneMapping ];

let outputNode = null;

if ( toneMappingNode ) {

outputNode = toneMappingNode( toneMappingParams );
outputNode = vec4( toneMappingNode( toneMappingParams ), colorNode.a );

} else {

Expand Down