I know starting out that shader replacement and VR, in general, are not an ideal combination. VR necessitates high frame rates and shader replacement is expensive. But for what I’m trying to accomplish there is no alternative, I need shader replacement.
Issues with current shader replacement in VR
Currently, RenderWithShader() / manually rendering disabled cameras don’t support single-pass stereo, which makes it painful enough, as each needs shader replacement performed individually. I’m now trying to get multipass shader replacement to work while VR cameras are active and are at a loss.
Even if the disabled, replacement camera is in no way connected to the VR camera (ie. not using Camera.CopyFrom(myVRCamera) and the replacement is not rendered during the VR cameras pre-render/post-render) the replacement camera either only seems capable of rendering to a single target at a time (SinglePass) or the first target of the shader replacement is blitted into the left eye of the VR headset seemingly arbitrarily (MultiPass) when rendering to multiple targets.
In my scenario, this means performing 3 separate passes of shader replacement, per eye, which makes my current extension understandably unusable in a lot of VR use-cases.
Separate bug reports have been submitted for both the single-pass and multipass issues here :
SinglePass - (Will edit to amend if opened/accepted)
MultiPass - (Will edit to amend if opened/accepted)
I’ve attached the project submitted to both bug reports if anyone else is interested.
(Side note) - Issues with frame debugger in VR
As an aside, the frame bugger continues to update with the HMD’s orientation as you use it. While this may sound like correct behavior, in reality, it means what is currently being culled is constantly changing as your trying to navigate the frame debugger. This makes it near impossible to use without putting your headset down, as the position in the frame queue is constantly changing with the varying number of passes. So why not just freeze the HMD position when the frame debugger is enabled?
I’ve not submitted a bug report for this as it could questionably be conceived as the correct behavior, instead, I’m just making an argument for changing the behavior or adding an option.
(Can skip to here if you like)
So my question is not can you fix these issues (Though that would be nice) but rather, are you planning on supporting the current model of shader replacement in the future? Or will you be deprecating it in favor of Scriptable Rendering Pipelines, if and when they come out?
Also if scriptable render pipelines are still quite far out (Currently listed as “In-progress, timelines long or uncertain”), are there any known workarounds?
Cheers
Dan
3244885–249588–VR Test.zip (3.88 MB)