Open
Description
After examining the issue, it turns out that the main cause is the failure to bind the new buffer to the clearStartOffsetBufferKernel after reallocating the buffer due to a change in screen size.
This issue can be simply resolved by binding the buffer before dispatching the kernel:
//reset StartOffsetBuffer to zeros
oitComputeUtils.SetInt("screenWidth", screenWidth);
oitComputeUtils.SetBuffer(clearStartOffsetBufferKernel, startOffsetBufferId, startOffsetBuffer);
oitComputeUtils.Dispatch(clearStartOffsetBufferKernel, dispatchGroupSizeX, dispatchGroupSizeY, 1);
And, when I investigated this issue, I also discovered that the Screen.width value retrieved here changes frequently, because this variable refers to the current window , which could be the preview window, the editor window, and the game window.
It might be a better approach to bind an independent buffer for each camera?
Additionally, switching windows can causes the OIT effect to disappear, and I have not yet found the reason for this.
Metadata
Metadata
Assignees
Labels
No labels