phaser/src/renderer/webgl/shaders/FXBloom-frag.js

18 lines
775 B
JavaScript
Raw Normal View History

2023-02-09 18:46:49 +00:00
module.exports = [
'#define SHADER_NAME BLOOM_FS',
'precision mediump float;',
'uniform sampler2D uMainSampler;',
2023-02-15 00:50:26 +00:00
'uniform vec2 offset;',
'uniform float strength;',
'uniform vec3 color;',
2023-02-09 18:46:49 +00:00
'varying vec2 outTexCoord;',
'void main ()',
'{',
2023-02-15 00:50:26 +00:00
' vec4 sum = texture2D(uMainSampler, outTexCoord) * 0.204164 * strength;',
' sum = sum + texture2D(uMainSampler, outTexCoord + offset * 1.407333) * 0.304005;',
' sum = sum + texture2D(uMainSampler, outTexCoord - offset * 1.407333) * 0.304005;',
' sum = sum + texture2D(uMainSampler, outTexCoord + offset * 3.294215) * 0.093913;',
' gl_FragColor = (sum + texture2D(uMainSampler, outTexCoord - offset * 3.294215) * 0.093913) * vec4(color, 1);',
2023-02-09 18:46:49 +00:00
'}',
].join('\n');