I found “ScriptableRenderContext.BeginRenderPass” API in Unity Documention.
But the code just show CS script, without shader code part . that is incomplete.
And I search all around the URP and HDRP, no one use this API.
So I’m afraid this API is not ready to use . Is this TRUE?
If it is ready for use in product, is there Any body can give me some full example?
THX~~~
I’m looking to try something similar for use with the Quest once VR Vulkan support is released. You should be able to have a subpass render the tile and then a second subpass running the compute shader using ScriptableRenderPipeline.BeginSubpass/EndSubpass but haven’t been able to test this.
Currently we don’t make use of this in the SRPs due to two things, one being that we did not require using it for what we were doing at the time and two when we went to use it we found some shortcomings with the API that didn’t let us do what we wanted so there has currently been a lot of work happening to make sure it is solid and can be more useful as an API.
For some context we will be making heavy use of this in the Deferred Renderer coming to Universal RP since we want to stay on tile for a lot of the passes in Deferred, this work will be then used to also improve the post effects and assorted bits throughout the ForwardRenderer in Universal RP.
ETA is rough at the moment as we are still finalising our roadmap for 2020 but this will land next year.
Thanks for your response.
But we want to use subpass to improve our post effects.
I think SRP should give us a chance to use some specific feature on some specific devices.
For example: use subpass on ios devices, use pixel_local_storage on arm-mali devices. or use GL_ARM_shader_framebuffer_fetch_depth_stencil on some valid devices.
In other word, We don’t expect an DeferredRenderer in Universal RP. or we need an low end device(mobile) special pipline. Don’t make Universal RP to be another HDRP. if unity give up mobile,ask us to dev pc game,why don’t we use ue4 or cryengine 5(CE5 just focus High End Devices like PC right?)?
I was simply implying that we are not using it yet because the underlying API is not ready, and for us to know it is ready is to implement it into the Universal RP. When we ship this you will be able to hack it apart and do whatever, you could also fully make your own SRP if you want, but without us using it(which is arguably how it went in and in the state it is) we will never be able to make sure it does what it needs to do.
And it is Unity, after all you can go and write your own API from scratch if you want full control over it right now, but we are aiming to create something that will work across all our 26 platforms without you having to worry about the many different ways it’s handled(even when it is not supported).
So the ability to stay on tile with subpasses (to do certain post-processing right after the first subpass, without having to resolve everything then do it) using Unity’s SRP API won’t be coming with VR Vulkan support at the start of next year, but rather later on when you have proper support for it?
Having said that, I just want to say that we put a lot of effort into this API this year. We fixed many issues and currently have a PoC working with URP. Until we release some content with URP, my suggestion is to base your custom SRP on that example.
Yes, I know you guys have so many works. I understand. thanks for your respectable works.
Thanks for phil_lira’s example projects, they are very helpful.
As Andre_Mcgrail said, URP will work across all 26 platforms. so that won’t be a real lightwetight pipline anymore…
I know that is unity’s decision.
I’m afraid of the compatibility with mobile devices.“Universal” is not a good name.
I think,there wont be a pipline work best on every 26 platforms, but work just so so on every 26 platform.
Fortunately we can custom the URP, if the engine core give enough low level support.
I did a POC with RenderPass and an SRP and I do like how the API lets you explicitly work with on tile memory and handle the resolves, but I found that some actions seem to occur out of order when using RenderPass, CommandBuffer apis and ScriptableRenderContext.DrawRenderers.
I have not starting using the FBFetch api’s yet.
In particular:
Bind a non MSAA RenderTexture without depth as a resolve target
BeginRenderPass with reduced resolution and MSAA (resolution * rendercale)
BeginSubPass
draw the 3D screne (context.DrawRenderers)
EndSubpass
EndEnderPass
Bind the CameraTarget as the target
BeginRenderPass with full resolution and no MSAA
BeginSubPass
Draw a full screen quad from the resolve target (my 3d Scene) with post effects
Draw UI (context.DrawRenderers)
EndSubpass
EndEnderPass
The UI gets moved up into the first RenderPass and the second RenderPass only gets the full screen quad.
Is it worth trying to debug this, or should I wait for the next revision of DrawRenderPass?
At this stage the POC was pretty much my standard pipeline with SetRenderTarget’s and Clears replaced by RenderPass’s and (just in case) Blits replaced by CommandBuffer.DrawMesh
I was also wondering if DrawRenderers uses command buffers internally or if all command buffers are just wrappers around buffered API calls to Graphics, Shaders, (whatever)
Any new info on this stuff, with the available versions of Unity 2020.1 and 2020.2 ?
Mainly curious about SV_RenderTargetArrayIndex usage with subpasses, it seems when configuring an AttachmentDescriptor with ConfigureTarget & a render target dimension of TextureDimension.Tex2DArray it is not specifying that all array indices can be written to.
(the render target array comes through targeted in render doc, but changing SV_RenderTargetArrayIndex has no effect, it always goes to slice 0)
I noticed that if you call cmd.SetRenderTarget(colorIdentifier,0,CubemapFace.Unknown,-1); within the subpass it will target all slices correctly.
But does that defeat the purpose of RenderPass / SubPasses ?
@XRA_1 you bring up so many questions I’ve been dealing with lately.
Bumping this thread. I’m hoping to see more concrete examples of the Command Buffer API now that URP 12.0 was released earlier this year.
Ive been working on some post processing effects using the Command Buffer API and compute shaders and it has been a bit frustrating realizing which things are not being used or that there are types that can only be used with certain commands but those commands have comments on them saying not to use them.
The deferred renderer in URP uses the NativeRenderPass API in 2022.
We also created a RenderGraph system in 2023 that will automatically handle applying NRP, merging passes and setting load/store actions. This should remove all the complexity from writing your own render passes.There is an elaborate thread on that here . By using the NRP API much more elaborately, we also fixed a lot of issues and many of those are backported to 2022.
We’ll ship new samples on how to apply framebufferfetch in one of the next 23.3.bx patch versions.