[HDRP] custom pass fails randomly
In my scene I use a Custom Pass Volume with two Custom passes:
First pass points all black
The second pass draws a certain object red
This usually works fine - the drawn images are black with the red object plain in sight, unless all of a sudden it does not, and the resulting images are black. Images are created by making a Texture2D copy from the original RenderTexture and then using Texture.EncodeToPNG()
to write the frame to disk
I have no idea how that happens (but I suspect unity crashes are to blame), but I have noticed, that using an older commit in my git branch, I can return to a state where that error does not occur, even though the commited changes between the commits do not touch those code lines, where the custom pass or its camera or the drawn objects are concerned.
Now, I even have two branches that are code-wise pratically identical, and in one branch the custom passes work fine, resulting in a red object on black surrounding, and one where the custom passes fail, resulting in a solely black image.
What happens there? How can this issue be resolved? Is this some caching issue, or a timing issue? Answers would be really appreciated!
Your answer

Follow this Question
Related Questions
CEFGlue with Unity 1 Answer
Mesh Texture Not Rendered On Edges on iOS 0 Answers
Selectively apply material via RaycastHit 0 Answers
Capturing high resolution screenshot with Temporal AA 1 Answer
RenderTexture update 0 Answers