@@ -184,13 +184,13 @@ export class NgtsContactShadows {
184
184
blurPlane . visible = true ;
185
185
blurPlane . material = horizontalBlurMaterial ;
186
186
horizontalBlurMaterial . uniforms [ 'tDiffuse' ] . value = renderTarget . texture ;
187
- horizontalBlurMaterial . uniforms [ 'h' ] . value = ( blur * 1 ) / 256 ;
187
+ horizontalBlurMaterial . uniforms [ 'h' ] . value = blur / 256 ;
188
188
this . gl ( ) . setRenderTarget ( renderTargetBlur ) ;
189
189
this . gl ( ) . render ( blurPlane , shadowsCamera ) ;
190
190
191
191
blurPlane . material = verticalBlurMaterial ;
192
192
verticalBlurMaterial . uniforms [ 'tDiffuse' ] . value = renderTargetBlur . texture ;
193
- verticalBlurMaterial . uniforms [ 'v' ] . value = ( blur * 1 ) / 256 ;
193
+ verticalBlurMaterial . uniforms [ 'v' ] . value = blur / 256 ;
194
194
this . gl ( ) . setRenderTarget ( renderTarget ) ;
195
195
this . gl ( ) . render ( blurPlane , shadowsCamera ) ;
196
196
blurPlane . visible = false ;
@@ -205,26 +205,27 @@ export class NgtsContactShadows {
205
205
206
206
injectBeforeRender ( ( ) => {
207
207
const shadowsCamera = this . shadowsCameraRef ( ) ?. nativeElement ;
208
+ if ( ! shadowsCamera ) return ;
208
209
const [ { frames, blur, smooth } , gl , scene , contactShadows , { depthMaterial, renderTarget } ] = [
209
210
this . options ( ) ,
210
211
this . gl ( ) ,
211
212
this . scene ( ) ,
212
- this . contactShadowsRef ( ) ,
213
+ this . contactShadowsRef ( ) . nativeElement ,
213
214
this . shadowsOptions ( ) ,
214
215
] ;
215
- if ( shadowsCamera && ( frames === Infinity || count < frames ) ) {
216
+ if ( frames === Infinity || count < frames * frames ) {
216
217
count ++ ;
217
218
initialBackground = scene . background ;
218
219
initialOverrideMaterial = scene . overrideMaterial ;
219
- contactShadows . nativeElement . visible = false ;
220
+ contactShadows . visible = false ;
220
221
scene . background = null ;
221
222
scene . overrideMaterial = depthMaterial ;
222
223
gl . setRenderTarget ( renderTarget ) ;
223
224
gl . render ( scene , shadowsCamera ) ;
224
225
this . blurShadows ( blur ) ;
225
226
if ( smooth ) this . blurShadows ( blur * 0.4 ) ;
226
227
gl . setRenderTarget ( null ) ;
227
- contactShadows . nativeElement . visible = true ;
228
+ contactShadows . visible = true ;
228
229
scene . overrideMaterial = initialOverrideMaterial ;
229
230
scene . background = initialBackground ;
230
231
}
0 commit comments