File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -160,15 +160,21 @@ export class GaussianBlurPass extends Pass<GaussianBlurMaterial> {
160
160
161
161
protected override onResolutionChange ( ) : void {
162
162
163
- const resolution = this . resolution ;
164
- const width = resolution . width ;
165
- const height = resolution . height ;
163
+ const inputBuffer = this . input . defaultBuffer ?. value ?? null ;
164
+
165
+ if ( inputBuffer === null ) {
166
+
167
+ return ;
166
168
167
- this . renderTargetA . setSize ( width , height ) ;
168
- this . renderTargetB . setSize ( width , height ) ;
169
+ }
170
+
171
+ const resolution = this . resolution ;
172
+ this . renderTargetA . setSize ( resolution . width , resolution . height ) ;
173
+ this . renderTargetB . setSize ( resolution . width , resolution . height ) ;
169
174
170
- // Optimization: 1 / (TexelSize * ResolutionScale) = FullResolution
171
- this . blurMaterial . setSize ( resolution . baseWidth , resolution . baseHeight ) ;
175
+ // Use the size of the input texture to calculate the texel size for sampling.
176
+ const imgData = inputBuffer . source . data as ImageData ;
177
+ this . blurMaterial . setSize ( imgData . width , imgData . height ) ;
172
178
173
179
}
174
180
You can’t perform that action at this time.
0 commit comments