Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Unity Experimental HDRP DXR

Discussion in 'HDRP Ray Tracing' started by SebLagarde, Apr 4, 2019.

  1. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,733
    sinaari likes this.
  2. cchatzakis

    cchatzakis

    Joined:
    Nov 22, 2019
    Posts:
    7
    Just started experimenting with 7.1.7 in Unity 2019.3.0f3 (driver 441.66) . And I get some errors:

    1)
    NullReferenceException: Object reference not set to an instance of an object
    UnityEditor.Rendering.HighDefinition.AmbientOcclusionEditor.OnInspectorGUI () (at Library/PackageCache/com.unity.render-pipelines.high-definition@7.1.7/Editor/Lighting/AmbientOcclusionEditor.cs:74)
    UnityEditor.Rendering.VolumeComponentEditor.OnInternalInspectorGUI () (at Library/PackageCache/com.unity.render-pipelines.core@7.1.7/Editor/Volume/VolumeComponentEditor.cs:225)
    UnityEditor.Rendering.VolumeComponentListEditor.OnGUI () (at Library/PackageCache/com.unity.render-pipelines.core@7.1.7/Editor/Volume/VolumeComponentListEditor.cs:225)
    UnityEditor.Rendering.VolumeEditor.OnInspectorGUI () (at Library/PackageCache/com.unity.render-pipelines.core@7.1.7/Editor/Volume/VolumeEditor.cs:194)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass55_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <83a73882c51c4602b3d34743827d03e7>:0)
    UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr)

    2)
    Assertion failed on expression: 'ValidTRS()'
    UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr)

    3)
    d3d12: Couldn't set a Render Target resource in Ray Tracing Shader. The resource is not created!

    What are these? Are they to be expected? Of I am getting the minimaps error as well, but that we knew.

    Thanks!
     
  3. freenomon

    freenomon

    Joined:
    Mar 21, 2019
    Posts:
    35
    Those renderings are looking cool. So raytraced softshadows and reflections all work fine now? which version of unity is it and using 7.15?
     
  4. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    474
    No, they do not work fine.
     
  5. QnRA

    QnRA

    Joined:
    Nov 28, 2013
    Posts:
    4
    Any idea why my ray traced sky reflections get very noisy if material smoothness is less than 1?

    Floor smoothness = 1


    Floor smoothness = 0.8
     
    Last edited: Jan 15, 2020
  6. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,501
    Ray are less coherent and more scattered, you need more ray to converge, that's to be expected.
     
  7. QnRA

    QnRA

    Joined:
    Nov 28, 2013
    Posts:
    4
    Thanks for the response. Do you know how could I do that?
    Is there an option in Unity to set number of rays?
     
    Last edited: Jan 15, 2020
  8. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    571
    Give a message when you get close to the HDRP Realtime Reflection Probes quality.
    https://www.artstation.com/artwork/k4mB8y
    So you can also MSAA the Reflection content to get some really nice closeups.
    Interieur greatly benefits from DXR overrides. For the Exterior the classical way is still in the lead.
    For now i switch these methods for Interior and Exterior cameras.
     
    Last edited: Jan 15, 2020
    jeremedia and QnRA like this.
  9. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    Will Unity raytracing become hardware agnostic in time ?
     
    hippocoder likes this.
  10. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,501
    depend on what you mean by hardware agnostic, probably if you mean outside of hardware accelerated RT, probably not if you mean outside of compute capable gpu. But i'm no unity.
     
  11. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    474
    When comes the next update for DXR?
    Will it solve the all crashes and things not working in build?
     
    sinaari likes this.
  12. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,733
    Last edited: Feb 26, 2020
    sinaari and Lex4art like this.
  13. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    474
    Can't find that Raytracing now works in builds with 7.2.0 in the log.
     
  14. konsic

    konsic

    Joined:
    Oct 19, 2015
    Posts:
    995
    That runs on AMD.
     
  15. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,733
    You'll not find entry like that. But for example on my DXR reflection issue on builds is fixed by this from the changelist:

    - Disable Async for SSR, SSAO and Contact shadow when aggregated ray tracing frame setting is on.

    if you browse through that 7.2.0 changelist, it's huge and contains tons of DXR fixes. It'll not fix everything but DXR is still experimental too so don't expect anything production ready.
     
  16. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    474
    Well, I would like to know if I can ship a demo of my project, which will be presetend to the audience at the beginning of February, with hardware raytracing enabled. Right now we sit on our new brought devices with RTX cards and can't do much with them with Unity. We get far better results with Unreal's RTX solution. Nevertheless I have to say, that both Unity and Unreal have random crashes with RTX enabled. Would be awesome to promote RTX support for our game to the audience. We already have a switch to enable RTX included to our game's setting menu. But I have to disable it.
     
    Last edited: Jan 16, 2020
  17. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    252
    Got it working in build on 7.1.7 when only ray traced Global Illumination was enabled (it's always in heavy Tier 2 mode, though), if ray traced reflections were added - black screen in build. Didn't test other ray tracing features (AO, shadows, recursive rendering) in build.
     
  18. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    474
    That is sad. For one of my projects, I just want to use DXR shadows, but for the other one, I want to have the DXR reflections. As someelse and me wrote in this thread with attached screenshots, the reflections do not work in build and related meshes disappear completely from the scene.
     
  19. jeremedia

    jeremedia

    Joined:
    Apr 21, 2015
    Posts:
    28
    Amazing results. Would you mine sharing a screenshot(s) of your relevant HDRP settings, as you do in your Bakery posts?
     
  20. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    571
    Hey. In which seetings you are interessted in?
     
  21. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    571
    Does anyone now an elegant scripting solution to diable/enable raytracing for all active and non-active lightsources in the scene.
    I have a lot of light sets and i can onlyenable/disable raytracing for the active ones.
    For demo purposes i have to switch all lightsources in the scene.
     
  22. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    38
    We have been focusing lately a lot on increasing the stability and polishing the ray tracing feature we had (add adding new features). the next package should solve most of the problems that were mentioned in this thread.
     
    elbows and Lex4art like this.
  23. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    38
    Do you have a denoiser active on your ssr volume component? if yes. What is the radius value that you are using?
     
  24. wesm

    wesm

    Allegorithmic Community Manager

    Joined:
    Feb 24, 2014
    Posts:
    302
    I can't seem to get raytracing to work. I ran through the wizard for HDRP+DXR and have all green checks. I've enabled raytracing and screen space shadows in the settings. However, if I activate raytracing on my directional light and set the ground material shader to Raytracing Render pass, the ground is no longer rendered. I don't think raytracing is working at all in my scene as I also get no effect from AO or GI. I'm thinking it must be something I am doing incorrect or don't have enabled.

    I have a 2070 RTX with Max-Q and updated the drivers. Could the card not be supported?
     
  25. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,733
    RTX 2070 is definitely supported. You don't need to use "Raytracing Render pass" from shaders for most raytracing effects.

    Also current HDRP state is bit confusing as there are so many settings around but HDRP Wizard should catch most basic things. For screenspace shadows make sure you have that setting enabled on Player Settings -> HDRP Default Settings -> Frame Settings -> Lighting -> Screen Space Shadows
     
    Last edited: Feb 26, 2020
    wesm likes this.
  26. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    38
    @rizu Ray Tracing render pass allow objects to be rendered with recursive rendering. It was previously discussed in this thread https://forum.unity.com/threads/unity-experimental-hdrp-dxr.656092/#post-4395532 and it is referenced in the documentation https://docs.unity3d.com/Packages/c...1/manual/Ray-Tracing-Recursive-Rendering.html if you need more info

    @wesm you must have missed a step from the getting started with ray tracing documentation https://docs.unity3d.com/Packages/c...n@7.1/manual/Ray-Tracing-Getting-Started.html . Otherwise, if it is a machine configuration problem, have you tried opening the template scene that is pre-configured https://github.com/Unity-Technologies/SmallOfficeRayTracing
     
    rz_0lento likes this.
  27. Migueljb

    Migueljb

    Joined:
    Feb 27, 2008
    Posts:
    525
    Why is the ray tracing demo in 2020.1? How do I get the 2019.3 demo for that instead. What if you have no interest in moving up to that version until its stable and production ready.
     
  28. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    38
    the current master branch is compatible with both 2020.1 and 2019.3
     
  29. wesm

    wesm

    Allegorithmic Community Manager

    Joined:
    Feb 24, 2014
    Posts:
    302
    Thanks! I was able to get it working. Not sure what it was but it just started working. I guessing user error on my part somewhere. : )
     
  30. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    474
    With HDRP 7.1.8., DXR is still crashing randomly in my Editor.
    Will that still be the case with HDRP 7.2.0.?
    Anyone from Unity who can explain why this happen? I'm using a RTX 2060.
     
  31. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    38
    @wesm glad that you got it working!

    @Bordeaux_Fox We found and have a patch for the latest crashes that we were able to reproduce on a regular basis. They are not merged yet (it's on the engine side), you will get them into a patched 2019.3 version or an upcoming 2020.1 version.
     
  32. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    474
    Ok, I hope it get's better. But I think the crashed are also tied to DirectX 12, which is also in an experimental state. I also get random crashed without DXR, when I switch back to DirectX 11, everything is fine. I tried both, the Game and the Studio Nvidia drivers for my RTX. Also disabled MSI Afterburner.

    Also, is it true that you should disable Asnyc Compute in the cameras frame settings to get more stabilty for DXR? One user here mentioned that but I cannot find that statement in the official package docs. I know turn off static batching is important and also did that.
     
  33. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    252
    Quite stable for me, except when it's runs out of free video memory (and even with 11GB videocard this happens time to time on quite empty city scene with only 500MB of materials). Guess 6GB VRAM on RTX 2060 may be bottleneck after scenes becomes a bit more complex. Technically, system RAM should be used in that case but this way is not stable it seems.
     
  34. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    474
    I have 32 GB RAM and yes, for the RTX 2060 it is 6 GB VRAM. Well, I tested it just with some simple scene with basic walls, only one small appartment. But when Call of Duty Modern Warfare and Metro Exodus runs with Raytracing, then I don't know if VRAM is the issue ...
    I mean it is advertised to RUN hardware raytracing and I have the right gfx card generation. Also I'm aware of that cannot have all effects enabled at the same time. I'm just interested in the reflections for mirrors and transparent materials. Everything else is acceptable for me with the old techniques.
    So all in all, if everything just works with a RTX Titan, then you developing for 0,001% of customers and very rich people.
     
    Last edited: Jan 31, 2020
  35. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,733
    I only today found out that DXR actually works when running HDRP in forward-only mode as well, after watching old Unity DXR talks I assumed it was possible to only use deferred.

    Anyway, all DXR effects I tried (GI, AO, reflections, shadows) worked just fine on forward-only and all but reflections worked even with MSAA enabled.

    I'm aware that there are currently graphical artifacts with regular SSR when used with MSAA and this combo is therefore disabled in code. I do wonder if there's similar restriction for DXR reflections tho as it's a different technique? I tried to manually bypass the msaa check on SSR but it only affected the non-RT version of SSR, RT reflections still remained disabled with MSAA. @auzaiffe you wouldn't happen to have any info about the DXR reflections on forward and MSAA, is it doable?

    EDIT: did some digging, if you have MSAA enabled and have bypassed the SSR's own msaa check, it breaks DXR reflection (when using Quality settings preset) on RaytracingReflections.raytrace at line 74. If I comment this check out or only check for _SsrStencilBit, it does render DXR reflections with MSAA enabled.

    My changes to test this are here: https://github.com/0lento/ScriptableRenderPipeline/commit/8413992ef7d58a34f8c8ad9266faf04f5d118ebd. Do note that this only works with DXR reflections set to quality mode, it's still broken on perf mode (probably related to how stencil buffers are handled with MSAA). And even the quality one is not all proper as the reflections seem to have sort of delay when MSAA is enabled.
     
    Last edited: Feb 7, 2020
    keeponshading and wetcircuit like this.
  36. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,733
    Additionally, curious what's the state of VFX with Unity's DXR? I mean, I know it doesn't work on current bleeding edge (2020.1.0a22 and HDRP/staging from github), but I'm curious if this is something Unity plans to support during 2020 cycle?

    I briefly tested both visual effects graph and shuriken system with HDRP particle shaders and neither did show up on DXR reflections.
     
  37. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    571
    Good find and question.
    • HDRP Forward MSAA ´+ SSR
      and
    • HDRP Forward MSAA + TAA + DXR all in.
    Are these technically impossible or is it only currently not implemented?
     
  38. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,733
    Apparently combo MSAA + reflections is still iffy, rest seems to work somewhat the same as on deferred. I'd love to hear staff comment on the DXR reflections on this though as my quick hack clearly didn't take all needed things into account nor do I know about HDRP internal enough to even start guessing if this can be properly fixed with reasonable work amount.
     
  39. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    38
    @rizu there is no plan to support "properly" MSAA and DXR features in the near future.
     
  40. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,733
    Thanks for the answer, I guess I'll not pursue this path then despite the MSAA looking really nice with DXR (when it works).

    The obvious alternative TAA does fix lot of fine noise on DXR but it's also causing a lot of ghosting which makes it less practical in game use so trying to think of alternatives here.
     
  41. JuliusIbidus

    JuliusIbidus

    Joined:
    Jun 3, 2018
    Posts:
    43
    Hello, I cloned the SmallOfficeRayTracing project (master), followed the Getting Started manual (using Unity 2019.3.0f6), everything seems to be set up correctly, yet there is a missing script for the RaytracingEnvironment game object. Any ideas why this may be missing? RaytracingEnvironmentMissingScript_1.jpg
     
  42. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    718
    That isn't used anymore. It was introduced in the early stages of the implementation but now that's been deprecated for a better/integrated setup in the Volume system. I guess they forgot to remove the script/gameobject it was attached to.
     
  43. JuliusIbidus

    JuliusIbidus

    Joined:
    Jun 3, 2018
    Posts:
    43
    @Grimreaper358 Many thanks for the response. I had another question regarding the Rendering Pass setting for individual game objects. When I change the Rendering Pass setting to Ray Tracing, it doesn't seem to be working properly (see pic, the chair is not rendering correctly). Is this something I may have missed in the Project Settings or another part of the setup? RenderingPass_1.jpg
     
  44. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    718
    Everything in the scene receives raytracing by default except transparent objects. Those you switch to Raytracing Render Pass and add a Recursive rendering component to a volume and activate it. Everything else runs on the default setting fine (well everything currently supported by raytracing so no terrain or particles yet)
     
  45. JuliusIbidus

    JuliusIbidus

    Joined:
    Jun 3, 2018
    Posts:
    43
    @Grimreaper358 When you say: 'add a Recursive rendering component to a volume and activate it', I don't think I'm following this. Is the volume you refer to a new game object, or something attached to an existing game object?
     
  46. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    718
    Something already in the scene.
    In your scene, there's a Rendering Settings game object under Environment in the hierarchy. You can add it to that. In the inspector, you'll see the volume component and an Add Override button. Select that and got to Raytracing and choose Recursive rendering. Additionally, you can check the other game objects there to see if they already contain that volume override. In general, raytracing works by default. Just enable the effects and they work.
    That scene should already be configured but I'm not 100% sure if they've already done that before you got it from Github.
     
  47. JuliusIbidus

    JuliusIbidus

    Joined:
    Jun 3, 2018
    Posts:
    43
    Hmm, when I add Recursive Rendering to the Add Override (on the Environment game object), I get an error message: 'The current HDRP asset does not support Recursive Rendering'. I also was assuming that the scene was pre-configured but when I changed the Render Pass on game object they turn into 'reflective' surfaces (as show in above pic). But as you say, it is automatically enabled in the scene, just curious why changing the Render Pass setting does this.
     
  48. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    252
    It works only with Tier 2 mode of Ray Tracing (link).
     
  49. JuliusIbidus

    JuliusIbidus

    Joined:
    Jun 3, 2018
    Posts:
    43
    @Lex4art Thanks for the response, I'll have a look at that.
     
  50. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    1,733
unityunity