Closed kyl3r92 closed 1 year ago
Thanks for the bug report, there is indeed an error in the dimension of the compositing shader, I fixed it in this commit: https://github.com/alelievr/HDRP-UI-Camera-Stacking/commit/e4aad25510fc888a97a0eaf65131a9dff3cb9d87 (version 1.4.1) Can you check if you still have the intensity issue with the fix?
Hi, thank you! Yes that makes sense, as I've read similar stuff while looking for possible solutions - the mainTex basically needed to be forced to a certain size. This at least somehow explains why it worked in the editor but not in build.
I didn't find 1.4.1 in releases and also not via UPM (only 1.4 so far) but I downloaded the whole repo, deleted the "Editor" and "Runtime" Folders and replaced them. The contained package.json says "1.4.1" so this should be the correct version.
I built the game and can confirm it works as expected now - thanks a lot!
Thanks for checking, I've published the new release on github: https://github.com/alelievr/HDRP-UI-Camera-Stacking/releases/tag/1.4.1
I got Version 1.4 from UPM. It worked fine in Editor, but in build the image was white, only the UI layer was drawn on top. I created a Dev Build and connected the Frame Debugger, it seems to be very similar to this issue: https://github.com/alelievr/HDRP-UI-Camera-Stacking/issues/18 But adding the Shaders to "always include" didn't fix it for me.
Have a look at: UI Transparency Background Init.shader There is MainTex defined as "2D" but sampled as array:
Unity throws an "error" (yellow warning icon though) if I select this shader file. Something about implicit truncation of vector type. If you change
SAMPLE_TEXTURE2D_X_LOD
toSAMPLE_TEXTURE2D_LOD
the error is gone. But the problem is not fixed.I also tried returning "0.5" for the alpha - that results in my scene being half-visible (but overlayed with 50% white - as expected) But neither 1 nor 0 work perfectly - also expected. 0.01 looks ok for colors, but stuff on UI Camera show a trace over multiple frames... - this is clearly not the right way to fix it. But it helped me pinpoint the problem.
So I changed everything to 2DArray (like it's done in HDRP UI Compositing.shader):
That "worked" but the scene was still too bright, didn't look like it's simply overlayed with a white semi-transparent image. Instead it looked like it's gamma instead of linear? So maybe we are close to a fix here: Using "2DArray" (etc.) in the "UI Transparency Background Init.shader" is step one, and step 2 could have to do with linear/gamma color space. But I'm stuck here. Maybe it helps you to reproduce and find the error? I'm using linear color space and I haven't tested with gamma yet.
But I saw the
LinearToGammaSpace
function in the shader, altering this didn't have an effect for me. Also the Composite function had a commented line where you probably worked on the alpha parts:Which may be a hint that I'm not completely on the wrong track here.
For now I "fixed" it now by replacing the 1.4 with 1.2 from here: https://github.com/alelievr/HDRP-UI-Camera-Stacking/releases