Search Unity

Graphics H-Trace: Global Illumination and Occlusion [ RELEASED ]

Discussion in 'Tools In Progress' started by Passeridae, Mar 11, 2022.

  1. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Thank you very much for your support! It means a lot! :)
     
    Gooren likes this.
  2. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    146
    Also interested in BiRP only
     
    TheOmnisimush and atomicjoe like this.
  3. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    Doesn't really seem to work with dynamic time of day.
    - Since it relies on reflection probes, you're going to need some kind of dynamic reflection probe which inherently introduces lag spikes (since a reflection probe in HDRP costs at least 10ms no matter what it's rendering).
    - Despite having a realtime reflection probe, it's still broken during nighttime. Showing very bright lights while rotating the camera.
    upload_2023-2-18_13-51-43.png

    The built-in SSGI seems to work fairly well in the same scenario, because it can fallback on the sky when no reflection probes are present and doesn't have the nighttime artifacts.
     
  4. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Hi!

    First of all, could you please share your Unity and HDRP versions? Also, are you running the patched or the unpatched version?

    It needs reflection probes only as a fallback. It can work without them just fine as a screen-space only effect.

    I don't know your Unity version, but since 2022.2 there's an option called "time-slicing" which dramatically reduces the cost of rendering a real-time reflection probe and makes having one at the camera position a totally viable solution.

    If this is not acceptable for you then there're custom user-made scripts which use two reflection probes baking one at a time with a certain interval and linearly swapping them. Here's an example of such script: https://forum.unity.com/threads/ssg...enoiser-and-performance.1211346/#post-7836549

    I tested both approaches myself and found both quite performant.

    Could you please share a video of how this looks in motion and in comparison with on / off? That would help me to identify what's wrong.

    Also, I have posted a setup that resembles a day / night change with a real-time reflection probe here: https://forum.unity.com/threads/h-t...cclusion-released.1251273/page-5#post-8529137
    Maybe it can be of help.

    Have you tested the native SSGI without the fallback? Sometimes it has such a limited radius that you get like 10% of SSGI itself and 90% of the fallback and that explains why it holds up so well under rapidly changing camera angles.

    Of course there's a possibility that you encountered a bug or some other issue with H-Trace and I will do my best to help you, but providing additional data about your case is crucial here.

    If you're sure theat the sky probe fallback is the key difference - I can try to patch a couple of files for you to make it work with H-Trace. We have added it in the next update already, but if you need it now - DM me and we'll see what we can do ;)
     
    Last edited: Feb 18, 2023
    tmcz_911, Gooren and PutridEx like this.
  5. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    @Passeridae Let's not waste any further time on my prototype. If dynamic time-of-day is a scenario you want to support then I will be happy to test this asset again when I'm ready to add it to the actual game.
     
  6. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    blueivy and atomicjoe like this.
  7. UsefulWeapon

    UsefulWeapon

    Joined:
    Oct 26, 2013
    Posts:
    66
    @Passeridae Hello! I just bought you awesome asset and i am very impressed with it. But i have i question on this thing:

    I am getting some kind of ghosting effect and flickering on the controller while i move. Is it possible to fix this ?
    Also i cant get an effect like on your video of this sample scene where you rotate directional light and the light bounces off blue walls and etc. How can i set it up on the demo scene ?
     
    Last edited: Mar 11, 2023
  8. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Hi and thank you! :)

    This is a denoising issue. To mitigate it (to a certain degree) you can try to lower the "detail preservation" slider. It will blur small details (like contact shadows) but will hopefully produce better noise reduction. Other denoising settings may have impact on this issue as well. Samplecount, Recurrent Blur and Intensity are the most important ones for this case, I think. We are actively working on a new denoiser that will do better in such cases with little to no manual tweaking. It will be included in the upcoming major update.

    The key thing there was a real-time (with time slicing) reflection probe that was placed roughly in the center of that room. Have you tried something like this? If this doesn't help I can write a more specific manual with some screenshots ;)
     
    Last edited: Mar 11, 2023
    Gooren likes this.
  9. Win3xploder

    Win3xploder

    Joined:
    Dec 5, 2014
    Posts:
    161
    I have a question about the realtime reflection probe: won't it be incorrect because the probe doesn't see any diffuse GI?
     
  10. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Can you elaborate more on that?

    Theoretically, we need the probe to see the direct lighting. So everything should be either lit or not lit. Shadows are supposed to be absolutely black. Realistically, the probe can see something different. Like direct lighting + fake indirect lighting provided by, say, ambient probe (the most typical setup). If this is the case then the incorrectness starts from here. Ideally, we would like a probe to see only the direct lighting, but at the time of baking be able to compute ssgi and have indirect lighting too.
     
  11. UsefulWeapon

    UsefulWeapon

    Joined:
    Oct 26, 2013
    Posts:
    66
    Thanks for the answer, i think it is better for me to wait for the new version of HTrace then. When you are planning to release it?
     
  12. Win3xploder

    Win3xploder

    Joined:
    Dec 5, 2014
    Posts:
    161
    How do I setup the probe correctly?

    edit: found a workaround, attach a post volume with a tiny sphere trigger to the reflection probe that has the indirect lighting controller on it with the indirect diffuse multiplier set to 0!
     
    Last edited: Mar 12, 2023
  13. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Soon-ish. Can't promise the exact date, but I hope that it won't take longer than a month. I think, we'll give access to the Beta to anyone who will be willing to test it and already owns the 1.0 version (you'll just need to DM me and attach your invoice from the asset store) so you will not have to wait for the official asset store release this way ;)

    Yep, that's a valid approach.
     
  14. TyGameHead

    TyGameHead

    Joined:
    Apr 29, 2017
    Posts:
    25
    Is the 2.0 update and up version coming in the same month.
     
  15. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Hi, no, first 2.0 and then URP.
     
    Gooren and SammmZ like this.
  16. kite3h

    kite3h

    Joined:
    Aug 27, 2012
    Posts:
    197
    Most of these methods use reflection probes as fallbacks. Even in Unreal Lumen, the lumen card is a billboard, but the ambient capture is in 6 directions. The Unity Reflection Probe does not automatically scatter a large amount of lumen cards into screen space like lumens do, but it also has the advantage of being able to adjust performance with OnDemand.
    Unlike Unity's default renderer, HDRP updates requestrender. Don't use RenderProbe.
     
  17. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
  18. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Hi everyone, it’s been awhile since our last update, but we finally have something to share with you! :)

    We have gathered a lot of feedback on the first version of H-Trace and so far the most significant issues seem to be denoising and performance. So we have done a good amount of research on it and tried to improve these areas as much as possible. To demonstrate this we prepared an interactive demo which you can download following this link

    Please note, for now this demo includes only the screen-space part of GI without the fallback. Its main purpose is to demonstrate the quality and performance of the updated screen-space tracing as well as the new denoiser.

    upload_2023-6-25_23-52-21.png

    In this demo H-Trace uses its (almost) highest settings right out of the box. To tune it down and get more performance try changing these parameters:
    • Gather Quality
    • Thickness mode
    • GI Quality / GI Samples
    For the detailed comparison between SSGI and H-Trace press “B” and drag the screen slider. It also works in H-Trace debug mode (that’s how the screenshot in this post was made)

    Keep in mind that this is still work in progress and we would be really glad to hear your feedback on it to improve it further!

    P.S. we also remember about other problems that you’ve encountered such as the cumbersome patching system. So it’s now deprecated and replaced by a new system that doesn’t require any file / folder movements and project reassemblies, so, hopefully, no more patching pain! We have also added the mode that can work with objects of any scale and size (10 kilometer Cornell Boxes are fine now) and introduced the Single Pass VR support - though it’s a bit experimental now and needs more testing.
     
  19. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Could you please include the reflection probe fallback so that we can test the results on a real game?
    Just make an option to enable and disable them.
    Right now the demo is extremely limited to judge the final quality in game: as soon as you turn or come close to anything, the light vanishes. It would be useful to check how accurate is the fallback reflection probe mode in those situations, just as in-game.
    Thanks
     
  20. blueivy

    blueivy

    Joined:
    Mar 4, 2013
    Posts:
    633
    Fantastic work! My display is extremely high res and H trace handled it beautifully. Especially with playing around with the settings you mentioned, I was able to get higher fps while getting similar quality. Not to mention it looks 1000 times better than SSGI while also being more performant! I don't know the resolution h trace renders at but is their a setting that allows us to control to have a trade off between performance/quality? I imagine it would be faster to render at a 720p or 1080p res vs 4k.
     
  21. Ookoohko

    Ookoohko

    Joined:
    Sep 29, 2009
    Posts:
    103
    Really impressive improvement!

    Just out of curiosity - what kind of fallback option(s) are planned for 2.0? At least I find it quite disturbing that the lighting changes significantly as soon as you look away from a light source.

    I've been wondering if per-vertex caching would be good enough for low-res fallback, but that would require raytracing either using RTX or compute shaders. Anything that doesn't require placing probes to the scene manually would be nice, though.

    br,
    Sami
     
  22. SolidK

    SolidK

    Joined:
    Jun 27, 2019
    Posts:
    10
    I mean, If you're making a game you'll probably have to place probes anyway if you want it to be performance friendly. I'll take well placed probes over SSR any day of the week frankly. I'm surprised by how good it looks with just probes as fallback.
     
  23. Ookoohko

    Ookoohko

    Joined:
    Sep 29, 2009
    Posts:
    103
    Hi,

    I'm not doing games, I'm looking for a way to replace UE in virtual production / LED volume environment, so the lighting has to actually be able to react dynamically, pre-baking is not an option.

    br,
    Sami
     
  24. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    You can bake probes in realtime, it's just more expensive in hardware but not a problem with an RTX4090 or 3090
     
  25. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    But why change then? Isnt Unreal the leader in that field?
    Whats not working or annoying you with Unreal that you want to try Unity instead?
     
  26. blueivy

    blueivy

    Joined:
    Mar 4, 2013
    Posts:
    633
    To answer your question the developer has posted in the discord that they have a world space GI solution that is non probe based I believe.
     
    Ookoohko likes this.
  27. Ookoohko

    Ookoohko

    Joined:
    Sep 29, 2009
    Posts:
    103
    Well, different beasts ... I personally prefer Unity, because it's much more straightforward in several cases and I know it inside out. UE is heavy asf, simple things are often 10x more complex to do than in Unity. Also the multiuser/switchboard combo is a horrible piece of hacky S***. Lumen is extremely nice, though, that's what I miss.

    br,
    Sami
     
    newguy123 likes this.
  28. Ookoohko

    Ookoohko

    Joined:
    Sep 29, 2009
    Posts:
    103
    Hmm yeah, just checked Discord. Keeping my fingers crossed that it will actually be good!

    br,
    Sami
     
  29. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Yep, something like Lumen is desperately needed in Unity. All this probe nonsense, is nonsense!
     
  30. SolidK

    SolidK

    Joined:
    Jun 27, 2019
    Posts:
    10
    Gotcha. But why not use ray tracing then? It's been available since 2019.3
     
  31. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    Probes are super useful on mobile hardware, since they're really fast, but yeah, Lumen is desperately needed for PC and consoles graphics.
     
  32. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    I looked into that, it's super limited and cumbersome: you can't just use regular materials, they have to be tailored for that and had tons of limitations.
     
  33. jiraphatK

    jiraphatK

    Joined:
    Sep 29, 2018
    Posts:
    300
    this is like saying you want raytracing over lightmapping. They exist for completely different reason. and the goal of precompute solutions is more practical. list me any game that have been released and it solely using Lumen as a lighting solution without fallback to precompute solution. there is none, as far as I know, unless you don't care about losing much of the potential players just because their hardware doesn't reach your extremely high min hardware requirement.
     
  34. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    Yes exactly. I dont care about hardware and neither does the user my comment relate to since our use case is not games.
     
  35. SolidK

    SolidK

    Joined:
    Jun 27, 2019
    Posts:
    10
    I had to rely on it for several months for a project I was working on (not a game). Not nearly as cumbersome as I expected it to be, but there were/are some limitations, a lot of which have been addressed in recent versions of HDRP.
     
    newguy123 likes this.
  36. SolidK

    SolidK

    Joined:
    Jun 27, 2019
    Posts:
    10
    The reason I'm excited for something like HTrace (especially the upcoming 2.0 version) is because a carbon-copy of Lumen would be heavy as all get out in terms of performance. I'm not super sure about this, but I believe Unity realized this too, which is why they're going balls to the wall towards their precomputed dynamic GI system (APV).
     
  37. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Hi! The goal of the demo is to demonstrate the progress in denoising quality and performance levels for the upcoming major update. It's not meant for the assessment of the final product or the final lighting for now. It will be updated with new features as we implement / re-implement them, so by the time of the release, yes, the fallback and everything else will be included.

    It already renders at a downscaled resolution bundling rays together thus trading the resolution for the ray budget :) At the current moment the quality / performance is mostly controlled by "Gather Quality", "Thickness Mode" and "GI Quality / GI Samples" parameters.

    Thanks! We are actually implementing a true world-space tracing, so the 2.0 version will most likely be a more or less complete (not "screen-space" only) real-time GI solution. Of course it will have certain limitations at the beginning (limited coverage, update rate, etc.) but we will work towards improving those in the future updates. But the idea is that you would be able to at least have the Sponza or two (or some interior or just an area of 50-100 meters around the camera) automatically covered with the world-space tracing without any need to worry about reflection probes*, APV volumes, lightmaps or RT hardware. And hopefully with a good performance.

    *I'm talking about reflection probes in the "fallback" context here. You would probably still want them for regular reflections ;)
     
  38. atomicjoe

    atomicjoe

    Joined:
    Apr 10, 2013
    Posts:
    1,869
    What about the BiRP version? Will you still release it?
    A lot of people like me only use BiRP.
    Implementing it for deferred BiRP shouldn't be that complicated, isn't it?
     
    Meceka, blueivy and imDanOush like this.
  39. Ookoohko

    Ookoohko

    Joined:
    Sep 29, 2009
    Posts:
    103
    This sounds great to me - let me know if you need beta tester(s), I can probably provide constructive feedback, being a coder nerd myself :)

    br,
    Sami
     
    Passeridae likes this.
  40. Win3xploder

    Win3xploder

    Joined:
    Dec 5, 2014
    Posts:
    161
    Love seeing the progress this plugin is making! Can I ask how H-Trace performs with foliage? Does it look good?
     
  41. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Hi and thank you! :)
    Here's an example of how the current version works with foliage: https://forum.unity.com/threads/h-t...cclusion-released.1251273/page-4#post-8518118


    Hi, sure! ;)


    Yes, we still plan to release both the URP and the BiRP versions. We had to postpone them because we first wanted to bring improvements to the HDRP and update the core of H-Trace, but the general plans haven't changed.
     
  42. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    327
    Hello!

    I'm researching alternatives to Unity's SSGI due to some issues we're having with it, and H-Trace looks like one of the most promising solutions. But I have a few questions/concerns to clarify before I jump in and try it...

    1. Masking per object or material.
    It is crucial for us to be able to exclude receiving this effect on certain objects. With the best will in the world, it seems these systems always run into certain cases where things just get too noisy or for artistic reasons should not come into play. For example, Unity's SSGI results in terrible artefacts on our 3rd-person character's skin. Another example is our custom foliage system which becomes too dark and noisy with SSGI enabled (we have a specific artistic goal for how it should look, and we don't wish to have heavy AO between grass blades). A simple solution would have been to exclude SSGI from these materials, but in recent HDRP versions, it is no longer supported at the material level (only SSR can be masked this way now). Read here for more:

    Question - Is it possible to exclude SSGI from specific materials (as can be done with SSR) - Unity Forum

    So I was reading through this entire thread and found this:

    h-trace-masking.png

    Did this masking feature eventually make it into v1. Will it be in v2?

    2. Intensity slider
    Similar to above (and mentioned in the screenshot), an intensity slider would be incredibly useful so we can deliberately choose to mitigate noise/ghosting/whatever at the expense of less visible GI/AO. Sometimes a very subtle effect can make enough difference to the image, that just running it at 50% is fine.

    3. H-Trace v2
    I notice from reading most of this thread, that there are some issues with H-Trace v1 like ghosting, performance and also the need to patch HDRP. I'm already running a custom patch of HDRP (copy-and-paste with manual tweaks) which is required by the FSR2 package (FSR 2 - Upscaling for Unity | Utilities Tools | Unity Asset Store). I'm worried about competing changes when every other package we have needs to modify HDRP in some way. So I'm wondering, will v2 require HDRP patching, and I'm sure you get asked a lot... when will v2 be released? I just need to know roughly like 1 month, or 6 months?
     
  43. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Hi! Unfortunately, we can't control it on the per-material basis, because Unity just doesn't provide a flexible enough access to the data required for this. We can control it on the per-layer basis, though. So, you can exclude the grass and the character and everything else that you need in the layer dropdown menu in H-Trace UI and these excluded layers won't receive GI.

    So, no, the per-material control wasn't included in the V1 and is unlikely to be included in the V2 either. But the per-layer system will stay, of course. It is also possible to customize H-Trace and make it work with your specific data. So if you somehow mark your materials / objects (e.g. with stencil buffer bits) and provide this data in a full-screen texture buffer, then I can show you how to combine this with H-Trace, I think.

    There's an intensity slider, yes. When patched, you can also control it through the native "Indirect Lighting Controller" override which has the "Indirect Lighting Diffuse Multiplier" slider.

    No, the V2 won't require any patching, file movement, package modification, etc.
    I can't name an exact date, but 1 month is, of course, much more likely than 6 month ;)
     
    blueivy and newguy123 like this.
  44. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    327
    Thanks for the info!

    Follow-up question - the "layers" you mention... are these the new Rendering Layer Mask (light layers), or are they the old-school object layers in Unity (where you can only assign 1 layer to an object)?
     
  45. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    327
    I got around to quickly testing out H-trace in our town scene.

    In the simple (unpatched) mode, it seems to work straight away as I can see the glow on the window ledge from the emissive window.

    But when I switch to the "patched" configuration, the scene goes very dark as shown in the 3rd screenshot.

    I will go back now to read again carefully through the quick start guide, but the basic things I believe have been done correctly:

    - Patched HDRP (although I'm not quite sure how to confirm this, because we already have HDRP in the local folder and patched for FSR2)
    - Using "Before Pre Refraction" injection point.
    - Adding SSGI with recommended values.
    - Checked that we have no shader errors (although I do see some warnings related to compute shaders)

    h-trace-off.png

    h-trace-simple.png

    h-trace-patched.png

    Any ideas in the meantime?
     
  46. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    327
    1.
    Quick follow-up regarding issues with the "patched HDRP" approach: I found that in Play mode, when switching to this approach, there are tonnes of red errors being dropped related to compute shaders and stuff in the upgraded SSGI implementation and related files (Unity 2022.3.2).

    2.
    Additional experimentation on simple (non-patched) approach:

    So I set aside the "upgrade" route for a moment, and started playing around with the simple approach first.
    In the tests below, we have HDRP unmodified, and not using the SSGI approach (it is completely disabled).

    I noticed that H-Trace was only visible inside the Scene view, and not the Game view. So the work-around I found was to set the custom pass volume to Camera instead of Global, and then dragging the main camera to the Target Camera property. This made H-Trace work in the game view, and no longer in the scene view (as expected). So this smells to me like some Unity issue where the global custom pass volume is not rendering in all cameras.

    The trouble with the Camera approach for the volume, is that we also have our own (quite complicated) custom passes. One of those, I have also set to Camera in the same way. When our custom pass is enabled, it totally screws up H-Trace. I haven't figured out why yet. I've tried re-ordering the different volumes, but no luck.


    So currently we are on 2022.3.2. I'm going to take a stab in the dark and go to 2022.3.5. BTW 2022.3.x is LTS and is the currently Recommended version of Unity. Seeing that H-Trace was released quite a while back, I guess it is possible that it is not totally compatible, or that I'm dealing with Unity issues. I will report back again soon.
     
  47. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Sorry for the long reply. No this is not related to Light Layers, it's the general layer system of Unity.

    So, I've read both your posts, but I'll summarize all my thoughts in reply to this one.

    First, there's a known issue with having both the Scene view and the Game view opened simultaneously (e.g. side-by-side or on top of each other). In this configuration H-Trace will either work only in one view or it may be broken in both views. My first advice would be to avoid having both these windows opened at the same time.

    Second, when testing in the non-patched mode, make sure to disable all "fake" ambient lighting provided by Unity. This lighting usually comes from: a) the environment (global / sky) probe, b) local reflection probes. I would suggest disabling them with the "Indirect Lighting Controller" by setting the "Reflection Lighting Multiplier" to 0. After that your shadows are supposed to be pitch-black. This would be the starting point for GI testing, because this way you'll be able to see GI in its full power.

    Third, shader warnings are generally okay, but shader errors are not. So, even if you're able to launch the play mode and / or clear the errors - it's most likely that the effect is malfunctioning and the errors need to be resolved anyway.

    Another custom passes may, of course, brake H-Trace because it relies on certain buffers to be valid and available (such as Color, Depth, Normal, Roughness, Motion Vectors, etc.). If your custom pass overwrites / modifies these buffers or if it modifies the final Color Buffer after H-Trace then it may be a problem. However, the custom pass system is quite flexible so I'm sure there's always a way to avoid conflicts between different custom passes and make them work together. But I can't recommend anything for now, because I don't know what is your pass doing :)
     
  48. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    327
    I will check again - I think I only opened them side by side to get the screenshot done.

    The problematic custom pass volume that is killing HTrace, should in theory by OK. This custom pass targets the Custom Buffer. See in this video, I can fix HTrace instantly by disabling my custom pass.



    Note that I've set both HTrace and my custom pass to Camera mode with the main camera rendering the custom pass. This avoids involving the scene window at all. But also, using the Global mode on the volume, seems to be worse, with neither custom pass working at all.

    I really do wonder if the very latest LTS 2022.3.5, which uses HDRP 14.0.8, might have caused your system some trouble? Or we might be dealing with Unity bugs here related to custom passes.
     
  49. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    327
    Latest findings:

    1. The mysterious interfering custom pass (see my video for reference). I finally narrowed it down to a strange situation I cannot explain fully. There is a certain layer that I use for my custom pass. For simplicity let's call it LayerX. The custom pass renders objects of LayerX to the Custom Buffer. The main camera does not render LayerX. It is used for something that is not visible in the game world. So... I noticed that when I exclude LayerX from the H-Trace layers, everything falls apart. I have no idea why. When I include LayerX in H-Trace, it stops breaking. The strangest thing is... all I'm doing is rendering LayerX into the Custom Buffer. I don't see how H-trace could possibly care what I use the custom buffer for in my custom pass?

    2. Patched mode.
    EDIT: so this had to do with requiring a reflection probe fallback. I realise only now through trial and error that only the patched mode behaves this way, and requires a reflection probe that renders the sky, for the sky to contribute to the scene lighting.
    I can confirm - that even in the included Demo scene, this is true: when you switch from simple mode to patched mode (i.e. H-Trace via SSGI override), then the sky stops contributing entirely to the scene. So let's say I have a simple Gradient Sky combined with a sun (direction light), and everything looks good. I can then enable H-trace in simple mode, and it works. Then, switch H-trace to the Before Pre Refraction layer, and enable SSGI, and notice that the sky contribution becomes 0, which makes outdoor scenes look totally black except where direct light reaches, or H-trace GI reaches. (If it will help, I can drop a video demonstration)
     
    Last edited: Jul 31, 2023
  50. Passeridae

    Passeridae

    Joined:
    Jun 16, 2019
    Posts:
    395
    Hi! That's weird. I think I would be able to explain it only if I had an access to a repro scene with your pass. If you can provide such a scene (it might be something simple like a cornell box + your pass + H-Trace set up in the way that breaks everything) then I'll take a look at it! :)

    This is because Unity's SSGI disables every kind of other GI / ambient light contribution, the sky probe included. So when the patched mode is enabled - it sets everything to 0 and only lets through the lighting that comes from H-Trace. We haven't implemented the sky probe fallback, so this is why by default you don't get any skylight contribution for those areas that H-Trace can't reach. You can get it only through the reflection probe, as I've already mentioned. This is the limitation that we'll fix in the new version.