Hello, everyone!
I’m learning compute shaders and their usage in UE, so I’m trying to play with them in a global shader environment, but I’m having an issue, when executing the shader.
Basically, I have a pass-through shader, which samples the previous input, and I have put the shader between TAA and Motion Blur. I declared the shader and calling it in this particular place. After enabling “r.PostProcessing.PreferCompute” everything seems to be working fine, in the editor viewport, but when I’m launching “New Editor Window”, black bars start to appear on the image.
When resizing the window, it starts to be even worse, when you first increase and then decrease the window size, as it leaves stuck previous frames on the texture.
At first I thought, that I declared wrong number of threads or “ViewRect.Size()” but it seems to be generating the same amount of threads as TAA or any other post-processing shader according to RenderDoc. The only one that got my attention was “BokehDOFRecombineCompute#2” which was pushing more threads than needed, thus, creating a bigger resolution of the texture than it should be.
After analyzing the pipeline with and without the shader, I came to conclusion, that after “BokehDOF” creates this “bigger” texture, the last pixel shader in the pipeline (which is called “PassThrough” ironically), somehow fixes the resolution in the end. The problem is, it doesn’t fix the texture completely, when my shader is being executed. And the problem only appears, when working in the editor process, as creating a new one (“Standalone Game”), is working correctly, even when experimenting with unusual resolutions. After closing the “New Editor Window” the viewport will have a “broken” image as well as it can be seen on the screenshot.
The preview icons for some of the materials became black or have a minimized texture in them.
I don’t know the structure of this pipeline, but if someone from the developers or the people who know, what is happening here could explain this to me, that would be very helpful. I’m sorry if my explanation wasn’t clear, but I’m ready to discuss it in more understandable way if you ask me some questions. Thank you in advance for the answer.