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
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official Unity Experimental HDRP DXR

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

  1. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    It turns black no matter which light source I use.
     
  2. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    The feature works in some cases at least, there is automated tests for that. You must have hit a configuration that we did not cover. Can you fill a bug so that we can look at it? thank you
     
  3. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    auzaiffe
    I agree: ray tracing/GI and GPU ...not so good combination :eek:
    Anyway I solved temorary problem with windows glass and background ...trick of course, but works well.
    Only issue is to get proper reflection from those windows. I do not like fake solutions, but in this case for now, Reflection Probe on board :(

    About background sampling problem...I will wait when you will release Importance...then will check it again.
    For now I use fake background.

    You should add to the features RTX list also easy raytracing/shadow flags:
    img_001.jpg

    Without those work is very difficult.
     
  4. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    Working (testing) on this scene now. Is empty because I just started.
    SSAA_20200630_23514751_1080p.png SSAA_20200630_23533945_1080p.png SSAA_20200630_23555215_1080p.png SSAA_20200630_23585587_1080p.png
     
    Gametyme and newguy123 like this.
  5. auzaiffe

    auzaiffe

    Unity Technologies

    Joined:
    Sep 4, 2018
    Posts:
    255
    There is the layer mask system on the volume component that allows you to control which objects are seen in which effect (ignore objects in shadows, in reflections and that is quite equivalent to the screenshot you shared. Transparent surfaces require recursivity to display properly (refraction).

    That said you can have proper reflections on windows using ray traced reflections on transparent objects
     
  6. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Working on a character. A quick material test with almost every RTX feature enabled.
     
    Last edited: Jul 1, 2020
  7. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    auzaiffe here post process bug in latest beta 2020:
    Lift.gif
     
  8. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    auzaiffe there is still problem with glass and pass through objects/background when I activate raytracing.
    I tried many options but not success. I will wait for next DXR update.
    img_001.jpg
     
  9. TheProfessor

    TheProfessor

    Joined:
    Nov 2, 2014
    Posts:
    74
    How would I go about making a bare bones minimum scene where I write a ray tracing compute shader that would take advantage of the hardware real time ray tracing capabilities of the RTX2080 in Unity3D? I was following this tutorial http://three-eyed-games.com/2018/05/03/gpu-ray-tracing-in-unity-part-1/ in a base 3D scene but I'd like to take my ray tracing compute shader and take advantage of the hardware? Like what if I don't want to bother with the scene settings and just want to do everything hardcoded in the shader or passed in via a C# script?

    In the siggraph pdf: https://on-demand.gputechconf.com/s...started-with-directx-ray-tracing-in-unity.pdf there's a section about "shader authoring" but it can't be copied/pasted without issues/syntax errors/undefined errors, is there a tutorial somewhere?
     
    Last edited: Jul 2, 2020
  10. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    169
    You can try this simple ray traced test scene from BuiltInRP_RayTracingTest.zip. We currently don't support ray tracing from compute shaders (DXR 1.1 support is under development) but this scene uses ray tracing shaders (DXR 1.0). You can check some files like RayTracingTest.raytrace, Diffuse.shader or RayTracingTest.cs. Note that Scene View looks unshaded because the shaders don't really do anything for normal rasterization but if you go to Game View, the scene is completely ray traced. The camera doesn't really render/rasterize anything in Game View. In HLSL there's a function called TraceRay that I use in my shader code (check RayTracingTest.raytrace) and this is actually using ray tracing cores to do acceleration structure traversal + triangle intersection and some more. You can Play the scene and the teapot will rotate and you can navigate using WASD buttons+ hold right mouse button. You just need to have Windows 10 version 1809 or above.
     

    Attached Files:

  11. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    some updates:
    SSAA_20200703_00205095_1080p.png SSAA_20200703_00221596_1080p.png SSAA_20200703_00273206_1080p.png SSAA_20200703_00201622_1080p.png SSAA_20200703_00205095_1080p.png
     
    newguy123 and INedelcu like this.
  12. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    SSAA_20200703_00385086_1080p.png SSAA_20200703_00501978_1080p.png SSAA_20200703_00273206_1080p.png
     
    Last edited: Jul 3, 2020
    newguy123 and INedelcu like this.
  13. TheProfessor

    TheProfessor

    Joined:
    Nov 2, 2014
    Posts:
    74
    I can't seem to open your attached unity project, UnityHub says "version unavailable". I have 2019.4.1f1 installed.

    edit: I reinstalled Unity Hub and now it works (seems like it didn't like it when I uninstalled my older versions of Unity.

    Thanks for this! I think this is exactly what I am looking for! How to write a .raytrace shader seems to have not much tutorials about it.
     
    Last edited: Jul 3, 2020
  14. TheProfessor

    TheProfessor

    Joined:
    Nov 2, 2014
    Posts:
    74
    Hrm, the teapot is actually *not* rotating for me. I see in the scene view it is rotating, but the game view after clicking play there is no rotation. Is this possibly because I am running with the GTX 1080? Is the fall back not working? Every is rendering just no changes in the transforms of the objects in the scene.
     
  15. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    169
    Sorry for the trouble with the rotation. It's because I sent you my project that I'm running locally in 2020.2 where RayTracingAccelerationStructure.Update was deprecated and replaced with RayTracingAccelerationStructure.Build. In 2019.4 you can fix the rotation by replacing back raytracingAccelerationStructure.Build(); with raytracingAccelerationStructure.Update(); in RayTracingTest.cs - OnRenderImage function. I updated the zip with the project in 2019.4.2f1 but changing that line in OnRenderImage should be enough.
    GTX 1080 supports ray tracing shaders.
    raytrace files are HLSL code. You can find some general documentation here https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-reference and for DXR specification here https://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html
     

    Attached Files:

  16. TheProfessor

    TheProfessor

    Joined:
    Nov 2, 2014
    Posts:
    74

    Perfect! This works for me now! I was looking through the shaders and was confused at what could possible have been wrong. :D Thanks for the links, I will look into them.

    Out of curiosity, what is the principle difference between the DXR raytracing and the compute shader ray tracing here? http://three-eyed-games.com/2018/05/03/gpu-ray-tracing-in-unity-part-1/

    e: Other than the fact that the DXR one uses accelerated structures.
     
    Last edited: Jul 3, 2020
  17. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    Update:
    SSAA_20200703_23524190_1080p.png SSAA_20200704_00144180_1080p.png SSAA_20200703_23380013_1080p.png SSAA_20200703_23470146_1080p.png SSAA_20200703_23485111_1080p.png
     
    newguy123 likes this.
  18. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
  19. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    Looking great Janusz_Biela. Are you placing reflection probes and guessing the right intensity for now? I tried playing with it but it feels too hacky. I do get rather weird artifacts when there are no reflection probes in the scene, though. I didn't have those problems a couple of months ago.

    Edit
    Better examples of the DXR issue on p17.

    I decided to make yesterday's HDRP/staging compatible with 2020.2.0a15. I also merged all open render graph PR's including RTAO locally and tried Virtual Texturing in combination with DXR.



    I like the idea of using 8k/16k virtual texturing with DXR. There seems to be a minor issue with the size sometimes not updating in ray traced reflections, but nothing big.
     
    Last edited: Jul 16, 2020
  20. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    m0nsky I do not use any fake reflection. Pure raytracing only. Of course this is no solution right now: reflected scene in surfaces has no GI, but is no so bad.
     
  21. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    m0nsky please do not use default HDRP settings (default UNITY example scene). This is gaming setup no raytracing/GI rendering....
     
  22. m0nsky

    m0nsky

    Joined:
    Dec 9, 2015
    Posts:
    257
    I'm targeting gaming, I'm not using path tracing.
     
  23. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Are there any foilage plugins, or plant scattering plugins, that work with DXR?
     
  24. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    Finally I made off line render video FullHD/60fps. There is a lot errors in animation (still learning!!!, bugs, etc ) but I hope in future we get clean up with those.Waiting for developers with new DXR update ;)
    No bake, no fake reflections, quality textures 4096 pix, my original models from Lightwave 3D without exporting and PURE RTX features.
    13 Physical Lights in scene, no LEM.
    I do not care about time render (it was around 0.2-0.5 sec/frame)...still hundreds times faster than CPU rendering with my Dual Xeon.

    The quality is not yet like CPU rendering but with developing time we will get only better and closer.

     
    hkostic, sendspace, INedelcu and 3 others like this.
  25. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    This is looking awesome @Janusz_Biela
    What did you use to create the offline render? Simply Unity Recorder, or a 3rd party asset? Can it do 360 output?

    Beyond that, my only critique would be the camera animation curve need to be linear, instead of the current start/stop of the camera between shots.
     
  26. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    I use 3rd part software, professional plugin: Video Capture Pro (very nice and cooperative developer, we try together push his plugin up)
    It is very easy plugin, works even in Unity 2020, offers great codecs include HEVC, has nice and flexible options, include 360 panorama.

    Thats why I wait for his next update according Cinemachine support. This is only test , because I did not learn yet system in unity. I am Lightwave 3D guy where animation system is TOP ONE World and jumping from LW to Unity animation system is for me shocking painful ...how system can be not friendly and not necessary complicate.
     
    newguy123 likes this.
  27. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    INedelcu when we can expect next DXR core update?
     
  28. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    169
  29. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    Thanks, finally I got it!
    Here example:
    - background excluded from GI and cast shadows (so it blocks Sun light - just for test)
    - One Area Light from window is enable for GI purposes but excluded from reflection (Direct Specular Lighting is disable)
    - background I have to put in Static Raytracing ... No idea for what this option is . But with this option works.
    img_002.jpg

    Now I get what I want ;)
    I excluded GI from sphere by Ray length in GI (simply is not in range)

    img_001.jpg
     
  30. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    169
    The Ray Tracing Mode in the Renderer settings is to specify how a Renderer will interact with the ray tracing acceleration structure updates but is also a filter.

    Off - will not be part of the acceleration structure meaning it won't affect any ray tracing effect and the rays won't intersect it (e.g. will be missing from ray traced reflections, AO, etc).
    Static - you promise the Game Object won't change its transform (just an optimization).
    Dynamic Transform - the transform of the GO will change but the geometry itself is static (no deformations). This is the default option for Mesh Renderers.
    Dynamic Geometry - the geometry (and the Transform) will change - this is useful for animations (from 2020.1). This is the default option for Skinned Mesh Renderers. If Alembic vertex caches are used this option has to be used. In this case, the acceleration structure will be updated every frame.
     
    keeponshading likes this.
  31. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    INedelcu
    Thanks for info.

    It is possible to improve GI reflection surfaces?
    img_001.jpg
     

    Attached Files:

  32. INedelcu

    INedelcu

    Unity Technologies

    Joined:
    Jul 14, 2015
    Posts:
    169
    @Janusz_Biela I work on the low level RT support, I don't write shaders or HDRP code / effects. @auzaiffe can answer HDRP related questions.
     
  33. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    Noticed. Thanks !
    ...so @auzaiffe how to deal with lack of GI samples in reflection surfaces?
     
  34. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    937
    Hi, some feedback to the Probe Volumes.
    If Display Volumes is active the Edditor is crashing after going to play.
    in
    Unity 2020.1.0b15_HDRP_9_0_0_preview33

    Unity 2020.1.0b14_HDRP_9_0_0_preview33 was fine.

    I am really happy with the experiental implementation.

    Does anyone has some experience with baking probe volumes and to switch them with materials...

    Probably with
    https://github.com/Unity-Technologies/com.unity.material-switch
    would be nice.
     
    Last edited: Jul 10, 2020
  35. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    937
    Another question
    When i enable path tracing per ui i have a jitter when TAA is enabled as long the pathracing is sampling.
    Is there a workaround?
     
  36. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    937

    Thanks for the info.

    Could you give me some detailed inside towards this use case.
    In special
    • Raytraced Reflections
    • Raytraced Shadows
    • Raytraced GI
    for a moving car.

    I cannot wrap my head around the acceleration structures and probe volumes when they are moved with car physics.
    Main target is correct reflections and shadows.

    Raytracing runs layered like
    • Road - Static, Raytraced Reflections, Raytraced Shadows

      Car is moved with vehicle physics
    • Car Exterieur, moved Raytraced Reflections, Raytraced Shadows
    • Car Exterieur Lamps, +Recursive Raytracing
    • Car Interieur, Raytraced Reflections, Raytraced Shadows, Raytraced AO,
    • Car Interieur glas decor +Recursive Raytracing
    and moving a Probe Volume with the car,
    • outer probes for exterieur raytraced GI,
    • probes from the volume inside the car for raytraced GI for interieur
     
  37. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    This is scene which I use only for testing:
    SSAA_20200710_23401049_1080p.png SSAA_20200710_23311316_1080p.png SSAA_20200710_23341144_1080p.png SSAA_20200710_23344685_1080p.png SSAA_20200710_23384991_1080p.png
     
  38. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
  39. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Are all these done with pathtracing @Janusz_Biela ?
    Whats your typical settings?
    Do you bake, or using realtime GI? (Any screenspace GI?)
     
  40. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    newguy123 I use only Path Tracing, no bake, no fake reflections....I do not even select Static option for objects.
     
  41. Bordeaux_Fox

    Bordeaux_Fox

    Joined:
    Nov 14, 2018
    Posts:
    589
    Still, there is a lot of noise in the dark areas. What are your settings?
     
  42. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    ...because of medium setup. I did not focused on quality...this is scene for testing some new skills and options.
    That`s why also I put pure white wall color to see setup parameters. Do not worry about this noise: with textures will be invisible.
     
  43. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    I just wanted to see how looks Cornell Box in Unity. Is not so bad! :)
    Good balance, correct color gradient.
    Only some issues with bottom part of boxes.
    image_2020-07-13_12-34-35.png
     
    INedelcu, sendspace and Lex4art like this.
  44. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    The biggest problem with DXR: GI sampling in reflected surfaces (missing Unity feature)
    before:
    image_2020-07-13_23-08-56.png image_2020-07-13_23-09-58.png

    After (my primitive idea ;)):
    image_2020-07-13_23-08-38.png image_2020-07-13_23-09-45.png
     
  45. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    I work on new WiP. This time after many weeks of testing and creating pipe line for Lightwave 3D I start be more serious with UNITY and DXR:
    image_2020-07-15_14-48-36.png image_2020-07-15_14-48-46.png image_2020-07-15_14-49-04.png image_2020-07-15_14-49-28.png image_2020-07-15_14-49-39.png
     
    Lex4art likes this.
  46. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
  47. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    @Janusz_Biela and these are without unwrapping or baking or any such nonsense?

    Also, the only light is the one generated from that HDRI on the outside? Or how are you getting light into the room?
     
  48. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    newguy123 this is pure DXR Raytracing. There is no surfaces yet...soon, I just setup light.
    About HDRi: I am against to use HDRi at all in renderings because this is not clean light source. I never used HDRi in my history. If you want use HDRi: only for reflection purposes, nothing else. I always suggest physical light + Sun and I always use it.

    Now using background as light source in Unity (DXR) has no sense. Missing importance and LightPortals. We must wait for update from developers.
     
  49. Yanus3D

    Yanus3D

    Joined:
    May 6, 2019
    Posts:
    490
    Preview with basic surfacing. Soon I will add my Nodes.

    image_2020-07-15_23-37-50.png image_2020-07-15_23-32-21.png image_2020-07-15_23-33-55.png image_2020-07-15_23-34-48.png image_2020-07-15_23-35-21.png
     
    m0nsky, INedelcu, petersx and 2 others like this.
  50. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    @Janusz_Biela So all you do is in the post processing volume, add a Pathtracing override? Is that it?


    So in Unity terms, this is directional light (sun) together with skylight (the environment), is that correct?