Skip to content

Instantly share code, notes, and snippets.

View phobon's full-sized avatar
🙃

Ben McCormick phobon

🙃
View GitHub Profile
@phobon
phobon / fragment.glsl
Created April 8, 2024 03:39
Pixellation / UV remapping grid trail
uniform vec2 u_resolution;
uniform float u_time;
uniform sampler2D u_diffuse;
uniform sampler2D u_dataTexture;
uniform float u_amplitude;
varying vec2 v_uv;
vec3 correctGamma(vec3 color) {
vec3 palette(float t) {
vec3 a = vec3(0.5, 0.5, 0.5);
vec3 b = vec3(0.5, 0.5, 0.5);
vec3 c = vec3(1.0, 1.0, 0.5);
vec3 d = vec3(0.80, 0.90, 0.30);
return a + b * cos(6.28318 * (c * t + d));
}
vec3 col = palette(uv.y + 0.5);
import { Fn, float } from 'three/tsl'
/**
* Applies Reinhard tonemapping to a color vector.
* @param {vec3} _color Input color vector
* @returns {vec3} Tonemapped color
*/
export const reinhardTonemap = Fn(([_color]) => {
return _color.div(_color.add(1.0))
})