Skip to content

Commit

Permalink
SepiaNode: Support transparent background (#29130)
Browse files Browse the repository at this point in the history
  • Loading branch information
WestLangley authored Aug 14, 2024
1 parent 828769f commit 27f38e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/nodes/display/SepiaNode.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addNodeElement, Fn, vec3 } from '../shadernode/ShaderNode.js';
import { addNodeElement, Fn, vec3, vec4 } from '../shadernode/ShaderNode.js';
import { dot } from '../math/MathNode.js';

export const sepia = /*@__PURE__*/ Fn( ( [ color ] ) => {
Expand All @@ -7,10 +7,11 @@ export const sepia = /*@__PURE__*/ Fn( ( [ color ] ) => {

// https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/sepia.js

return vec3(
return vec4(
dot( c, vec3( 0.393, 0.769, 0.189 ) ),
dot( c, vec3( 0.349, 0.686, 0.168 ) ),
dot( c, vec3( 0.272, 0.534, 0.131 ) )
dot( c, vec3( 0.272, 0.534, 0.131 ) ),
color.a
);

} );
Expand Down

0 comments on commit 27f38e3

Please sign in to comment.