- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to GLSL3 and make use of custom shader chunks
Showing
28 changed files
with
349 additions
and
602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,25 @@ | ||
#ifdef FRAMEBUFFER_PRECISION_HIGH | ||
|
||
uniform mediump sampler2D inputBuffer; | ||
|
||
#else | ||
|
||
uniform lowp sampler2D inputBuffer; | ||
|
||
#endif | ||
#include <pp_precision_fragment> | ||
#include <pp_default_output_pars_fragment> | ||
#include <pp_input_buffer_pars_fragment> | ||
|
||
uniform vec2 kernel[STEPS]; | ||
|
||
varying vec2 vOffset; | ||
varying vec2 vUv; | ||
in vec2 vOffset; | ||
in vec2 vUv; | ||
|
||
void main() { | ||
|
||
vec4 result = texture2D(inputBuffer, vUv) * kernel[0].y; | ||
vec4 result = texture(inputBuffer, vUv) * kernel[0].y; | ||
|
||
for(int i = 1; i < STEPS; ++i) { | ||
|
||
vec2 offset = kernel[i].x * vOffset; | ||
vec4 c0 = texture2D(inputBuffer, vUv + offset); | ||
vec4 c1 = texture2D(inputBuffer, vUv - offset); | ||
vec4 c0 = texture(inputBuffer, vUv + offset); | ||
vec4 c1 = texture(inputBuffer, vUv - offset); | ||
result += (c0 + c1) * kernel[i].y; | ||
|
||
} | ||
|
||
gl_FragColor = result; | ||
outputColor = result; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,15 @@ | ||
#ifdef FRAMEBUFFER_PRECISION_HIGH | ||
#include <pp_precision_fragment> | ||
#include <pp_default_output_pars_fragment> | ||
#include <pp_input_buffer_pars_fragment> | ||
|
||
uniform mediump sampler2D inputBuffer; | ||
|
||
#else | ||
|
||
uniform lowp sampler2D inputBuffer; | ||
|
||
#endif | ||
|
||
varying vec2 vUv0; | ||
varying vec2 vUv1; | ||
varying vec2 vUv2; | ||
varying vec2 vUv3; | ||
in vec2 vUv0, vUv1, vUv2, vUv3; | ||
|
||
void main() { | ||
|
||
vec4 sum = texture2D(inputBuffer, vUv0); // Top left | ||
sum += texture2D(inputBuffer, vUv1); // Top right | ||
sum += texture2D(inputBuffer, vUv2); // Bottom right | ||
sum += texture2D(inputBuffer, vUv3); // Bottom left | ||
gl_FragColor = sum * 0.25; // Compute the average | ||
vec4 sum = texture(inputBuffer, vUv0); // Top left | ||
sum += texture(inputBuffer, vUv1); // Top right | ||
sum += texture(inputBuffer, vUv2); // Bottom right | ||
sum += texture(inputBuffer, vUv3); // Bottom left | ||
outputColor = sum * 0.25; // Compute the average | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,26 @@ | ||
#ifdef FRAMEBUFFER_PRECISION_HIGH | ||
|
||
uniform mediump sampler2D inputBuffer; | ||
|
||
#else | ||
|
||
uniform lowp sampler2D inputBuffer; | ||
|
||
#endif | ||
#include <pp_precision_fragment> | ||
#include <pp_default_output_pars_fragment> | ||
#include <pp_input_buffer_pars_fragment> | ||
|
||
uniform vec4 maskParams; | ||
|
||
varying vec2 vUv; | ||
varying vec2 vUv2; | ||
varying vec2 vOffset; | ||
in vec2 vUv; | ||
in vec2 vUv2; | ||
in vec2 vOffset; | ||
|
||
float linearGradientMask(const in float x) { | ||
|
||
return smoothstep(maskParams.x, maskParams.y, x) - | ||
smoothstep(maskParams.w, maskParams.z, x); | ||
return smoothstep(maskParams.x, maskParams.y, x) - smoothstep(maskParams.w, maskParams.z, x); | ||
|
||
} | ||
|
||
void main() { | ||
|
||
vec2 dUv = vOffset * (1.0 - linearGradientMask(vUv2.y)); | ||
vec4 sum = texture2D(inputBuffer, vec2(vUv.x - dUv.x, vUv.y + dUv.y)); // Top left | ||
sum += texture2D(inputBuffer, vec2(vUv.x + dUv.x, vUv.y + dUv.y)); // Top right | ||
sum += texture2D(inputBuffer, vec2(vUv.x + dUv.x, vUv.y - dUv.y)); // Bottom right | ||
sum += texture2D(inputBuffer, vec2(vUv.x - dUv.x, vUv.y - dUv.y)); // Bottom left | ||
gl_FragColor = sum * 0.25; // Compute the average | ||
vec4 sum = texture(inputBuffer, vec2(vUv.x - dUv.x, vUv.y + dUv.y)); // Top left | ||
sum += texture(inputBuffer, vec2(vUv.x + dUv.x, vUv.y + dUv.y)); // Top right | ||
sum += texture(inputBuffer, vec2(vUv.x + dUv.x, vUv.y - dUv.y)); // Bottom right | ||
sum += texture(inputBuffer, vec2(vUv.x - dUv.x, vUv.y - dUv.y)); // Bottom left | ||
outputColor = sum * 0.25; // Compute the average | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,37 @@ | ||
#include <pp_precision_fragment> | ||
#include <pp_default_output_pars_fragment> | ||
#include <pp_input_buffer_pars_fragment> | ||
|
||
#ifdef FRAMEBUFFER_PRECISION_HIGH | ||
|
||
uniform mediump sampler2D inputBuffer; | ||
uniform mediump sampler2D supportBuffer; | ||
|
||
#else | ||
|
||
uniform lowp sampler2D inputBuffer; | ||
uniform lowp sampler2D supportBuffer; | ||
|
||
#endif | ||
|
||
uniform float radius; | ||
|
||
varying vec2 vUv; | ||
varying vec2 vUv0; | ||
varying vec2 vUv1; | ||
varying vec2 vUv2; | ||
varying vec2 vUv3; | ||
varying vec2 vUv4; | ||
varying vec2 vUv5; | ||
varying vec2 vUv6; | ||
varying vec2 vUv7; | ||
in vec2 vUv; | ||
in vec2 vUv0, vUv1, vUv2, vUv3; | ||
in vec2 vUv4, vUv5, vUv6, vUv7; | ||
|
||
void main() { | ||
|
||
vec4 c = vec4(0.0); | ||
c += texture2D(inputBuffer, vUv0) * 0.0625; | ||
c += texture2D(inputBuffer, vUv1) * 0.125; | ||
c += texture2D(inputBuffer, vUv2) * 0.0625; | ||
c += texture2D(inputBuffer, vUv3) * 0.125; | ||
c += texture2D(inputBuffer, vUv) * 0.25; | ||
c += texture2D(inputBuffer, vUv4) * 0.125; | ||
c += texture2D(inputBuffer, vUv5) * 0.0625; | ||
c += texture2D(inputBuffer, vUv6) * 0.125; | ||
c += texture2D(inputBuffer, vUv7) * 0.0625; | ||
|
||
vec4 baseColor = texture2D(supportBuffer, vUv); | ||
gl_FragColor = mix(baseColor, c, radius); | ||
c += texture(inputBuffer, vUv0) * 0.0625; | ||
c += texture(inputBuffer, vUv1) * 0.125; | ||
c += texture(inputBuffer, vUv2) * 0.0625; | ||
c += texture(inputBuffer, vUv3) * 0.125; | ||
c += texture(inputBuffer, vUv) * 0.25; | ||
c += texture(inputBuffer, vUv4) * 0.125; | ||
c += texture(inputBuffer, vUv5) * 0.0625; | ||
c += texture(inputBuffer, vUv6) * 0.125; | ||
c += texture(inputBuffer, vUv7) * 0.0625; | ||
|
||
vec4 baseColor = texture(supportBuffer, vUv); | ||
outputColor = mix(baseColor, c, radius); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,19 @@ | ||
#include <pp_precision_fragment> | ||
#include <pp_gbuffer_output_pars_fragment> | ||
#include <pp_colorspace_pars_fragment> | ||
#include <pp_default_output_pars_fragment> | ||
#include <pp_input_buffer_pars_fragment> | ||
|
||
#include <common> | ||
#include <colorspace_pars_fragment> | ||
#include <dithering_pars_fragment> | ||
|
||
#ifdef FRAMEBUFFER_PRECISION_HIGH | ||
|
||
uniform mediump sampler2D inputBuffer; | ||
|
||
#else | ||
|
||
uniform lowp sampler2D inputBuffer; | ||
|
||
#endif | ||
|
||
in vec2 vUv; | ||
|
||
void main() { | ||
|
||
#ifdef GBUFFER_COLOR | ||
|
||
outputColor = texture(inputBuffer, vUv); | ||
|
||
#include <colorspace_fragment> | ||
#include <dithering_fragment> | ||
outputColor = texture(inputBuffer, vUv); | ||
|
||
#endif | ||
#include <colorspace_fragment> | ||
#include <dithering_fragment> | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
varying vec2 vUv; | ||
out vec2 vUv; | ||
|
||
#if DEPTH_COPY_MODE == 1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters