Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Official Introduction of Render Graph in the Universal Render Pipeline (URP)

Discussion in 'Universal Render Pipeline' started by oliverschnabel, Oct 2, 2023.

  1. ThomasZeng

    ThomasZeng

    Unity Technologies

    Joined:
    Jun 24, 2019
    Posts:
    90
    Yeah, from the high level, the renderlist is handling what game objects to draw. Sounds like what you want to achieve is to reject pixels, in that case the stencil could be the right approach. You do need to make sure the depth texture has a stencil component.
     
  2. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    Hi, is there any news on a renderer feature for graph that can provide us the GBuffers in Forward mode and also render objects with a custom shader replacement shader ? So can use to get the DepthNormals texture.

    Thanks
     
  3. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,027
    Hi. It seems that BlitAndSwapColor does not work. I created new project and add BlitAndSwapColorRendererFeature, but its _BlitTexture is always 16x16 gray and not current active color texture. Tested on 6000.0.0f1.

    Additionally, is there any method for using automatic swap-buffer for full-screen effect? with legacy API, it can be easily implemented by using

    ScriptableRenderPass.Blit(CommandBuffer cmd, ref RenderingData data, Material material, int passIndex = 0)
     
    Last edited: May 10, 2024
  4. wechat_os_Qy0ztYA5HDEsLBgkmU4vGWfSw

    wechat_os_Qy0ztYA5HDEsLBgkmU4vGWfSw

    Joined:
    Jul 8, 2022
    Posts:
    3
    Why native render pass is not supported in DX12, URP 17?
    internal override bool supportsNativeRenderPassRendergraphCompiler
    {
    get => SystemInfo.graphicsDeviceType != GraphicsDeviceType.Direct3D12
    && SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLES3 // GLES doesn't support backbuffer MSAA resolve with the NRP API
    && SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLCore
    ;
    }
     
  5. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    918
    I have an issue with using depth and normal texture in a compute shader; as soon as i switch to XR, I get the error:
    Property (_CameraDepthTexture) at kernel index (0) has mismatching texture dimension (expected 2, got 5)

    I acquire the textures like this:

    Code (CSharp):
    1. TextureHandle depthTexture = resourceData.cameraDepthTexture;
    2. TextureHandle normalTexture = resourceData.cameraNormalsTexture;
    and set like this:
    Code (CSharp):
    1.     static void ExecutePass(PassData data, ComputeGraphContext cgContext)
    2.     {
    3.         // Attaches the compute buffers.
    4.         cgContext.cmd.SetComputeTextureParam(data.cs, data.cs.FindKernel("CSMain"), UniformsResolve.inputTexture, data.src);
    5.         cgContext.cmd.SetComputeTextureParam(data.cs, data.cs.FindKernel("CSMain"), UniformsResolve.outputTexture, data.dst);
    6.         cgContext.cmd.SetComputeTextureParam(data.cs, data.cs.FindKernel("CSMain"), "_CameraNormalsTexture", data.normal);
    7.         cgContext.cmd.SetComputeTextureParam(data.cs, data.cs.FindKernel("CSMain"), "_CameraDepthTexture", data.depth);
     
  6. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    There is a bug currently but a fix in in the works, ie, RenderGraph with NRP will work with DX12 soon.
     
  7. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    We're investigating a similar issue, it should be fixed in one of the next patch releases.


    We don't have that planned.
     
    ElliotB and Kichang-Kim like this.
  8. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    This is not planned.
     
  9. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    Rendering in a 3D texture with Object Render, in non Render Graph works fine and i render in a 3D texture with replacement shader, in Graph mode this does not work.

    is there a work around that ?

    Thanks
     
    Last edited: May 13, 2024
  10. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    918
    Another issue with using compute: If I want to use a writable texture, I am getting issues with MSAA: "Requested anti-aliasing with random write flag. This is not supported".
    What would be the proper way to create a writable texture for compute shader while supporting MSAA?
     
  11. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,027
    Hmm, is there no method for using URP's internal color buffers for swap (ColorAttachmentA, ColorAttachmentB) from custom renderer feature? latest URP does not allow creating temporary render targets, so without buffer swap its memory cost is too high for low-memory devices (like 2GB memory iPhones) if I create new render target for every fullscreen effect.
     
  12. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    BlitAndSwapColorRendererFeature shows how you can swap the buffer with your temp resource. You can see here how to do the swap. RenderGraph will manage the actual underlying texture/memory for you and will reuse resources automatically.
     
    Kichang-Kim likes this.
  13. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    renderGraph.CreateTexture(destinationDesc);
    or
    UniversalRenderer.CreateRenderGraphTexture

    both create a TextureHandle for a temp resource. RenderGraph will manage the lifetime of that temp resource, at most it last the entire frame. The lifetime of the resource is between its first use and last use in the frame. Once the resource is not used anymore, ie, no pass is reading or writing to it, then RenderGraph will be able to reuse the underlying memory.

    So for example, if you have three full screen post processing passes, and each creates a new texture handle to write to using renderGraph.CreateTexture(destinationDesc) and swaps it with the color buffer like in the example, then the lifetime of each temp resource is two passes and because the descriptor is identical, RG will reuse the original two color buffers from URP (CameraTargetAttachmentA en B). You can see in the image below what happens when you add three BlitAndSwap passes.

    upload_2024-5-13_14-13-50.png
     
    Last edited: May 13, 2024
    ekakiya, Kichang-Kim and ElliotB like this.
  14. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    We're looking into it. Could you elaborate more about what you're trying to do?
     
  15. wechat_os_Qy0ztYA5HDEsLBgkmU4vGWfSw

    wechat_os_Qy0ztYA5HDEsLBgkmU4vGWfSw

    Joined:
    Jul 8, 2022
    Posts:
    3
    I need asyncCompute. But using builder.EnableAsyncCompute(true) and builder.UseBuffer will result in an error.o_O
     
  16. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    Hi thanks

    Sure, i issue a urp camera render with render canera now, using a 3d texture to voxelize the world around the camera, using a geometry replacement shader.

    So far i toggled to BiRP to do it and back to URP, but after replace shaders was introduced in URP i managed to get same effect using Render object in the voxelize camera, but now seem render objects is not rendering it when in render graph mode.

    I can send some of the code also to help understand better the whole process if you want.

    Here is code of how i set up the voxelizer camera and how i render it using URP and Render Objects in the voxelizer camera renderer.

    Code (csharp):
    1.  
    2.                 voxelCameraGO = new GameObject("VOXEL_CAMERA");
    3.                 voxelCameraGO.hideFlags = HideFlags.HideInHierarchy;//v0.2a
    4.                 voxelCamera = voxelCameraGO.AddComponent<Camera>();
    5.                 voxelCamera.enabled = false; //true;//v0.1 false;
    6.                 voxelCamera.orthographic = true;
    7.                 voxelCamera.orthographicSize = voxelSpaceSize * 0.5f;
    8.                 voxelCamera.nearClipPlane = 0.0f;
    9.                 voxelCamera.farClipPlane = voxelSpaceSize;
    10.                 voxelCamera.depth = -2;
    11.                 voxelCamera.renderingPath = RenderingPath.Forward;
    12.                 voxelCamera.clearFlags = CameraClearFlags.Color;
    13.                 voxelCamera.backgroundColor = Color.black;
    14.                 voxelCamera.useOcclusionCulling = false;
    15.                 //v0.3
    16.                 UnityEngine.Rendering.Universal.UniversalAdditionalCameraData additionalCameraData = voxelCamera.transform.GetComponent<UnityEngine.Rendering.Universal.UniversalAdditionalCameraData>();
    17.                 if (additionalCameraData == null)
    18.                 {
    19.                     additionalCameraData = voxelCamera.gameObject.AddComponent<UniversalAdditionalCameraData>();
    20.                 }
    21.                 additionalCameraData.SetRenderer(renderObjectsWithReplaceShaderRendererID);
    22.  
    Code (csharp):
    1.  
    2.                 //Clear the volume texture that is immediately written to in the voxelization scene shader
    3.                 clearCompute.SetTexture(0, "RG0", integerVolume);
    4.                 clearCompute.SetInt("Res", (int)voxelResolution);
    5.                 clearCompute.Dispatch(0, (int)voxelResolution / 16, (int)voxelResolution / 16, 1);
    6.  
    7.                 Graphics.SetRandomWriteTarget(1, integerVolume);
    8.                 voxelCamera.targetTexture = dummyVoxelTextureAAScaled;
    9.        
    10.                 //2.0
    11.                 UnityEngine.Rendering.Universal.UniversalAdditionalCameraData additionalCameraData =
    12.         voxelCamera.transform.GetComponent<UnityEngine.Rendering.Universal.UniversalAdditionalCameraData>();
    13.  
    14.                 additionalCameraData.SetRenderer(renderObjectsWithReplaceShaderRendererID);
    15.  
    16.                 UniversalRenderPipeline.RenderSingleCamera(context, voxelCamera);
    17.                 Graphics.ClearRandomWriteTargets();
    18.  
    The result is rendered in the integerVolume 3D texture.

    The renderer with ID "renderObjectsWithReplaceShaderRendererID" has a Render Objects feature in shader replacement mode with my Geometry shader.

    This works ok in the current pre-Graph URP mode, but not seem to render the texture when toggle to Graph, like the Render Objects is not working possibly.
     
    Last edited: May 13, 2024
    AljoshaD likes this.
  17. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    Hi, i just sent a test project and a video below to showcase the problem and how to test the two modes in my asset


    The system works in Render Graph and non Graph compatibility with same configuration now, the URP native voxelizer works only on non Graph mode for now (BiRP voxelizer works fine in both modes)

    Many thanks for looking into it in advance :)
     
    AljoshaD likes this.
  18. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,027
    @AljoshaD
    Enabling RenderGraph makes UGUI is broken on Android/iOS devices. Disabling post-process or RenderGraph can solve the issue. Can you check this issue? reproducible project is sent as IN-76239.
    (Empty project with single text UI can reproduce this issue :) )

    Here is error log on iOS:
    Edit: It seems that Unity 6000.0.1f1 fixes UGUI issue, but RenderPass error messages are still shown at first frame on iOS devices. (Android/Windows platform does not show error messages)

    Edit 2: Even with Unity 6000.0.1f1, enabling RenderGraph makes various visual glitches on Android/iOS devices. (Editor and Windows build has no issue)
     
    Last edited: May 15, 2024
    AljoshaD likes this.
  19. wechat_os_Qy0ztYA5HDEsLBgkmU4vGWfSw

    wechat_os_Qy0ztYA5HDEsLBgkmU4vGWfSw

    Joined:
    Jul 8, 2022
    Posts:
    3
    upload_2024-5-15_20-33-39.png I tried my best to use async Compute, but.......Is there anyone can tell me how to use it in URP?
     
  20. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    Can you submit a bug?
     
  21. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,027
    Sure. Sent as IN-76358.

    I tested 3 types of fullscreen blits and swapbuffer :
    1. RenderGraphUtils.AddBlitPass
    * Does not work on Editor. (But framedebugger shows correct result. Only GameView shows incorrect visual)
    * Work well on actual device, but destinationDesc.clearBuffer = false makes some noise on specific Android device.

    2. SetRenderAttachment() with Blitter.BlitTexture()
    * Work well on Editor, but does not work on some Android device when MSAA is enabled.
    * With GraphicsJobs enabled, does not work on iOS.
    * Work well on Windows build regardless of GraphicsJobs and MSAA.

    3. Custom UnsafePass with Blitter.BlitCameraTexture()
    * Same to 1.

    Reported project use type 1.
     
    Last edited: May 15, 2024
    AljoshaD likes this.
  22. Kichang-Kim

    Kichang-Kim

    Joined:
    Oct 19, 2010
    Posts:
    1,027
    Also found that enabling RenderGraph makes the pass order mess.

    My render pass (DepthHeightColorGradingPass) uses AfterRenderingSkyBox event, and here is actual pass order of both cases:
    pass-order-issue.png

    I want my pass's result be copied to color texture, so left (legacy mode) is correct. But if RenderGraph is enabled, I can't get it.

    Here is URP RenderGraph rendering source code (UniversalRendererRenderGraph.cs) and it seems that user cannot inject custom pass into between renderskybox and copycolor.

    Code (CSharp):
    1. RecordCustomRenderGraphPasses(renderGraph, RenderPassEvent.BeforeRenderingSkybox);
    2.  
    3. if (cameraData.camera.clearFlags == CameraClearFlags.Skybox && cameraData.renderType != CameraRenderType.Overlay)
    4. {
    5.     if (RenderSettings.skybox != null || (cameraData.camera.TryGetComponent(out Skybox cameraSkybox) && cameraSkybox.material != null))
    6.         m_DrawSkyboxPass.Render(renderGraph, frameData, context, resourceData.activeColorTexture, resourceData.activeDepthTexture, requiresDepthCopyPass && m_CopyDepthMode != CopyDepthMode.AfterTransparents);
    7. }
    8.  
    9. // WE NEED CUSTOM PASS HERE !!
    10.  
    11. if (requiresColorCopyPass)
    12. {
    13.     TextureHandle activeColor = resourceData.activeColorTexture;
    14.     Downsampling downsamplingMethod = UniversalRenderPipeline.asset.opaqueDownsampling;
    15.     TextureHandle cameraOpaqueTexture;
    16.     m_CopyColorPass.Render(renderGraph, frameData, out cameraOpaqueTexture, in activeColor, downsamplingMethod);
    17.     resourceData.cameraOpaqueTexture = cameraOpaqueTexture;
    18. }
    Reported as IN-76460.
     
    Last edited: May 17, 2024
    nasos_333 likes this.
  23. mrc_akka

    mrc_akka

    Joined:
    Mar 26, 2020
    Posts:
    24
    Hello, I'm currently trying Render Feature in URP on Unity 6000.0.1.

    I implemented an eye adaptation, computing luminance in a first ScriptableRenderPass(1 unsafepass), and applying exposition compensation in a second ScriptableRenderPass (2 rasterpass with framebufferfetch).
    Passing to the new rendergraph from the old execute api was a bit difficult.
    It takes me a bit of time to understand the unsafe pass system (GetNativeCommandBuffer to get full api, allowpassculling to avoid breaking subsequent bloom pass) but now it's working.

    My question is about the Frame Debugger. If my render feature is activated the frame buffer become unusable, it blink as if my passes were added and removed at every steps.
    Is this a known bug or is it a problem from my AddRenderPasses overload?
     
  24. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    I also noticed that effects that worked in certain injection points in non graph, they stop working in graph and need to come after skybox than before post process.

    Also the color and opaque textures are complicated, not sure how to grab previpus effect result if effects are in different features.

    So far all work but orders have changed, so is not same as non graph mode
     
  25. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    That might be a bug, could you submit a bug with a small repo?


    Features can share resources with each other through the frameData / ContextContainer. It's demonstrated in one of the package samples.
     
    nasos_333 likes this.
  26. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    Sure, will try send a sample where works in non graph but not in graph, if not change injection point.

    Another issue i see is the URP direct camera render now function gives an error when graph is used, still investigating under which feature i had activated this happen

    Will send also this hopefully
     
    AljoshaD likes this.
  27. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    Hi,

    I want to get the context in unsafe pass to do the following

    context.DrawRenderers

    is this possible ?

    Thanks
     
  28. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    Hi,

    I have been trying to get the result of this sample, using a single tag to a rendertexture and set it to global.

    I have tried for several days and seems this is impossible, please can you make an example of such ?

    Just one tag and one tetxure output ot global, not to main camera

    I did manage to render to the main camera texture with this tag, but this is not what i need, need to pass the result to a global and not affect the main camera.

    Thanks

    EDIT: Issue has been Resolved!
     
    Last edited: May 18, 2024
  29. wwWwwwW1

    wwWwwwW1

    Joined:
    Oct 31, 2021
    Posts:
    789
    Hi, I think you need to use context.cmd.DrawRendererList() instead. (examples from the URP package)
     
    nasos_333 likes this.
  30. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    Yes, thanks, this is correct :)

    I had many other issues with clearing the buffers and put all in correct order, but now works using native render graph (not unsafe pass)

    Would be useful though to see how to replicate this with unsafe pass ideally without changing the original code
     
    wwWwwwW1 likes this.
  31. camerondus

    camerondus

    Joined:
    Dec 15, 2018
    Posts:
    63
    im trying once again to update my asset to be compatible with render graph. using the BlitWithMaterial example, i am finally able to get an output. however, it would seem that something is not right at all, as my output looks like this:

    upload_2024-5-19_13-40-6.png

    the quad that is being rendered appears to be located at (0,0,1) in the world, with 0,0,0 rotation. i dont know what i could be doing wrong, but would appreciate some tips. thanks.
     
  32. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549

    Graph version in Unity Editor


    Non Graph version in Unity Editor


    Graph version in Build


    Non Graph Version in Build

    Hi,

    I am doing some tests for performance and sadly the graph version seems to miss around 10fps in heavy scenes with many effects, in the demo above i use real time Global illumination and volumetric lights, plus screen space reflections.

    I use Unity 6000.0.0f1. For now seems too much of a different to make it usable. I will check more in case some of the implementations can become faster in Graph code, maybe is something i have overlooked also, but generally is mostly same things. Perhaps some texture is not downscaled properly, though all seem to work same in first look and performance just drops on the toggle between the two modes.

    Also is there any major performance boost between the 6000.0.0f1 and the latest 6000.0.2f1 ?

    Thanks

    EDIT: I added results from a build with FPS counter, seems still there is a around 6fps steady difference. Will upload the two demos also.

    DEMOS for reference:
    https://drive.google.com/file/d/19AdfrEqMgrZD89M9u5iy7Y5DuJhg0vw1/view?usp=sharing

    The No GRAPH demo is the URP in compatibility mode in Unity 6000.0.0f1, the other uses the Graph.
     
    Last edited: May 20, 2024
  33. mrc_akka

    mrc_akka

    Joined:
    Mar 26, 2020
    Posts:
    24
    Continuing on this performance subject, I'm wondering how the rendergraph version can have more performance when there is nothing to cull.
    It is always constructing the graph, compiling the graph, computing culling, and finally executing the optimized graph, instead of only executing.
    Is there a way to not reconstruct the graph at each frame in an URP project ?

    BTW, I have always a frame debugger problem, is it working in your test ?
     
  34. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    That is my thought also, not just for the graph but the scriptable pipelines too that potentially add an extra parsing step versus a fixed pipeline.

    I have never used the frame debugger so far, will check it out.
     
  35. tomekkie2

    tomekkie2

    Joined:
    Jul 6, 2012
    Posts:
    990
    Is it possible to use GL in rendergraph?
    https://docs.unity3d.com/ScriptReference/GL.html
    In Uniry 6000.0.1f1 GL.LINES work in the compability mode; in rendergraph I am getting these errors:

    Draw Objects Pass/Draw Skybox Pass/Draw Objects Pass: Missing resolve surface for attachment 0
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)


    EndRenderPass: Not inside a Renderpass
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
     
    Last edited: May 21, 2024
  36. mrc_akka

    mrc_akka

    Joined:
    Mar 26, 2020
    Posts:
    24
    I guess, with rendergraph, everything must be push in command buffer via render passes.
    Again, my guess is, the easyest you can do is to use a
    raster renderpass (AddRasterRenderPass) in which you use the command buffer to draw a line renderer (DrawRenderer).
     
  37. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    RenderGraph automatically sets up native render passes, load/store actions, and manages and reuses texture resources. With all the different settings, renderers, platforms and graphics backends, this leads to a more optimal set up of the frame.

    No, the compiled graph is cached. So it is not reconstructing the graph every frame. You can turn off this caching in the graphics settings.

    Using RenderGraph does have a CPU overhead, even with the graph caching. We have optimized other parts of URP to offset this cost. So compared with URP in 22 LTS, there should not be a regression.
     
  38. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    Hi, thanks for the feedback on this.

    About "Using RenderGraph does have a CPU overhead", this means that there is no way to get the same CPU performance as the non graph mode ?

    Because in heavier effects and effect combinations this seem to have a major impact in performance overall.

    In my tests the cost does not seem offseted, i get around 5-10fps lower in Graph, which is a huge difference.

    Is there any chance that the Graph mode be combined with the previous faster mode ?
     
  39. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    The CPU overhead should be similar to non-graph mode in 22 LTS. Of course, more passes means more overhead so specific cases could differ.


    FPS is a bit meaningless but I noticed in your screenshots 5ms difference on main thread and also an impact on the render thread. That seems extreme, which hints to either a bug or/and incorrect/unoptimal usage of the new API.
     
    nasos_333 likes this.
  40. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    I think is because lot of effects are used and the smaller delays pile up.

    E.g. in the real time global illumination the differences are 1-2ms in both CPU and GPU, closer to 1ms.

    Add though volume lights, painterly effects, Temporal AA, Screen Space reflections and the 1ms becomes 5ms, which is what we see in the issue above.

    Individually is acceptable, with a clear difference but small, but adding all gives a much worse result overall.
     
    Last edited: May 21, 2024
  41. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    It's unexpected to see an increase in GPU cost, do you have any thoughts why that would be the case?
     
  42. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    No idea, the shaders are same in general. I post a video showing the effect and toggle between the two modes.

    The visuals look generally identical, also i have equalized some extra things, e.g redid the SSR in Unsafe mode, in case was something there, so has minimal change and also removed some extra Temporal i had integrated in the Graph LUMINA, so in general should be same things in the above video.

    Also operate all effects in full resolution, thus should not be some missed downscaling.
    In the video have enabled Real Time Global Illumination, SSR, Temporal AA and Volumetric Lights.
    Using Unity 6000.0.0f1 in a 4050RTX GPU Laptop.
     
    Last edited: May 21, 2024
  43. BragBiscuitz

    BragBiscuitz

    Joined:
    Mar 29, 2020
    Posts:
    7
    Is reconstructing the same as recording? Because I do see "RecordRenderGraph" in the profiler every single frame despite caching being turned on. I noticed the profiler may be collapsing multiple executions under a single marker though, which varies in length depending on the frame, but I'd have thought caching just prevents that recording step from being necessary at all on the frame.
     
    nasos_333 likes this.
  44. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    No. The steps are
    Recording > Compiling > Executing > Submitting

    The caching saves the compiling. During the recording, there's an update of the state that we can't cache with the current design. The work that happens in old URP (compatibility mode) is spread over recording, executing, submitting. There's a little bit of additional overhead but we optimized it to being quite small. The executing now also makes elaborate use of the native render pass API, which was still unoptimized but is evolving well.
     
    nasos_333 likes this.
  45. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    Why would it not be 100% same as the compatibility mode if the compiling is disabled, if is using the same steps ?

    I link the two latest demos also for reference, after I did more to bring the two on par for the comparison
    https://drive.google.com/file/d/1-6ZptfR-fGecHXsv2RXhW6JY1FnW0iWC/view?usp=sharing

    The non Graph hover at 46-48fps and Graph at 40-42fps, so there is a 6-8fps gap, i test in DX11 and Forward+ mode, with a 4050RTX GPU Laptop, in Unity 6000.0.0f1. I have enabled the caching also.

    If you think any of the Render API (e.g. use Vulkan instead), Unity version (e.g. Unity 6000.0.2f1) or mode (e.g. Deferred vs Forward+) would help increase the frame rate also let me know to test with that config.
     
  46. BragBiscuitz

    BragBiscuitz

    Joined:
    Mar 29, 2020
    Posts:
    7
    Oh wow. I've never noticed (or completely forgot) that compiling step in the profiler through testing most of the 2023.3/Unity 6 betas. I guess that one isn't remotely close to becoming a problem!
    Unity_B7v6MgGsek.png
    Hmm. This seems to correlate with some personal observations when checking out RenderObjectsPass. Though, by "current design" (in relation to recording?), do you mean this specific aspect is likely to change/evolve?

    Also thanks for clarifying! Here's hoping more performance can be squeezed from the backend.
     
  47. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    The code is organised differently. Roughly the same work, organized in different steps. With a little overhead from storing the recording. And we now use the native render passes much more than setRT, which is still a relatively unoptimized API since we only had one NRP before.


    FPS does not say much. frame time in ms, clearly differentiating between GPU, CPU main thread and CPU render thread is much more clear.


    I would expect to see an improvement (less difference) with Vulkan. Could you try that?
     
    Last edited: May 22, 2024
  48. AljoshaD

    AljoshaD

    Unity Technologies

    Joined:
    May 27, 2019
    Posts:
    282
    We want to further reduce the CPU cost in future releases and caching parts of what is now in recording could be part of the solution. But no concrete plans now.
     
    BragBiscuitz and nasos_333 like this.
  49. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549
    Sure, thanks. I can also check inside editor for the CPU vs GPU and also provide that info.
     
  50. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,549

    I did a test in Vulkan, posting a video showing the CPU and GPU in the two modes above, for reference.

    The difference is similar, 70fps in non Graph and around 62fps in Graph, so around 8fps gap, as with DX11.

    The good news is that Vulkan is a lot faster overall than DX11, so that at least bring it above 60fps. But with non Graph is even faster, so would definity be nice to have similar performance to non Graph mode, or at least close that gap to around half, so is not so much difference.

    Another note, i get this error in Graph in Vulkan
    "Vulkan ProfilingMarkerStack: underflow, inconsistent profiler markers"

    And my FPS meter text is not appearing, not sure if those are related.

    Also another thing i noticed is that the "Uninitialized" in Camera when rendering to a render texture is not working as in non Graph mode, so will reset the texture than create a ghosting of the previous state, when Graph is enabled.
     
    Last edited: May 22, 2024