Skip to content

Commit d701464

Browse files
committed
Minor refactoring
1 parent 177c468 commit d701464

3 files changed

Lines changed: 7 additions & 18 deletions

File tree

manual/assets/js/src/demos/blur.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ window.addEventListener("load", () => load().then((assets) => {
102102
multisampling: Math.min(4, renderer.capabilities.maxSamples)
103103
});
104104

105-
const gaussianBlurPass = new GaussianBlurPass({ resolutionScale: 0.75, kernelSize: 35 });
106-
const kawaseBlurPass = new KawaseBlurPass({ resolutionScale: 0.75, kernelSize: KernelSize.MEDIUM });
105+
const gaussianBlurPass = new GaussianBlurPass({ resolutionScale: 0.5, kernelSize: 35 });
106+
const kawaseBlurPass = new KawaseBlurPass({ resolutionScale: 0.5, kernelSize: KernelSize.MEDIUM });
107107

108108
gaussianBlurPass.renderToScreen = true;
109109
kawaseBlurPass.renderToScreen = true;

src/materials/glsl/convolution.kawase.frag

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,11 @@ varying vec2 vUv3;
1515

1616
void main() {
1717

18-
// Sample top left texel.
19-
vec4 sum = texture2D(inputBuffer, vUv0);
20-
21-
// Sample top right texel.
22-
sum += texture2D(inputBuffer, vUv1);
23-
24-
// Sample bottom right texel.
25-
sum += texture2D(inputBuffer, vUv2);
26-
27-
// Sample bottom left texel.
28-
sum += texture2D(inputBuffer, vUv3);
29-
30-
// Compute the average.
31-
gl_FragColor = sum * 0.25;
18+
vec4 sum = texture2D(inputBuffer, vUv0); // Top left
19+
sum += texture2D(inputBuffer, vUv1); // Top right
20+
sum += texture2D(inputBuffer, vUv2); // Bottom right
21+
sum += texture2D(inputBuffer, vUv3); // Bottom left
22+
gl_FragColor = sum * 0.25; // Compute the average
3223

3324
#include <encodings_fragment>
3425

src/materials/glsl/convolution.kawase.vert

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ uniform vec4 texelSize; // XY = texel size, ZW = half texel size
22
uniform float kernel;
33
uniform vec2 scale; // X = resolution, Y = kernel
44

5-
/* Packing multiple texture coordinates into one varying vec4 and using a swizzle to extract them in the fragment shader
6-
still causes a dependent texture read. */
75
varying vec2 vUv0;
86
varying vec2 vUv1;
97
varying vec2 vUv2;

0 commit comments

Comments
 (0)