rtx-remix icon indicating copy to clipboard operation
rtx-remix copied to clipboard

[Runtime Bug]: Worse shadowing detail in NRC due to direct Sky illumination

Open ladna373 opened this issue 5 months ago • 24 comments

Describe the bug

In the photo you can see a sink and a faucet on the sink, which, in theory and according to the reference (look at the "expected behavior") should cast a shadow, but NRC is not able to process this quickly and keep it in its cache

Image

How do you reproduce the bug?

  1. Download Garry's Mod and launcher from CR and Xenthio (https://github.com/Xenthio/RTXLauncher/releases/tag/v1.0.13)

  2. Half-Life 2 must be installed on your computer

  3. Select map "d2_coast_05" Image

  4. Disable bots in the context menu (button "C") Image

  5. Get to this house Image

  6. The windows should be broken (as in the photo), as it will be dark with them Image

What is the expected behavior?

NRC should look roughly the same as ReSTIR GI, as well as the reference

ReSTIR GI: Image

Reference (1024 frames): Image

Version

1.1.0

Logs

The launcher automatically creates a config (the same one I use)

Crash dumps

No response

Media

No response

ladna373 avatar Jul 22 '25 18:07 ladna373

REMIX-4588 for tracking

pkristof avatar Sep 02 '25 17:09 pkristof

Edit: OK, after hitting apply and install for the remaining sections in the advanced install, the rtx.conf got deployed.

Hi, I looked at your repro, but it's missing setup steps. I deployed RTXLauncher to Garry's mod, hit install/Update for RTX Remix in the advanced tab, but it didn't create an rtx.conf as you specified on the github ticket. Can you clarify all the steps needed to set this up?

pkristof avatar Sep 02 '25 18:09 pkristof

Running it locally, NRC is quite close to ReSTIR Gi as far as prominence of the shadow due to the occluding faucet goes. Can you retry this on vanilla GMod install?

NRC:

Image

ReSTIR GI

Image

pkristof avatar Sep 02 '25 19:09 pkristof

I forgot to add that you need to turn off spot and point lights, because in the room itself there are other light sources that were standard in HL2

Image (using NRC at the moment)

ladna373 avatar Sep 03 '25 04:09 ladna373

Tl;dr: this is by design and the problem is really in Remix's direct lighting method not importance sampling the sky contribution. Then ReSTIR GI and NRC sample it instead at a worse sampling rate. ReSTIR GI allows to boost indirect samples on 1st bounce and thus can better recover such lighting. However, RTXDI SDK supports environmental map sampling, but it's not integrated in Remix, I don't think. So the solution here for NRC path would be to add that as well as replace the sky with an environment map in this HL2/GMod scenario.


Disabling spot, directional and point lights - the room is illuminated by in-game sky and so is the shadow cast by a faucet from an occluded sky light. It is technically a direct light shadow, but our direct lighting (RTXDI) implementation doesn't sample or boost sky when it comes from a missed ray - not that it could, but RTXDI SDK does support environment map sampling and that could be the solution here to let RTXDI resolve this contribution for the 1st bounce. Right now, the sky does get sampled indirectly but at a very poor rate. Using a reference denoiser shows this gets captured for both NRC and ReSTIR GI, so it's a problem of very poor sampling of this light source.

Why ReSTIR GI works better in this case? It's because ReSTIR GI boosts indirect samples on primary surfaces while NRC boosts indirect lighting from a 2nd+ bounce - NRC paths generally only query NRC cache from 2nd+ bounce and paths that miss on 1st bounce are simply the same as in the importance sample method, so NRC path output is the same for these 1st bounce misses. Note, NRC does better recover indirect lighting from 2nd+ bounces even for lighting coming from the sky. So that's for bounces that don't miss on first bounce. Notice, the brighter highlights on the gun in NRC case, while this is mostly missing in ReSTIR GI case.

Indirect lighting from 2nd bounce is often lower frequency than that of the 1st bounce lighting since such lighting will be more diffuse/spread, and hence, why the "missing" shadow behind a faucet is more pronounced.

Image

pkristof avatar Sep 03 '25 16:09 pkristof

So you mean I should try something like hdri sky?

ladna373 avatar Sep 03 '25 17:09 ladna373

Can't you make it so that you don't have to replace it with an environment map? so that there is more compatibility

AntosheckaGithub avatar Sep 03 '25 19:09 AntosheckaGithub

I tried it with HDRI, the effect is the same as in the previous photos

Image RESTIR GI

Image NRC

AntosheckaGithub avatar Sep 04 '25 04:09 AntosheckaGithub

I tried it with HDRI, the effect is the same as in the previous photos

No, this is not integrated in Remix yet, but it's in Remix SDK or one of its samples, meaning it's a potential future improvement.

Can't you make it so that you don't have to replace it with an environment map? so that there is more compatibility

Yes, it should be possible to support a constant value and let the improved sampling work the same way as with an HDRI map.

pkristof avatar Sep 04 '25 11:09 pkristof

How long will it take for it to be in remix?

AntosheckaGithub avatar Sep 04 '25 15:09 AntosheckaGithub

We don't have any timelines to share for this feature at this time.

If you run into more cases/games where there's clear lack of detail due to global sky (+ NRC), please share them here, it'll help with prioritization.

The scenarios more sensitive to this are where sky contribution is dominant but the sky is considerably occluded - like in the use case in this ticket - a sky shining in through a window.

pkristof avatar Sep 04 '25 16:09 pkristof

Alright, so again the same scenario where the sun goes through the door. ReSTIR GI again shows more detailed shadows, while NRC takes a long time to process this same shadow and the result is still not as detailed as ReSTIR Image ReSTIR GI

Image NRC

ladna373 avatar Sep 04 '25 18:09 ladna373

And again the same case, where ReSTIR is more detailed than NRC. This table seems to lack shadows coming from the window in NRC.

Image NRC Image ReSTIR GI

ladna373 avatar Sep 04 '25 18:09 ladna373

Image ReSTIR GI Image NRC

ladna373 avatar Sep 04 '25 18:09 ladna373

I have just noticed that the shadow from the props (in the photos above) is also missing (or barely noticeable)

AntosheckaGithub avatar Sep 04 '25 22:09 AntosheckaGithub

Image NRC Image ReSTIR GI

ladna373 avatar Sep 05 '25 16:09 ladna373

Image NRC Image ReSTIR GI

ladna373 avatar Sep 05 '25 16:09 ladna373

Image NRC Image ReSTIR GI

ladna373 avatar Sep 05 '25 16:09 ladna373

Image ReSTIR GI Image NRC

ladna373 avatar Sep 05 '25 16:09 ladna373

1st one with a chair: NRC looks better there. It's bouncing off indirect lighting softening the shadows which is the desired behavior. But then the screenshots have different cameras, which is not optimal for comparisons, so maybe I am missing something you tried to show.

2nd one: the shading is kind of diffused and there are big differences outside of shadow detail for some reason.

3rd one with kitchen: are those shadows due to a direct sky illumination or is it bounced off some surface outside? It's hard to tell. If it's due to direct occlusion of sky then it's the same. If it's bounced off lighting then please share repro steps since that's a bit of a different case from the one in OP.

pkristof avatar Sep 08 '25 12:09 pkristof

The above screenshots are all from GMod + HL2 aren't they? We don't need more cases of the same game - we already know it'd help. If you run into this case in other games, it'll be helpful to share those cases.

pkristof avatar Sep 08 '25 12:09 pkristof

3rd one with kitchen: are those shadows due to a direct sky illumination or is it bounced off some surface outside? It's hard to tell. If it's due to direct occlusion of sky then it's the same. If it's bounced off lighting then please share repro steps since that's a bit of a difference case than OP.

probably yes, the light doesn't go directly into the window, but bounces off the ground

AntosheckaGithub avatar Sep 09 '25 10:09 AntosheckaGithub

So I will share with steps so that it can be repeated

AntosheckaGithub avatar Sep 09 '25 10:09 AntosheckaGithub

The above screenshots are all from GMod + HL2 aren't they? We don't need more cases of the same game - we already know it'd help. If you run into this case in other games, it'll be helpful to share those cases.

Honestly, I don't know which games to check, because gmod is mostly best for remix

AntosheckaGithub avatar Sep 09 '25 11:09 AntosheckaGithub