i have a strange error/thing in a unity project i overtook. Every UI Image i have has some strange effect attached. Zooming near the image first creates some kind of white fog, until you cant even see the Image anymore. Going even nearer reveals a striping/noise pattern on the image.
This happens with EVERY Image, but most notably with large ones like this black, screen filling background. All the images are in screen-space Canvases, have no other components attached, and use the Unity UI-Default Material and Shader.
My first thought was, that someone must have switched the default Shader or Material with a modified variant. I found this thread, detailing that this is indeed possible [ Change the Default UI Material? ], but after replacing the UI Shader and UI material with a default one the problem persists.
In the Editor, i disabled post-processing, with no result. Only disabling lighting seems to stop this.
The project makes use of the HDR Pipeline, with which im not very familiar. Maybe it is some HDRP Setting messing with the images, but i have no idea which one that could be.
This looks like z fighting to me. It looks like there’s some object using a custom shader that’s writing to the depth buffer that shouldn’t be. I’m guessing it’s whatever is creating the “white fog”.
And where could that custom shader come from? I downloaded the Unity UI default shader, made a material from it, moved it onto the Image - and nothings changed.
Adding a non-UI Material to the Image removes the jitter and this distortion pattern, but the white fog is still there.
Wait, why would you do that? The default UI shader is included with Unity already. More over, there’s no need to assign any material to a UI element as it’ll default to using the default UI shader. I suspect this is your problem. Delete that shader & material. Just assign the image you want to the UI component.
As i wrote in my question: i suspected, that my predecessors changed the Unity Default UI shader (which is indeed possible). To test this, i tested my theory by using a default UI shader that i downloaded.
Even when creating a new scene and adding a new image without changing anything results in the same problem. Furthermore, the fog seems to have the inverted color of the image. White images create a black fog.
I suspect the fog aspect is a red herring of sorts. That just sounds like the HDRP’s auto exposure going crazy when your screen is being filled with a surface that the exposure doesn’t affect. The SRPs are a bit janky when it comes to respecting (or rather not at all respecting) the scene view settings for disabling things like post processing.
The Z fighting issue on the other hand tells me something is writing to the depth at the same plane as the UI. If you’re working with what you suspect is a modified HDRP, then all bets are off and I have no idea what the problem is.