Pixel Perfect Camera Crop Border Content

Using the pixel perfect camera with the cropped frame boxes ticked, how do you fill, or, preferably, keep empty, the space in the cropped out border area?

I noticed when transitioning from a scene with an uncropped camera to one with cropping, the area around the active area was filled by the edges of the render from the previous scene, like so:


(the uncropped camera area stops at the grey/dirt edge, with the cloudy sky being left over from the previous screen)

When running on mobile, the results were far more distracting, as what was in the edges was for some reason moving with the rest of the scene:


(happens in landscape too, but portrait makes it much more apparent)

For the transition case I tried manually calling GL clear on scene load (both depth and color buffer), but it didn’t seem to make a difference. I’m not sure what else to try, all I really want is for the border area to be black or some other solid color, anything more interesting or dynamic would be a bonus.

I did a lot of searching but couldn’t find a solution if this has been asked before, struggled with the wording so maybe I missed it…? Thanks for any help in advance.

BUMPING! I’m having the exact same problem.

I’ve just run into an issue where in my builds—regardless of platform—aren’t being cropped as per the Pixel Perfect Camera component settings. I’m using the URP and have tried both versions of the Pixel Perfect Camera component. The one labelled “experimental” behaves oddly and is definitely not cropping with black bars.

WARNING: strobing in clip below

mellowflashyicefish

Would love to figure this out for the end of my game jam in 48 hours.

(Unity 2020.2.1f1 on macOS Big Sur 11.1)

Having the exact same issue for the past few months now. Wrote a pretty detailed bit of code so that the reference texture is exactly the ratio of the game window, but would still like to know if there is a way to clear the entire frame buffer or something.

Same here, this showed up when the package moved to URP.

That border area is undefined so calling those graphics functions won’t affect them. Easy fix for this is to have a second camera under your main one with a black background. That way the border area will be drawn black.

The black bars do not go away, as far as I can tell it is not possible to layer cameras while using the pixel perfect camera. Is there anything more to this solution that you haven’t described?

The issue still persists in Unity 6.4.