FPS drops when camera viewport changes shadows are turned on

I noticed a sudden FPS drop and sharp VRAM increase when I change the camera viewport while realtime shadows are turned on.

I created a repro test scene that contains 1 cube, 1 plane and 1 directional light with soft shadows turned on. As soon as the camera pixel rect is changed (either by script on manually) the VRAM jumps from 17MB to nearly 200MB and goes back to normal after a few seconds. Of course FPS drops too :slight_smile:

It doesn’t seem to be dependent on the scene complexity but gets much worse with increasing framebuffer/window size, so definitely fillrate bound. In the GPU profiler you can also notice that the call to RenderTexture.SetActive is spiking heavily.

Can’t remember that shadows were that viewport-change sensitive in previous versions. Was about to report a regression bug, any experience with that?

Cheers, Tommy

(btw, using 4.0.1)

I have encountered the same problem, using unity 4.5.3 on new imac

real time shadows + viewport rect changes = HUGE FPS drop.

Tommynator, did you ever resolve this on your own?