@@ -21,6 +21,7 @@ import {
2121 HalfFloatType ,
2222 LinearMipmapLinearFilter ,
2323 WebGLRenderer ,
24+ PerspectiveCamera ,
2425} from "three" ;
2526import { RGBELoader } from "three/examples/jsm/loaders/RGBELoader.js" ;
2627import { Sky } from "three/examples/jsm/objects/Sky.js" ;
@@ -94,6 +95,7 @@ export class Composer {
9495 public readonly renderer : WebGLRenderer ;
9596
9697 private postProcessingManager : PostProcessingManager ;
98+ private currentCamera : PerspectiveCamera ; // Track current camera
9799
98100 private ambientLight : AmbientLight | null = null ;
99101 private environmentConfiguration ?: EnvironmentConfiguration ;
@@ -136,10 +138,11 @@ export class Composer {
136138
137139 this . environmentConfiguration = environmentConfiguration ;
138140
141+ this . currentCamera = this . cameraManager . activeCamera ;
139142 this . postProcessingManager = new PostProcessingManager (
140143 this . renderer ,
141144 this . scene ,
142- this . cameraManager . activeCamera ,
145+ this . currentCamera ,
143146 this . width ,
144147 this . height ,
145148 {
@@ -284,6 +287,13 @@ export class Composer {
284287 if ( ! this . renderer || ! this . scene || ! this . cameraManager . activeCamera ) {
285288 return ;
286289 }
290+
291+ // check if camera has changed and update PostProcessingManager
292+ if ( this . currentCamera !== this . cameraManager . activeCamera ) {
293+ this . currentCamera = this . cameraManager . activeCamera ;
294+ this . postProcessingManager . updateCamera ( this . currentCamera ) ;
295+ }
296+
287297 this . renderer . info . reset ( ) ;
288298 if ( this . sky && this . skyCubeCamera && this . skyRenderTarget ) {
289299 this . skyCubeCamera ?. update ( this . renderer , this . sky ) ;
0 commit comments