playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
23 lines (20 loc) • 684 B
JavaScript
var compose_fringing_default = (
/* wgsl */
`
uniform fringingIntensity: f32;
fn applyFringing(color: vec3f, uv: vec2f) -> vec3f {
// offset depends on the direction from the center
let centerDistance = uv - 0.5;
let offset = uniform.fringingIntensity * centerDistance * centerDistance;
var colorOut = color;
colorOut.r = textureSample(sceneTexture, sceneTextureSampler, uv - offset).r;
colorOut.b = textureSample(sceneTexture, sceneTextureSampler, uv + offset).b;
return colorOut;
}
`
);
export {
compose_fringing_default as default
};