StrataSource / Engine

Issue tracker for Strata Source
47 stars 2 forks source link

Bug: Rare incorrect lighting through portals changing on view angle #315

Open braem opened 2 years ago

braem commented 2 years ago

Describe the bug

There is very rarely a lighting flicker depending on how the view is angled when looking through a portal. I've only seen this is one location and it looks like it is with CSM (?). May exist elsewhere.

Occurs regardless of game resolution in my testing. Also is not solved by !926 (internal)

In DX11: Light incorrectly shows on wall (PBR) and glass (LMG) https://cdn.discordapp.com/attachments/549657950201970688/926378790567948298/2021-12-30_23-37-44.mkv

When going through portal, the glass and wall isn't getting some light: https://i.imgur.com/wejAsth.png

In DX9: Light incorrectly shows just on glass (LMG) https://cdn.discordapp.com/attachments/549657950201970688/926381525967183942/2021-12-30_23-49-01.mkv

When going through portal, the glass isn't getting some light https://i.imgur.com/u4C3UNC.png

I'm unsure whether dx9 or dx11 is the correct lighting in this situation or if theyre both off.

To Reproduce

  1. Load sj_ironmoon
  2. Go to setpos_exact -7711.450195 -4249.587402 -1021.795044; setang_exact -66.559731 -8.285106 0.000000
  3. Reorient view slightly to the right and down, some light will 'turn off'

Expected Behavior

Lighting should remain consistent through portals

Operating System

Windows 11

VortexParadox commented 2 years ago

The CSM shadow popping itself is not a bug really, if you want the shadows to not lod in this area you have to adjust the max distance for them, though it doesn't seem possible to do this via inputs (perhaps AddOutput works on it?). The distance doesn't take into account how close you are to the volume through a portal. The filtering the cascaded shadows are using however is a bug, and it seems to be true too for the hexagonal grid material you have on some walls, it gives out wrong distance values and makes the wall look really odd. I remember Gocnak bringing up how DX11 was not using the radial fog, if it did end up getting changed, that would explain why it looks different in DX9

luxeleios commented 2 years ago

I can only add that CSM shadows resolution doesn't account for portals - let's say you have a shadow 1024u away from you and at that distance the csm won't be rendered by default anymore, so only lightmapped shadow is left - now if you place a portal next to yourself and a portal where your shadow is, when looking through the portal the shadow will still look as if you were 1024u away because csm doesn't account for portals at all.

braem commented 2 years ago

The CSM shadow popping itself is not a bug really, if you want the shadows to not lod in this area you have to adjust the max distance for them, though it doesn't seem possible to do this via inputs (perhaps AddOutput works on it?). The distance doesn't take into account how close you are to the volume through a portal. The filtering the cascaded shadows are using however is a bug, and it seems to be true too for the hexagonal grid material you have on some walls, it gives out wrong distance values and makes the wall look really odd. I remember Gocnak bringing up how DX11 was not using the radial fog, if it did end up getting changed, that would explain why it looks different in DX9

That material has manually edited mipmaps so any weirdness with it would also be a mipmapping issue through portals. I don't see anything off about them though in this screenie, is just how the effect was done

VortexParadox commented 2 years ago

These aren't seen through portals, the problem is that the distance filtering is not calculated correctly at all. The distance on that screenshot implies I'm closer to the edges of the screen and up. It's like if it used some inverted calculation. Here's a mip level slices comparision between TF2 and MMod DX11

TF2
Momentum DX11
(Color coding looks completely off as well)