View Issue Details

IDProjectCategoryView StatusLast Update
0004938The Dark ModGraphicspublic22.01.2019 22:52
Reporterstgatilov Assigned Toduzenko  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
Product VersionTDM 2.07 
Target VersionTDM 2.07Fixed in VersionTDM 2.07 
Summary0004938: Shadow maps: some lights are still not soft
DescriptionWith shadow maps and soft shadows, not all shadows are actually soft.
Steps To Reproduce0) Set Shadows to "Maps" and set positive soft shadows quality/radius.
1) Load Arena FM.
2) Go to the Arena.
3) Notice that some lights are completely hard.
TagsNo tags attached.
Attached Files
Untitled.jpg (506,161 bytes)
remembrance_maps_aa.jpg (559,788 bytes)
remembrance_maps_noaa.jpg (565,394 bytes)

Activities

stgatilov

stgatilov

02.01.2019 11:12

administrator   ~0011218

Another example is a tiny "Swing" mission.
As soon as you get outdoors, you see the shadow of the whole construction on the surrounding mountains. It is soft with Stencil shadows, and perfectly hard with Maps shadows.
nbohr1more

nbohr1more

02.01.2019 13:54

developer   ~0011221

Last edited: 22.01.2019 22:52

It strikes me that there are probably one or two issues at hand here.

Lights over the "r_maxShadowMapLight" cvar value are rendered as Stencil Shadows with no softening.

Parallel lights are rendered as Stencil Shadows with no softening.

If we want to cover both these "pathological" cases, we probably should apply
some small uniform amount of softening in both these scenarios rather than
distance based softening which breaks down for such large volumes.

STiFU

STiFU

17.01.2019 11:09

developer   ~0011382

Reminder sent to: duzenko

Can we still target this at 2.07?
duzenko

duzenko

17.01.2019 12:03

developer   ~0011387

Reminder sent to: stgatilov

2.07 or 2.08?
stgatilov

stgatilov

17.01.2019 12:17

administrator   ~0011389

I'm afraid I don't understand the problem well enough to say if this is suitable for 2.07.

Is it true that the main difficulty lies in the fact the stencil texture does not exist in Maps case, so soft stencil shadows cannot be done?
duzenko

duzenko

17.01.2019 15:33

developer   ~0011395

It looks like a flag missing in a branch condition
Function name is pointInteractionProgram_t::UpdateUniforms but it might be more than just that one
STiFU

STiFU

17.01.2019 15:40

developer   ~0011398

If you think it's a comparatively quick fix, implement it and we can then review it to see if it should be included in 2.07 or not. Otherwise, best leave it for 2.08, although I would really like Maps to be as feature-complete as possible in 2.07.
STiFU

STiFU

17.01.2019 23:52

developer   ~0011401

I don't know what type of light it is, but there is also no soft shadow in the training mission at the bow shooting area.
duzenko

duzenko

18.01.2019 13:10

developer   ~0011407

At revision: 7920
STiFU

STiFU

18.01.2019 14:22

developer   ~0011409

Sorry, we are not there, yet. I have tested Flakebridge Monastery and Training Mission, both show the same behavior. It looks as if there is some softening going on, but the hard edged shadow map is rendered atop of that. Furthermore, the Softness slider seems to be ineffective in these cases (which may be by design, now that I think about it). I have uploaded comparison screenshots with SoftShadows "Off" and SoftShadows "Very High" for illustration.
duzenko

duzenko

18.01.2019 15:48

developer   ~0011413

Attached is how it looks to me
nbohr1more

nbohr1more

18.01.2019 15:59

developer   ~0011414

Last edited: 18.01.2019 16:00

The training map is a pretty bad test case.

With contact hardening shadows, the closer you are to a surface the harder the shadows.

The arrows are VERY close to the table...

STiFU

STiFU

18.01.2019 16:12

developer   ~0011415

@duzenko: I retested now and can verify that the behavior is dependent on anti aliasing. Enable it, and you see what I'm seeing. Disable it, shadows look like they should.

@NBohr: That's supposedly a parallel light there, so the shadows should revert to stencil + uniform softening, right?
nbohr1more

nbohr1more

18.01.2019 16:30

developer   ~0011416

Last edited: 18.01.2019 16:31

Yes, I believe if that's a parallel light, we want uniform softening unless
Duzenko has developed some different cure to the issue like scaling down the size
of parallel light distances or some other fudge that makes them work better?

I guess the same would apply to oversized lights. There would either need to be a uniform value or fudge factors.

nbohr1more

nbohr1more

19.01.2019 05:06

developer   ~0011419

Hmm...

Interesting results.

"In Remembrance of Him" kinda points to a number of edge cases where this is
working vs breaking down...

When I first started the mission, I did notice the big parallel skylight shadows
on the buildings had some sort of softening going on. Even with AA enabled.

I then zoomed in for a closer look and noticed that the shadows became pretty close to hard edged when really close to the wall.

Changing the soft shadow quality from medium to high hardened the shadow
even more.

All these effects sorta make sense if you have a hard-coded number of pixels for
softening regardless of distances (which was what I suggested as a solution).

I guess we might either need to increase that hard-coded amount or change it
depending on quality setting? Higher quality > larger sampling disk?
stgatilov

stgatilov

19.01.2019 05:54

administrator   ~0011420

Last edited: 19.01.2019 05:56

I also see the same good softening with Stencil and with Maps + AA off.
With Maps + AA on, the hard shadow becomes apparent.

I tried changing the softening in shader with Maps + AA on, and I believe that for some reason two shadows are drawn: one is completely hard and one is soft.
Or more likely problem is that the rendered shadow is soft, but stencil test is not disabled, so the inner part of the shadow gets completely black.

Attached two screenshots with interaction color hardcoded to 50%-white.
In remembrance_maps_noaa.jpg, the shadow is softened properly. In remembrance_maps_aa.jpg, the inner half of the shadow boundary is cut out.

duzenko

duzenko

19.01.2019 08:56

developer   ~0011426

At revision: 7921
STiFU

STiFU

19.01.2019 13:05

developer   ~0011431

Fix confirmed on both Training Mission and Flakebridge Monastery. Thanks!

By the way, auto for booleans?? ;-P
auto stencilPath = r_shadows.GetInteger() == 1 || backEnd.vLight->tooBigForShadowMaps;
stgatilov

stgatilov

19.01.2019 13:53

administrator   ~0011432

People say that the more of "auto" you use, the harder it is to read the code =)
duzenko

duzenko

19.01.2019 14:16

developer   ~0011433

Last edited: 19.01.2019 14:18

Call me Automan LOL

Being a C++ noob I am entitled to put auto's everywhere

nbohr1more

nbohr1more

20.01.2019 21:35

developer   ~0011449

I believe this change caused r_shadowMapSinglePass to crash:

http://forums.thedarkmod.com/topic/19774-beta-testing-207/page-13#entry433347
duzenko

duzenko

21.01.2019 09:53

developer   ~0011462

At revision: 7926

Issue History

Date Modified Username Field Change
01.01.2019 11:37 stgatilov New Issue
01.01.2019 11:37 stgatilov Status new => assigned
01.01.2019 11:37 stgatilov Assigned To => duzenko
02.01.2019 11:12 stgatilov Note Added: 0011218
02.01.2019 13:54 nbohr1more Note Added: 0011221
02.01.2019 13:55 nbohr1more Note Edited: 0011221
17.01.2019 11:09 STiFU Note Added: 0011382
17.01.2019 12:03 duzenko Note Added: 0011387
17.01.2019 12:17 stgatilov Note Added: 0011389
17.01.2019 15:33 duzenko Note Added: 0011395
17.01.2019 15:40 STiFU Note Added: 0011398
17.01.2019 23:51 STiFU File Added: training_mission_2019-01-18_00.47.21.jpg
17.01.2019 23:52 STiFU Note Added: 0011401
18.01.2019 13:10 duzenko Note Added: 0011407
18.01.2019 13:10 duzenko Status assigned => resolved
18.01.2019 13:10 duzenko Fixed in Version => SVN
18.01.2019 13:10 duzenko Resolution open => fixed
18.01.2019 14:22 STiFU Note Added: 0011409
18.01.2019 14:22 STiFU Status resolved => assigned
18.01.2019 14:22 STiFU Resolution fixed => reopened
18.01.2019 14:22 STiFU File Added: training_mission_rev7920_SoftOff.jpg
18.01.2019 14:22 STiFU File Added: training_mission_rev7920_SoftVeryHigh.jpg
18.01.2019 15:48 duzenko Note Added: 0011413
18.01.2019 15:48 duzenko File Added: Untitled.jpg
18.01.2019 15:59 nbohr1more Note Added: 0011414
18.01.2019 16:00 nbohr1more Note Edited: 0011414
18.01.2019 16:12 STiFU Note Added: 0011415
18.01.2019 16:30 nbohr1more Note Added: 0011416
18.01.2019 16:31 nbohr1more Note Edited: 0011416
19.01.2019 05:06 nbohr1more Note Added: 0011419
19.01.2019 05:54 stgatilov Note Added: 0011420
19.01.2019 05:55 stgatilov File Added: remembrance_maps_aa.jpg
19.01.2019 05:55 stgatilov File Added: remembrance_maps_noaa.jpg
19.01.2019 05:56 stgatilov Note Edited: 0011420
19.01.2019 08:56 duzenko Note Added: 0011426
19.01.2019 08:56 duzenko Status assigned => resolved
19.01.2019 08:56 duzenko Resolution reopened => fixed
19.01.2019 13:05 STiFU Note Added: 0011431
19.01.2019 13:53 stgatilov Note Added: 0011432
19.01.2019 14:16 duzenko Note Added: 0011433
19.01.2019 14:18 duzenko Note Edited: 0011433
20.01.2019 09:23 stgatilov Fixed in Version SVN => TDM 2.07
20.01.2019 09:23 stgatilov Target Version => TDM 2.07
20.01.2019 21:35 nbohr1more Note Added: 0011449
21.01.2019 09:53 duzenko Note Added: 0011462
22.01.2019 22:52 nbohr1more Note Edited: 0011221