UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

3 lines (2 loc) 1.8 kB
declare const _default: "\n var sourceTexture: texture_2d<f32>;\n var sourceTextureSampler: sampler;\n uniform sourceInvResolution: vec2f;\n varying uv0: vec2f;\n\n @fragment\n fn fragmentMain(input: FragmentInput) -> FragmentOutput {\n var output: FragmentOutput;\n\n let x: f32 = uniform.sourceInvResolution.x;\n let y: f32 = uniform.sourceInvResolution.y;\n\n let a: half3 = half3(textureSample(sourceTexture, sourceTextureSampler, vec2f(input.uv0.x - x, input.uv0.y + y)).rgb);\n let b: half3 = half3(textureSample(sourceTexture, sourceTextureSampler, vec2f(input.uv0.x, input.uv0.y + y)).rgb);\n let c: half3 = half3(textureSample(sourceTexture, sourceTextureSampler, vec2f(input.uv0.x + x, input.uv0.y + y)).rgb);\n\n let d: half3 = half3(textureSample(sourceTexture, sourceTextureSampler, vec2f(input.uv0.x - x, input.uv0.y)).rgb);\n let e: half3 = half3(textureSample(sourceTexture, sourceTextureSampler, vec2f(input.uv0.x, input.uv0.y)).rgb);\n let f: half3 = half3(textureSample(sourceTexture, sourceTextureSampler, vec2f(input.uv0.x + x, input.uv0.y)).rgb);\n\n let g: half3 = half3(textureSample(sourceTexture, sourceTextureSampler, vec2f(input.uv0.x - x, input.uv0.y - y)).rgb);\n let h: half3 = half3(textureSample(sourceTexture, sourceTextureSampler, vec2f(input.uv0.x, input.uv0.y - y)).rgb);\n let i: half3 = half3(textureSample(sourceTexture, sourceTextureSampler, vec2f(input.uv0.x + x, input.uv0.y - y)).rgb);\n\n var value: half3 = e * half(0.25);\n value += (b + d + f + h) * half(0.125);\n value += (a + c + g + i) * half(0.0625);\n\n output.color = vec4f(vec3f(value), 1.0);\n return output;\n }\n"; export default _default;