linearToSrgb

linear RGB color values to sRGB color space.

110 total functionsUpdated: Invalid Date

linearToSrgb

linear RGB color values to sRGB color space.

Parameters

NameTypeDescription
colorvec3<f32>Linear RGB color values.

Returns

vec3<f32>color values.

WGSL Code

fn linearToSrgb(color: vec3<f32>) -> vec3<f32> {
return pow(color, vec3(1.0 / 2.2));
}

About wgsl-fns

A JavaScript library providing WGSL utility functions as strings for WebGPU shader development. Includes mathematical utilities, noise generation, signed distance fields, and color manipulation functions.

Install:npm install wgsl-fns
Import:import { linearToSrgb, getFns } from 'wgsl-fns'
Usage:getFns(['linearToSrgb'])