Skip to content

Instantly share code, notes, and snippets.

@milcktoast
Last active September 9, 2019 17:59
Show Gist options
  • Save milcktoast/6eef45a288e2348e850474a172cc992f to your computer and use it in GitHub Desktop.
Save milcktoast/6eef45a288e2348e850474a172cc992f to your computer and use it in GitHub Desktop.
#define LUT_FLIP_Y
#pragma glslify: applyTransform = require('glsl-lut')
uniform sampler2D colorTransformLookup;
void mainImage(const in vec4 inputColor, const in vec2 uv, out vec4 outputColor) {
outputColor = applyTransform(inputColor, colorTransformLookup);
}
import {
NearestFilter,
RGBAFormat,
Uniform
} from 'three'
import {
BlendFunction,
Effect
} from 'postprocessing'
import fragment from 'color_transform.frag'
export class ColorTransformEffect extends Effect {
constructor ({ lutTexture }) {
super('ColorTransformEffect', fragment, {
blendFunction: BlendFunction.NORMAL,
uniforms: new Map([
['colorTransformLookup', new Uniform(lutTexture)]
])
})
lutTexture.magFilter = NearestFilter
lutTexture.minFilter = NearestFilter
lutTexture.format = RGBAFormat
lutTexture.generateMipmaps = false
lutTexture.needsUpdate = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment