🎥 Make videos programmatically with React
`@remotion/effects`: Add white balance effect (#10294)
Jonny Burgera7766a5c3c37
diff --git a/packages/docs/components/effects-demos/registry.ts b/packages/docs/components/effects-demos/registry.tsindex 90c55471e0..b15af3cbd1 100644--- a/packages/docs/components/effects-demos/registry.ts+++ b/packages/docs/components/effects-demos/registry.ts@@ -59,6 +59,7 @@ import {venetianBlinds} from '@remotion/effects/venetian-blinds';import {vignette} from '@remotion/effects/vignette';import {wave} from '@remotion/effects/wave';import {waves} from '@remotion/effects/waves';+import {whiteBalance} from '@remotion/effects/white-balance';import {whiteNoise} from '@remotion/effects/white-noise';import {zigzag} from '@remotion/effects/zigzag';import {zoomBlur} from '@remotion/effects/zoom-blur';@@ -148,6 +149,7 @@ import {EffectsVenetianBlindsPreview} from '../effects/effects-venetian-blinds-pimport {EffectsVignettePreview} from '../effects/effects-vignette-preview';import {EffectsWavePreview} from '../effects/effects-wave-preview';import {EffectsWavesPreview} from '../effects/effects-waves-preview';+import {EffectsWhiteBalancePreview} from '../effects/effects-white-balance-preview';import {EffectsWhiteNoisePreview} from '../effects/effects-white-noise-preview';import {EffectsZigzagPreview} from '../effects/effects-zigzag-preview';import {EffectsZoomBlurPreview} from '../effects/effects-zoom-blur-preview';@@ -250,6 +252,14 @@ export const effectsDemos: EffectsDemoType[] = [comp: EffectsExposurePreview,schema: exposure().definition.schema,},+ {+ ...defaults,+ id: 'effects-white-balance',+ effectName: 'whiteBalance',+ effectImportPath: '@remotion/effects/white-balance',+ comp: EffectsWhiteBalancePreview,+ schema: whiteBalance().definition.schema,+ },{...defaults,id: 'effects-venetian-blinds',diff --git a/packages/docs/components/effects/effects-white-balance-preview.tsx b/packages/docs/components/effects/effects-white-balance-preview.tsxnew file mode 100644index 0000000000..655fb08525--- /dev/null+++ b/packages/docs/components/effects/effects-white-balance-preview.tsx@@ -0,0 +1,19 @@+import {whiteBalance} from '@remotion/effects/white-balance';+import React from 'react';+import {CanvasImage} from 'remotion';+import {EFFECTS_PREVIEW_IMAGE_SRC} from './effects-preview-image';++export const EffectsWhiteBalancePreview: React.FC<{+ readonly temperature: number;+ readonly tint: number;+}> = ({temperature, tint}) => {+ return (+ <CanvasImage+ src={EFFECTS_PREVIEW_IMAGE_SRC}+ width={1280}+ height={720}+ fit="cover"+ effects={[whiteBalance({temperature, tint})]}+ />+ );+};diff --git a/packages/docs/docs/effects/white-balance.mdx b/packages/docs/docs/effects/white-balance.mdxnew file mode 100644index 0000000000..70081111c6--- /dev/null+++ b/packages/docs/docs/effects/white-balance.mdx@@ -0,0 +1,65 @@+---+image: /generated/articles-docs-effects-white-balance.png+slug: /effects/white-balance+title: whiteBalance()+sidebar_label: whiteBalance()+crumb: '@remotion/effects'+---++# whiteBalance()<AvailableFrom v="4.0.508" />++_Part of the [`@remotion/effects`](/docs/effects/api) package._++Corrects blue-to-amber temperature and green-to-magenta tint in footage and images.++## Preview++<EffectsDemo type="effects-white-balance" />++## Example++```tsx twoslash title="MyComp.tsx"+import {Video} from '@remotion/media';+import {whiteBalance} from '@remotion/effects/white-balance';++export const MyComp: React.FC = () => {+ return (+ <Video+ src="https://remotion.media/video.mp4"+ effects={[+ whiteBalance({+ temperature: 0.2,+ tint: -0.1,+ }),+ ]}+ />+ );+};+```++## API++You can call `whiteBalance()` without arguments or pass an object with the following properties.++### `temperature?`++The temperature adjustment from `-1` to `1`. Negative values make the layer cooler and positive values make it warmer. Defaults to `0`.++### `tint?`++The tint adjustment from `-1` to `1`. Negative values shift the layer toward green and positive values shift it toward magenta. Defaults to `0`.++### `disabled?`++When `true`, the effect is skipped. Defaults to `false`.++## Compatibility++<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering serverSideRendering player studio hideServers />++## See also++- [`@remotion/effects`](/docs/effects/api)+- [`exposure()`](/docs/effects/exposure)+- [`saturation()`](/docs/effects/saturation)+- [Source code for this effect](https://github.com/remotion-dev/remotion/blob/main/packages/effects/src/white-balance.ts)diff --git a/packages/docs/sidebars.ts b/packages/docs/sidebars.tsindex a6a84a9ceb..40a93406f7 100644--- a/packages/docs/sidebars.ts+++ b/packages/docs/sidebars.ts@@ -334,6 +334,7 @@ const sidebars: SidebarsConfig = {'effects/vignette','effects/wave','effects/waves',+ 'effects/white-balance','effects/white-noise','effects/xy-translate','effects/zigzag',diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.tsindex bdf292b434..df31351653 100644--- a/packages/docs/src/data/articles.ts+++ b/packages/docs/src/data/articles.ts@@ -2366,6 +2366,15 @@ export const articles = [noAi: false,slug: 'effects/waves',},+ {+ id: 'effects/white-balance',+ title: 'whiteBalance()',+ relativePath: 'docs/effects/white-balance.mdx',+ compId: 'articles-docs-effects-white-balance',+ crumb: '@remotion/effects',+ noAi: false,+ slug: 'effects/white-balance',+ },{id: 'effects/white-noise',title: 'whiteNoise()',diff --git a/packages/docs/src/remotion/Root.tsx b/packages/docs/src/remotion/Root.tsxindex 86f3aed787..37274122b8 100644--- a/packages/docs/src/remotion/Root.tsx+++ b/packages/docs/src/remotion/Root.tsx@@ -96,6 +96,7 @@ import {EffectsVenetianBlindsPreview} from '../../components/effects/effects-venimport {EffectsVignettePreview} from '../../components/effects/effects-vignette-preview';import {EffectsWavePreview} from '../../components/effects/effects-wave-preview';import {EffectsWavesPreview} from '../../components/effects/effects-waves-preview';+import {EffectsWhiteBalancePreview} from '../../components/effects/effects-white-balance-preview';import {EffectsWhiteNoisePreview} from '../../components/effects/effects-white-noise-preview';import {EffectsZigzagPreview} from '../../components/effects/effects-zigzag-preview';import {EffectsZoomBlurPreview} from '../../components/effects/effects-zoom-blur-preview';@@ -289,6 +290,13 @@ export const RemotionRoot: React.FC = () => {height={720}defaultProps={{stops: 1}}/>+ <Still+ id="effects-white-balance-preview"+ component={EffectsWhiteBalancePreview}+ width={1280}+ height={720}+ defaultProps={{temperature: 0.8, tint: 0.2}}+ /><Stillid="effects-venetian-blinds-preview"component={EffectsVenetianBlindsPreview}diff --git a/packages/docs/static/generated/articles-docs-effects-white-balance.png b/packages/docs/static/generated/articles-docs-effects-white-balance.pngnew file mode 100644index 0000000000..ca281c40d9Binary files /dev/null and b/packages/docs/static/generated/articles-docs-effects-white-balance.png differdiff --git a/packages/docs/static/img/effects-white-balance-preview.png b/packages/docs/static/img/effects-white-balance-preview.pngnew file mode 100644index 0000000000..f0749d743fBinary files /dev/null and b/packages/docs/static/img/effects-white-balance-preview.png differdiff --git a/packages/effects/bundle.ts b/packages/effects/bundle.tsindex 5cb6cac423..1c825569da 100644--- a/packages/effects/bundle.ts+++ b/packages/effects/bundle.ts@@ -69,6 +69,7 @@ const effectEntrypoints = ['src/wave.ts','src/waves.ts','src/zigzag.ts',+ 'src/white-balance.ts','src/white-noise.ts','src/zoom-blur.ts',];diff --git a/packages/effects/package.json b/packages/effects/package.jsonindex 018ef8c0fd..2697676127 100644--- a/packages/effects/package.json+++ b/packages/effects/package.json@@ -339,6 +339,11 @@"module": "./dist/esm/waves.mjs","import": "./dist/esm/waves.mjs"},+ "./white-balance": {+ "types": "./dist/white-balance.d.ts",+ "module": "./dist/esm/white-balance.mjs",+ "import": "./dist/esm/white-balance.mjs"+ },"./white-noise": {"types": "./dist/white-noise.d.ts","module": "./dist/esm/white-noise.mjs",@@ -544,6 +549,9 @@"zigzag": ["dist/zigzag.d.ts"],+ "white-balance": [+ "dist/white-balance.d.ts"+ ],"white-noise": ["dist/white-noise.d.ts"],diff --git a/packages/effects/src/test/effect-params.test.ts b/packages/effects/src/test/effect-params.test.tsindex a9918a6e87..3039f50988 100644--- a/packages/effects/src/test/effect-params.test.ts+++ b/packages/effects/src/test/effect-params.test.ts@@ -68,6 +68,7 @@ import {venetianBlinds} from '../venetian-blinds.js';import {vignette} from '../vignette.js';import {wave} from '../wave/index.js';import {waves} from '../waves.js';+import {whiteBalance} from '../white-balance.js';import {whiteNoise} from '../white-noise.js';import {zigzag} from '../zigzag.js';import {zoomBlur} from '../zoom-blur/index.js';@@ -286,6 +287,9 @@ test('@remotion/effects expose documentation links', () => {expect(whiteNoise().definition.documentationLink).toBe('https://www.remotion.dev/docs/effects/white-noise',);+ expect(whiteBalance().definition.documentationLink).toBe(+ 'https://www.remotion.dev/docs/effects/white-balance',+ );expect(zoomBlur().definition.documentationLink).toBe('https://www.remotion.dev/docs/effects/zoom-blur',);@@ -363,6 +367,7 @@ test('@remotion/effects expose API names as Studio labels', () => {expect(wave().definition.label).toBe('wave()');expect(waves().definition.label).toBe('waves()');expect(zigzag().definition.label).toBe('zigzag()');+ expect(whiteBalance().definition.label).toBe('whiteBalance()');expect(whiteNoise().definition.label).toBe('whiteNoise()');expect(zoomBlur().definition.label).toBe('zoomBlur()');});@@ -976,6 +981,39 @@ test('exposure() stops produce distinct effect keys', () => {).toBe(3);});+test('whiteBalance() accepts default params', () => {+ expect(() => whiteBalance()).not.toThrow();+});++test('whiteBalance() rejects non-finite parameters', () => {+ expect(() => whiteBalance({temperature: Number.NaN})).toThrow(+ '"temperature" must be a finite number',+ );+ expect(() => whiteBalance({tint: Number.POSITIVE_INFINITY})).toThrow(+ '"tint" must be a finite number',+ );+});++test('whiteBalance() rejects parameters outside the signed unit interval', () => {+ expect(() => whiteBalance({temperature: -1.1})).toThrow(+ '"temperature" must be >= -1',+ );+ expect(() => whiteBalance({temperature: 1.1})).toThrow(+ '"temperature" must be <= 1',+ );+ expect(() => whiteBalance({tint: -1.1})).toThrow('"tint" must be >= -1');+ expect(() => whiteBalance({tint: 1.1})).toThrow('"tint" must be <= 1');+});++test('whiteBalance() parameters produce distinct effect keys', () => {+ const neutral = whiteBalance();+ const warmer = whiteBalance({temperature: 0.5});+ const moreMagenta = whiteBalance({tint: 0.5});+ expect(+ new Set([neutral.effectKey, warmer.effectKey, moreMagenta.effectKey]).size,+ ).toBe(3);+});+test('contrast() accepts default params', () => {expect(() => contrast()).not.toThrow();});diff --git a/packages/effects/src/visual-test/effects-visual.test.ts b/packages/effects/src/visual-test/effects-visual.test.tsindex aee14c6cef..057409691c 100644--- a/packages/effects/src/visual-test/effects-visual.test.ts+++ b/packages/effects/src/visual-test/effects-visual.test.ts@@ -5,6 +5,7 @@ import {exposure} from '../exposure.js';import {noise} from '../noise.js';import {pixelDissolve} from '../pixel-dissolve.js';import {vignette} from '../vignette.js';+import {whiteBalance} from '../white-balance.js';import {descriptorsToMemoizedEffects,renderEffectChainToCanvas,@@ -74,6 +75,55 @@ test('exposure() applies stops in linear light and preserves alpha', async () =>expect(pixel[3]).toBe(128);});+test('whiteBalance() applies temperature and tint while preserving alpha', async () => {+ const source = document.createElement('canvas');+ source.width = 1;+ source.height = 1;+ const sourceContext = source.getContext('2d');+ if (!sourceContext) {+ throw new Error('Could not get source context');+ }++ sourceContext.putImageData(+ new ImageData(new Uint8ClampedArray([128, 128, 128, 128]), 1, 1),+ 0,+ 0,+ );++ const warmCanvas = await renderEffectChainToCanvas({+ source,+ width: 1,+ height: 1,+ effects: descriptorsToMemoizedEffects([whiteBalance({temperature: 1})]),+ });+ const warmContext = warmCanvas.getContext('2d');+ if (!warmContext) {+ throw new Error('Could not get warm output context');+ }++ const warmPixel = warmContext.getImageData(0, 0, 1, 1).data;+ expect(warmPixel[0]).toBeGreaterThan(warmPixel[1]);+ expect(warmPixel[1]).toBeGreaterThan(warmPixel[2]);+ expect(warmPixel[3]).toBe(128);++ const magentaCanvas = await renderEffectChainToCanvas({+ source,+ width: 1,+ height: 1,+ effects: descriptorsToMemoizedEffects([whiteBalance({tint: 1})]),+ });+ const magentaContext = magentaCanvas.getContext('2d');+ if (!magentaContext) {+ throw new Error('Could not get magenta output context');+ }++ const magentaPixel = magentaContext.getImageData(0, 0, 1, 1).data;+ expect(magentaPixel[0]).toBeGreaterThan(magentaPixel[1]);+ expect(magentaPixel[2]).toBeGreaterThan(magentaPixel[1]);+ expect(Math.abs(magentaPixel[0] - magentaPixel[2])).toBeLessThanOrEqual(1);+ expect(magentaPixel[3]).toBe(128);+});+test('vignette() color mode works on transparent sources', async () => {const width = 40;const height = 40;diff --git a/packages/effects/src/white-balance.ts b/packages/effects/src/white-balance.tsnew file mode 100644index 0000000000..86ed179a05--- /dev/null+++ b/packages/effects/src/white-balance.ts@@ -0,0 +1,299 @@+import type {InteractivitySchema} from 'remotion';+import {Internals} from 'remotion';+import {+ assertOptionalFiniteNumber,+ validateSignedUnitInterval,+} from './color-utils.js';+import {assertEffectParamsObject} from './validate-effect-param.js';++const {createEffect, createWebGL2ContextError} = Internals;++const DEFAULT_TEMPERATURE = 0 as const;+const DEFAULT_TINT = 0 as const;++const whiteBalanceSchema = {+ temperature: {+ type: 'number',+ min: -1,+ max: 1,+ step: 0.01,+ default: DEFAULT_TEMPERATURE,+ description: 'Temperature',+ hiddenFromList: false,+ },+ tint: {+ type: 'number',+ min: -1,+ max: 1,+ step: 0.01,+ default: DEFAULT_TINT,+ description: 'Tint',+ hiddenFromList: false,+ },+} as const satisfies InteractivitySchema;++export type WhiteBalanceParams = {+ /** Blue-to-amber temperature adjustment from `-1` to `1`. Defaults to `0`. */+ readonly temperature?: number;+ /** Green-to-magenta tint adjustment from `-1` to `1`. Defaults to `0`. */+ readonly tint?: number;+};++type WhiteBalanceResolved = {+ temperature: number;+ tint: number;+};++type WhiteBalanceState = {+ readonly gl: WebGL2RenderingContext;+ readonly program: WebGLProgram;+ readonly vao: WebGLVertexArrayObject;+ readonly vbo: WebGLBuffer;+ readonly textureSource: WebGLTexture;+ readonly uniforms: {+ readonly uSource: WebGLUniformLocation | null;+ readonly uTemperature: WebGLUniformLocation | null;+ readonly uTint: WebGLUniformLocation | null;+ };+};++const resolve = (params: WhiteBalanceParams): WhiteBalanceResolved => ({+ temperature: params.temperature ?? DEFAULT_TEMPERATURE,+ tint: params.tint ?? DEFAULT_TINT,+});++const validateWhiteBalanceParams = (params: WhiteBalanceParams): void => {+ assertEffectParamsObject(params, 'White balance');+ assertOptionalFiniteNumber(params.temperature, 'temperature');+ assertOptionalFiniteNumber(params.tint, 'tint');++ const {temperature, tint} = resolve(params);+ validateSignedUnitInterval(temperature, 'temperature');+ validateSignedUnitInterval(tint, 'tint');+};++const VERTEX_SHADER = /* glsl */ `#version 300 es+in vec2 aPos;+in vec2 aUv;+out vec2 vUv;++void main() {+ vUv = aUv;+ gl_Position = vec4(aPos, 0.0, 1.0);+}+`;++const FRAGMENT_SHADER = /* glsl */ `#version 300 es+precision highp float;++in vec2 vUv;+out vec4 fragColor;++uniform sampler2D uSource;+uniform float uTemperature;+uniform float uTint;++vec3 srgbToLinear(vec3 color) {+ vec3 lower = color / 12.92;+ vec3 upper = pow((color + 0.055) / 1.055, vec3(2.4));+ return mix(lower, upper, step(vec3(0.04045), color));+}++vec3 linearToSrgb(vec3 color) {+ vec3 nonNegative = max(color, vec3(0.0));+ vec3 lower = nonNegative * 12.92;+ vec3 upper = 1.055 * pow(nonNegative, vec3(1.0 / 2.4)) - 0.055;+ return mix(lower, upper, step(vec3(0.0031308), nonNegative));+}++void main() {+ vec4 sourceColor = texture(uSource, vUv);+ float alpha = sourceColor.a;++ if (alpha <= 0.0) {+ fragColor = vec4(0.0);+ return;+ }++ vec3 unpremultiplied = sourceColor.rgb / alpha;+ vec3 linear = srgbToLinear(unpremultiplied);+ vec3 temperatureOffset = vec3(0.3, 0.0, -0.3) * uTemperature;+ vec3 tintOffset = vec3(0.15, -0.3, 0.15) * uTint;+ vec3 gains = exp2(temperatureOffset + tintOffset);+ float luminanceGain = dot(gains, vec3(0.2126, 0.7152, 0.0722));+ vec3 balanced = linear * gains / luminanceGain;+ vec3 corrected = linearToSrgb(balanced);++ fragColor = vec4(corrected * alpha, alpha);+}+`;++const compileShader = (+ gl: WebGL2RenderingContext,+ type: number,+ source: string,+): WebGLShader => {+ const shader = gl.createShader(type);+ if (!shader) {+ throw new Error('Failed to create white balance shader');+ }++ gl.shaderSource(shader, source);+ gl.compileShader(shader);+ if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {+ const log = gl.getShaderInfoLog(shader);+ gl.deleteShader(shader);+ throw new Error(+ `White balance shader compile failed: ${log ?? '(no log)'}`,+ );+ }++ return shader;+};++const createProgram = (gl: WebGL2RenderingContext): WebGLProgram => {+ const vertexShader = compileShader(gl, gl.VERTEX_SHADER, VERTEX_SHADER);+ const fragmentShader = compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER);+ const program = gl.createProgram();+ if (!program) {+ throw new Error('Failed to create white balance shader program');+ }++ gl.attachShader(program, vertexShader);+ gl.attachShader(program, fragmentShader);+ gl.linkProgram(program);+ gl.deleteShader(vertexShader);+ gl.deleteShader(fragmentShader);++ if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {+ const log = gl.getProgramInfoLog(program);+ gl.deleteProgram(program);+ throw new Error(`White balance shader link failed: ${log ?? '(no log)'}`);+ }++ return program;+};++const createTexture = (gl: WebGL2RenderingContext): WebGLTexture => {+ const texture = gl.createTexture();+ if (!texture) {+ throw new Error('Failed to create white balance texture');+ }++ gl.bindTexture(gl.TEXTURE_2D, texture);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);+ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);+ gl.bindTexture(gl.TEXTURE_2D, null);+ return texture;+};++const setupWhiteBalance = (target: HTMLCanvasElement): WhiteBalanceState => {+ const gl = target.getContext('webgl2', {+ premultipliedAlpha: true,+ alpha: true,+ preserveDrawingBuffer: true,+ });+ if (!gl) {+ throw createWebGL2ContextError('white balance effect');+ }++ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true);++ const program = createProgram(gl);+ const vao = gl.createVertexArray();+ if (!vao) {+ throw new Error('Failed to create white balance vertex array');+ }++ const vbo = gl.createBuffer();+ if (!vbo) {+ throw new Error('Failed to create white balance vertex buffer');+ }++ gl.bindVertexArray(vao);+ gl.bindBuffer(gl.ARRAY_BUFFER, vbo);+ gl.bufferData(+ gl.ARRAY_BUFFER,+ new Float32Array([-1, -1, 0, 0, 1, -1, 1, 0, -1, 1, 0, 1, 1, 1, 1, 1]),+ gl.STATIC_DRAW,+ );++ const aPos = gl.getAttribLocation(program, 'aPos');+ const aUv = gl.getAttribLocation(program, 'aUv');+ gl.enableVertexAttribArray(aPos);+ gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 16, 0);+ gl.enableVertexAttribArray(aUv);+ gl.vertexAttribPointer(aUv, 2, gl.FLOAT, false, 16, 8);+ gl.bindVertexArray(null);++ return {+ gl,+ program,+ vao,+ vbo,+ textureSource: createTexture(gl),+ uniforms: {+ uSource: gl.getUniformLocation(program, 'uSource'),+ uTemperature: gl.getUniformLocation(program, 'uTemperature'),+ uTint: gl.getUniformLocation(program, 'uTint'),+ },+ };+};++export const whiteBalance = createEffect<WhiteBalanceParams, WhiteBalanceState>(+ {+ type: 'remotion/white-balance',+ label: 'whiteBalance()',+ documentationLink: 'https://www.remotion.dev/docs/effects/white-balance',+ backend: 'webgl2',+ calculateKey: (params) => {+ const {temperature, tint} = resolve(params);+ return `white-balance-${temperature}-${tint}`;+ },+ setup: setupWhiteBalance,+ apply: ({source, width, height, params, state, flipSourceY}) => {+ const {temperature, tint} = resolve(params);+ const {gl, program, textureSource, uniforms, vao} = state;++ gl.viewport(0, 0, width, height);+ gl.bindFramebuffer(gl.FRAMEBUFFER, null);+ gl.clearColor(0, 0, 0, 0);+ gl.clear(gl.COLOR_BUFFER_BIT);++ gl.activeTexture(gl.TEXTURE0);+ gl.bindTexture(gl.TEXTURE_2D, textureSource);+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipSourceY);+ gl.texImage2D(+ gl.TEXTURE_2D,+ 0,+ gl.RGBA,+ gl.RGBA,+ gl.UNSIGNED_BYTE,+ source as TexImageSource,+ );++ gl.useProgram(program);+ if (uniforms.uSource) gl.uniform1i(uniforms.uSource, 0);+ if (uniforms.uTemperature) {+ gl.uniform1f(uniforms.uTemperature, temperature);+ }++ if (uniforms.uTint) gl.uniform1f(uniforms.uTint, tint);+ gl.bindVertexArray(vao);+ gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);+ gl.bindVertexArray(null);+ gl.bindTexture(gl.TEXTURE_2D, null);+ gl.useProgram(null);+ },+ cleanup: ({gl, program, vao, vbo, textureSource}) => {+ gl.deleteTexture(textureSource);+ gl.deleteBuffer(vbo);+ gl.deleteProgram(program);+ gl.deleteVertexArray(vao);+ },+ schema: whiteBalanceSchema,+ validateParams: validateWhiteBalanceParams,+ },+);diff --git a/packages/studio-shared/src/effect-catalog.ts b/packages/studio-shared/src/effect-catalog.tsindex 7fd3a1e826..2db3102852 100644--- a/packages/studio-shared/src/effect-catalog.ts+++ b/packages/studio-shared/src/effect-catalog.ts@@ -175,6 +175,17 @@ export const EFFECT_CATALOG: readonly EffectCatalogItem[] = [},},},+ {+ id: 'effects-white-balance',+ category: 'Color',+ label: 'whiteBalance()',+ description: 'Temperature and tint correction',+ effect: {+ name: 'whiteBalance',+ importPath: '@remotion/effects/white-balance',+ config: {},+ },+ },{id: 'effects-linear-gradient',category: 'Color',