Skip to content

Commit

Permalink
kernel radius must be integer
Browse files Browse the repository at this point in the history
toloudis committed Nov 8, 2023
1 parent 528fbc1 commit 2632d8e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/visGeometry/rendering/GaussianBlur.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ class BlurPass1D {

public constructor(uvOffset: Vector2, radius: number, stdDev: number) {
this.uvOffset = uvOffset;
this.radius = 0;
this.radius = 8;
this.stdDev = 0;
this.pass = new RenderToBuffer({
defines: {
@@ -117,13 +117,14 @@ class BlurPass1D {

public configure(kernelRadius: number, stdDev: number): void {
if (kernelRadius !== this.radius || stdDev !== this.stdDev) {
this.pass.material.defines["KERNEL_RADIUS"] = kernelRadius;
const kr = Math.ceil(kernelRadius);
this.pass.material.defines["KERNEL_RADIUS"] = kr;
this.pass.material.uniforms["sampleUvOffsets"].value =
this.createSampleOffsets(kernelRadius, this.uvOffset);
this.createSampleOffsets(kr, this.uvOffset);
this.pass.material.uniforms["sampleWeights"].value =
this.createSampleWeights(kernelRadius, stdDev);
this.createSampleWeights(kr, stdDev);
this.pass.material.needsUpdate = true;
this.radius = kernelRadius;
this.radius = kr;
this.stdDev = stdDev;
}
}

0 comments on commit 2632d8e

Please sign in to comment.