Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Official Unity Experimental HDRP DXR

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

  1. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I think I found a shadow bug that affects all recent github versions that we can try with DXR in 2019.3 alphas, including active code work done in recent days:

    Raytraced shadows break in play mode if more than one object in the scene is set to static.

    They look fine if looking at game view when play mode is not activated. They look fine if there are no gameobjects set to static, or if only 1 is set to static. When more than one static object exists, shadows are still being drawn but in totally the wrong place/from the wrong angles.

    I mostly tested using shadows from a directional light, using HDRP/staging with 2019.3a12. I've had the issue before, but back then I had not figured out what caused it to show itself or not.
     
  2. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Other than that, its looking pretty tasty these days :)

    I'm rather forgiving of stability issues because I know some will be fixed in future editor alpha/beta updates, and this DXR stuff is freshly motivating people to try DX12 with Unity, which I am assuming is a graphics API that hasnt received maximum stability improvements in its life yet due to lots of people never using it. And so I would expect work in that area to be ongoing for quite a long time.
     
  3. freenomon

    freenomon

    Joined:
    Mar 21, 2019
    Posts:
    35
    Are you able to get soft raytraced shadows from pointlights and directional lights? and also RTAO? and reflections? would be awesome if you can post some screen shots. I did modify the "ShaderConfig" file and set the #define SHADEROPTIONS_RAYTRACING (1). Put RTGI in Postprocessing and also made a new object and added RaytracingEnvironment component as well. But I still don't see any difference in my scenes besides it bringing down my frame rate (I'm using 2080ti). Would love to see raytraced shadows and AO..
     
    Last edited: Aug 27, 2019
  4. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I definitely get RT shadows, reflections, GI and recursive rendering on 2019.3.0.a12 and HDRP/staging from github. Not sure how soft those RT shadows are tho and I only get them for directional light I think. Do note that while I get visible effects, it's still pretty crash happy but this is known already by Unity and they are working on the issues.

    If you have issues making any RT effects visible, make sure you run the HDRP Wizard and fix all issues with HDRP + DXR setup. Also make sure your assets have raytracing enabled. And try wiping your projects library folder to clear the old cache.
     
  5. freenomon

    freenomon

    Joined:
    Mar 21, 2019
    Posts:
    35
    "I definitely get RT shadows, reflections, GI and recursive rendering on 2019.3.0.a12 and HDRP/staging from github. "

    Thanks for your quick reply. I didn't get anything from github.. Just using standard Unity 2019.3.0a12 and it's HDRP that came with it. Yes I enabled all check boxes in HDRP Wizard.

    A couple of questions:

    1. How do you "enable raytracing" for my assets? (you mean all geometries and lights?) Do I add the HD Raytracing Component to all of them? Or do you mean the a'Ray Tracing Mode' found inside Mesh Renderer?

    2. Should I turn off the Shadow Map for lights?
     
  6. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    If it helps, I can make a small test project with things setup for DXR out of the box with current hdrp/staging (or master if the merge it before I get it done).
     
  7. freenomon

    freenomon

    Joined:
    Mar 21, 2019
    Posts:
    35
    That would be great.. if you can test with the current out of the box version. I am really itching to see the UNITY DXR effects.. I've done UE4 Raytracing and really love their RTAO, softshadows and reflections. GI is still bit slow. I really want to see how Unity RT compares.

    Do you have skype? Would be great if you can point me in the right direction for me to get this working.. I have two 20180ti founders in my pc and can't even get RT working in Unity. darn
     
  8. freenomon

    freenomon

    Joined:
    Mar 21, 2019
    Posts:
    35
    upload_2019-8-27_12-31-34.png
    View attachment 473909
    as you can see, I get no GI, and the shadows are plain directinal Light's shadowmap shadow.
     
  9. freenomon

    freenomon

    Joined:
    Mar 21, 2019
    Posts:
    35
    Is This the right file?
    upload_2019-8-27_12-35-7.png
    upload_2019-8-27_12-35-52.png
     
  10. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    You need to enable GI effects in the Frame settings. Edit -> Project Settings -> HDRP Default Settings -> Lighting
    upload_2019-8-27_2-0-58.png
    Under Rendering - Enable Ray Tracing
    Under Lighting - Enable Screen Space Shadows and Screen Space Reflections

    On the HD Pipeline Asset Enable Screenspace Shadows, and Screen Space Reflections. After those are enabled you can Enable them in the Frame settings as well.

    Raytracing for some effects is an override
    Reflections - require the SSR Effect to be enabled on the Pipeline asset as well as added as an effect on your Volume and enable raytraced Reflections
    AO - added to your Volume and enable Raytraced AO
     
    Lex4art likes this.
  11. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Hopefully the excellent help given by others will get you up and running.

    I'm not sure what their point light plans are for raytracing, if any, I didnt investigate that at all yet, and for now I prefer to use area lights & a directional light.
     
  12. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Regarding point lights, I kinda jumped to the 2019.3 setup but they werent supported on experimental 2019.2.0a5 DXR editor? That scene definitely had raytraced shadows and it mainly consists of point lights for the light sources.
     
  13. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I forget, certainly the documentation for that version only mentioned area lights, and the area light with video texture on it was a focal point of the demo scene (just like it was in the car demo they used to show off DXR stuff in presentations). I will check what the actual reality was with that version when I get a chance.
     
  14. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I had a quick look and although a few of the point lights in the scene have shadows turned on, nothing makes me think those lights have raytraced shadows. The area light has raytraced shadows.

    Anyway enough of that old version, 2019.3 beta is out so I shall give that a go shortly :)
     
  15. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Did you run it and toggle the RT shadows on from the UI? The chair shadows definitely change and if I remember right, those shadows came from above light source, not from the TV.

    I don't have this editor version installed anymore so can't double check this, now focusing on 2019.3 only.
     
  16. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I wont have the old version installed for too much longer. But right now I do, so I can confirm what I said earlier - its the area light shadows that are ray-traced in that demo scene. And yes, the shadows from the point lights are still there, unchanged, if I toggle RT shadows from the demo UI. And there is no light component UI for point light raytraced shadows anyway, so I never expected it to work.

    The directional and rectangle area light shadow support in 2019.3 is all I need really, but I suppose I am still curious as to whether support for any other types is planned for the initial release.
     
  17. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    Has anyone managed to get raytraced area light shadows to work in the new version? I wanted to submit a bug report but I'm wondering if anyone else is facing the same issue. I'm getting the following error (on the latest alpha & beta editor)

     
  18. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    What HDRP version/github branch are you using?
     
  19. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    And yeah, they work for me, and I've not seen that error before.

    WaheyTracing.PNG
     
    Gametyme and OCASM like this.
  20. ikisarov

    ikisarov

    Joined:
    Mar 17, 2015
    Posts:
    11
    Tell me please how to enable ray tracing in Unity2019.3 HDRP 7.0.1?
     
  21. ikisarov

    ikisarov

    Joined:
    Mar 17, 2015
    Posts:
    11
    I figured it out. If suddenly someone will need to.
    Window --> Render Pipeline --> HD Render Pipeline Wizzard
    Fix DXR additional configuration
     
  22. unity_RuwGDfd2lVx01A

    unity_RuwGDfd2lVx01A

    Joined:
    Oct 25, 2017
    Posts:
    23
    I have done all of the necessary steps in order to get it working... However, many things aren't really functioning as intended.

    Things wrong:
    Raytraced reflections does nothing and completely blacks-out reflections while filtering is enabled
    Raytraced GI only works in the game window while the game is not playing (has no effect in-game)
    Raytraced shadows seem to work, I can't really tell
    Raytraced ambient occlusion does the same thing as GI

    Any help is greatly appreciated!
     
  23. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    So I have seemed to have turned on some of the ray-tracing features in the Volume Overrides sections and they have a pretty good framerate but then I noted a component called HD Raytracing Environment. As soon as I add this it just kills the framerate. Is this needed or is it an old script from previous versions?
     
  24. freenomon

    freenomon

    Joined:
    Mar 21, 2019
    Posts:
    35

    Thanks for the Tip.

    However, when I turn on SSshadows in HDRP Default settings, and then turn on Use Raytraced Shadows on an area light, the shadows goes away all together..

    upload_2019-8-28_15-23-40.png

    upload_2019-8-28_15-23-19.png
     
  25. freenomon

    freenomon

    Joined:
    Mar 21, 2019
    Posts:
    35
    Also, I don't think I am getting raytraced reflection, but just the old SSR.. and when/if I change the surface "Rendering Pass" to "Raytracing" the geometry just desappears.. weird.


    upload_2019-8-28_15-26-52.png

    upload_2019-8-28_15-27-13.png

    upload_2019-8-28_15-29-12.png

    So far, I can't get ANY raytracing effect. Maybe I'm doing something wrong with the Config file?
     

    Attached Files:

  26. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    They do "work" but they don't fix the exposure properly on old version so if you have like 10k light source and require exposure control, you'll get black reflections. This has been fixed on github already:
    https://github.com/Unity-Technologies/ScriptableRenderPipeline/pull/4383
     
  27. SKoptev

    SKoptev

    Joined:
    Jan 15, 2019
    Posts:
    37
    Sorry for duplicating post (https://forum.unity.com/threads/how-to-use-ray-tracing-in-2019-3-b.735308/), perhaps Unity/DXR graphics developers browsing this forum more often.

    I have reproduced all that steps (described in presentation https://on-demand.gputechconf.com/s...started-with-directx-ray-tracing-in-unity.pdf):
    • HDRP v.7.1.1
    • HD Render Pipeline Wizard: all statuses are green
    • Graphics API: DX12, GTX 2080ti videocard, fresh driver v.436.15 (08/27/2019)
    • Windows 10 Pro, v.1809
    • ShaderConfig.hlsl edited, #define SHADEROPTIONS_RAYTRACING (1)
    • Scripting define symbols: REALTIME_RAYTRACING_SUPPORT; ENABLE_RAYTRACING
    • Ray Tracing Environment component added to scene (all settings by default)
    Then, I created a new material (HDRP/Lit shader); added a sphere to the scene, with this material assigned.
    Finally, I change "rendering pass" parameter to "raytracing". Sphere just disappear.

    There is no visible raytracing effects at all. Also, there are errors in console: "d3d12: generating mipmaps for array textures is not yet supported."

    What else do I need to do to get a minimal working raytracing setup?

    Thanks!
     
    Last edited: Aug 28, 2019
    AntonioCVC, ElenaLLL, fuzzy3d and 3 others like this.
  28. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    My raytraced area light shadows seem to be flashing when no directional light is present in the scene.



    I've reported it through fogbugz (Case 1179953).

    If I enter play mode with a directional light in the scene, and then disable it, my raytraced area light shadows will keep working, however I enter playmode with the directional light disabled, there's no way to get them to work.

    Opening up the editor with the directional light disabled throws the "Property (_RayCountTexture) is not set" error, starting the editor with the directional light enabled fixes it. o_O
     
  29. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Latest Windows 10 platform update?

    As for project settings, I'm assembling a test scene later on today using latest HDRP master, will share a link once I have it up and running (still have other tasks before it).
     
    SKoptev likes this.
  30. ikisarov

    ikisarov

    Joined:
    Mar 17, 2015
    Posts:
    11
    No, set RenderPass = Default
     
    KarolisO likes this.
  31. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Tested Sponza with DXR GI + shadows:


    Kinda eyeballed the materials as the scene isn't PBR at all, a lot of things are still off.
     
  32. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    Have you seen this pull request (& associated branch) today? :) I am going to try it shortly.

    https://github.com/Unity-Technologies/ScriptableRenderPipeline/pull/4429
    https://github.com/Unity-Technologies/ScriptableRenderPipeline/tree/HDRP/RayTracedPointShadow
     
  33. fuzzy3d

    fuzzy3d

    Joined:
    Jun 17, 2009
    Posts:
    228
    +1
    Trying to set up new, clear scene with raytracing, no luck....
    Perpetual "d3d12: generating mipmaps for array textures is not yet supported." error.
     
    Last edited: Aug 28, 2019
    SKoptev likes this.
  34. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    This is "normal" at this stage, it doesn't stop it from running tho.Just enable collapse on the console so it doesn't flood it.
     
    fuzzy3d likes this.
  35. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I got point light ray traced shadows working using that branch.

    However, I think a line relating to future work to make spotlights work snuck in by accident, causing errors because the compute shader kernel its after does not exist in that branch.

    So as of the time of me writing this, you need to comment out the following line 74 of Runtime\Lighting\Shadow\ScreenSpaceShadowManager.cs when using that branch.

    // m_RaytracingSpotShadowSample = m_ScreenSpaceShadowsCS.FindKernel("RaytracingSpotShadowSample");
     
  36. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    You absolutely can start with a new scene. Its just a question of setting everything up properly in the scene and knowing what it takes to make specific ray-traced effects work. For example volume overrides for GI, AO, reflections. And for shadows, appropriate shadow settings on the lights, and Screen Space Shadows switched on in HDRP default settings (or camera 'custom frame settings').
     
  37. chudy

    chudy

    Joined:
    Jul 9, 2014
    Posts:
    1
    Set ShaderConfig.hlsl edited, #define SHADEROPTIONS_RAYTRACING (1) after opening editor and just save it
     
    nastacas and Lex4art like this.
  38. Lex4art

    Lex4art

    Joined:
    Nov 17, 2012
    Posts:
    445
    Thanks, this is it - after that it works, finally!
    RTXGIweeee.jpg
     
    Last edited: Aug 28, 2019
    OCASM likes this.
  39. unity_RuwGDfd2lVx01A

    unity_RuwGDfd2lVx01A

    Joined:
    Oct 25, 2017
    Posts:
    23
    Holy crap... Unity 2019.3 is just not ready at all! I imported HDRP 7.1.1 from the hdrp/staging branch and I can't even use HDRP now... the scene is completely grey and I get this error:

    System.NullReferenceException: Object reference not set to an instance of an object
    at UnityEngine.Experimental.Rendering.HighDefinition.HDTemporalFilter.Init (UnityEngine.Rendering.HighDefinition.HDRenderPipelineRayTracingResources rpRTResources, UnityEngine.Rendering.HighDefinition.SharedRTManager sharedRTManager) [0x00001] in C:\Users\BillGates\Desktop\ScriptableRenderPipeline-HDRP-staging\com.unity.render-pipelines.high-definition\Runtime\RenderPipeline\Raytracing\HDTemporalFilter.cs:25
    at UnityEngine.Rendering.HighDefinition.HDRaytracingManager.Init (UnityEngine.Rendering.HighDefinition.RenderPipelineSettings settings, UnityEngine.Rendering.HighDefinition.RenderPipelineResources rpResources, UnityEngine.Rendering.HighDefinition.HDRenderPipelineRayTracingResources rayTracingResources, UnityEngine.Rendering.HighDefinition.BlueNoise blueNoise, UnityEngine.Rendering.HighDefinition.HDRenderPipeline renderPipeline, UnityEngine.Rendering.HighDefinition.SharedRTManager sharedRTManager, UnityEngine.Rendering.HighDefinition.DebugDisplaySettings currentDebugDisplaySettings) [0x0005d] in C:\Users\BillGates\Desktop\ScriptableRenderPipeline-HDRP-staging\com.unity.render-pipelines.high-definition\Runtime\RenderPipeline\Raytracing\HDRaytracingManager.cs:142
    at UnityEngine.Rendering.HighDefinition.HDRenderPipeline..ctor (UnityEngine.Rendering.HighDefinition.HDRenderPipelineAsset asset, UnityEngine.Rendering.HighDefinition.HDRenderPipelineAsset defaultAsset) [0x008f4] in C:\Users\BillGates\Desktop\ScriptableRenderPipeline-HDRP-staging\com.unity.render-pipelines.high-definition\Runtime\RenderPipeline\HDRenderPipeline.cs:407
    at UnityEngine.Rendering.HighDefinition.HDRenderPipelineAsset.CreatePipeline () [0x00004] in C:\Users\BillGates\Desktop\ScriptableRenderPipeline-HDRP-staging\com.unity.render-pipelines.high-definition\Runtime\RenderPipeline\HDRenderPipelineAsset.cs:38
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)


    Caused by this line:
    pipeline = new HDRenderPipeline(this, HDRenderPipeline.defaultAsset);


    Apparently HDRP needs a default asset even though I set the asset in my project settings. I opened the HDRP wizard and everything including DXR stuff is checked. I even cleared my library cache and did the whole thing over again and still get this error. Also, there is a SEVERE memory leak when opening the HDRP wizard.

    EDIT: The memory leak happens regardless
    EDIT2: Fixed the problem above by setting the project asset to the one in the HDRPDefaultResources folder... But now I have the exact same problems as before o_O

    RT reflections don't do anything, and go completely black when "Denoise" is checked
     
    Last edited: Aug 28, 2019
  40. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Here are two test scenes with DXR setup out of the box (HDRP from current github SRP master included):
    https://github.com/0lento/Unity_DXR_Test

    It has that Sponza scene (materials just quickly modified for this, don't expect 100% accurate setup). I think I only configured DXR GI for this.

    Additionally, it also has HDRP Example scene where I removed/disabled all baked elements, including reflection probes. It uses bunch of DXR techs enabled, including reflections.
     
  41. unity_RuwGDfd2lVx01A

    unity_RuwGDfd2lVx01A

    Joined:
    Oct 25, 2017
    Posts:
    23
    I managed to get reflections working (somehow) I baked global illumination and now RT reflections work... weird

    EDIT: Reflections work but I get different result in scene view vs in-game

    scene view:


    in-game:


    In-game renders improperly for whatever reason.

    scene view:


    in-game:



    reflection settings:
     
    Last edited: Aug 29, 2019
  42. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I think this same issue can affect reflections too, and may be the same thing that some other people have mentioned in recent posts when they say their reflections arent working properly in play mode.

    Issue can be seen with the HDRP Example Sene in the project rizu made available earlier. Reflections etc can be fixed in play mode by making sure nothing in that scenes heirarchy is set to static, and then the results are suddenly correct for that scene.
     
  43. elbows

    elbows

    Joined:
    Nov 28, 2009
    Posts:
    2,502
    I had various problems with this project but I was tired, so I dont know if any of the problems were my mistake.

    Had some console errors to do with missing pipeline dll file. I got round this by using my own copy of the render pipeline etc packages instead.

    Sponza scene seemed to be missing all important scene models, but I didnt spend any time looking into this, I just moved on to the other scene. Lots of the raytracing stuff seemed to be switched off in this other scene, eg reflections werent using raytracing when I first loaded this scene.

    Anyway I already knew what settings to use and how to work around some issues I had, so I could still get that one scene to work. So I was able in the previous post to use this scene as another example of ray tracing bugs triggered in play mode when scene has some static objects.
     
  44. OCASM

    OCASM

    Joined:
    Jan 12, 2011
    Posts:
    328
    Nice. How does it compare to this demo, for example:



    Do you get indirect shadows? Does it support animated characters?
     
  45. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Oh snap, the Sponza was indeed missing the obj file, it was somehow taken out by the default Unity .gitignore despite no *.obj in there (?). Also that one DLL got ignored as well.

    I added these to the git repo, should work now, thanks for the report :)

    As for the DXR settings in HDRP example scene, they definitely are enabled by default for me so I wonder if some refs changed when you swapped the HDRP packages themselves(?). Also wow, the reflections were indeed broken now in play mode (I'm fairly certain it didn't happen on my original folder but I can see it happening on the fresh clone), I wonder if it's due to some broken refs there after I reorganized the folders. I now resaved the scene without static flags + fixed that one annoying missing SceneIdMap warning.

    I should have tested this on fresh clone, I just wiped library on the original and checked it would regenerate it.

    Anyway, if anyone grabbed https://github.com/0lento/Unity_DXR_Test last night, please try getting it again now :D
     
    Last edited: Aug 29, 2019
    fuzzy3d likes this.
  46. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    It doesn't look that fancy IMO, I didn't really try to tweak the GI itself much either, it's just one bounce on that image (but I didn't really get nice light bounce from the curtains either like on that video but it was just a quick test scene I added for testing).
    No idea on shadows, animations are definitely not supported by Unity's DXR on 2019.3 (it's listed on feats they don't support).
     
    OCASM likes this.
  47. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I also noticed that you don't get raytraced reflections for objects rendered through Hybrid Renderer with ECS. I have this hybrid scene where I have some objects on ECS side and they don't show up in the reflections.
     
  48. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Re: static flags, turned out that you can use static flags, you just need to remove the static batching from player settings first.
     
    elbows and SKoptev like this.
  49. wenzy

    wenzy

    Joined:
    Nov 17, 2015
    Posts:
    44
    u said under Rendering , chose the enable Ray Tracing,but I can't see any keywords like that in my editor.Did I miss any steps ,thank u
     
    freenomon likes this.
  50. Grimreaper358

    Grimreaper358

    Joined:
    Apr 8, 2013
    Posts:
    789
    In the image, you see the Rendering and Lighting dropdowns. (Currently under Lighting in the Image)
    You want to select the Rendering dropdown and look for Ray Tracing and make sure that is enabled

    Or you can follow the steps in this video
     
    soleron and Lex4art like this.