View Issue Details

IDProjectCategoryView StatusLast Update
0006076The Dark ModGraphicspublic28.11.2022 21:14
Reporterstgatilov Assigned Tostgatilov  
Status resolvedResolutionfixed 
Product VersionTDM 2.10 
Target VersionTDM 2.11Fixed in VersionTDM 2.11 
Summary0006076: Optimize soft stencil shadows limit expensive sampling for near-penumbra regions
DescriptionRight now when user enables soft stencil shadows, expensive stencil + depth sampling is performed for all fragment of the surfaces being rendered.
Most of the surfaces are fully lit of fully unlit and far enough from penumbra, so if we can detect such state, we can cull away this expensive sampling.

The idea is to divide screen into "tiles", and for each tile precompute if it only has "lit" or "unlit" values.
Then pass this tile texture into interaction shader, sample it there. If it says 0.0 or 1.0, then just use this value and avoid sampling.

Note that in order to make it work, we need hard upper bound on sampling radius in screen pixels.
Luckily, the original implementation of soft stencil shadows already have one.
Additional InformationInternal discussion:
TagsNo tags attached.




03.09.2022 09:39

administrator   ~0015223

Committed in svn rev 10107.
Enabled by cvar r_softShadowsMipmaps: but only for stencil shadows, and only with new backend.

And interesting thing is that we now have a file used both from C++ and GLSL.
It's called tdm_shadowstencilsoft_shared.glsl and contains just a tiny function.
But this is first precedent, and I think such usage will increase in future.

It seems that this optimization is not always good.
Even though filling tiled mipmaps takes only 20 us, it causes performance degradation when there are many shadow-casting lights.
Attached Tracy view of single frame on New Job (on street near tavern entrance).


24.10.2022 20:20

administrator   ~0015351

A small shader compiler fix for Linux+AMD driver in svn rev 10140.


18.11.2022 21:16

administrator   ~0015450

r10160. Fixed bug in idImage::GenerateAttachment.


28.11.2022 15:44

developer   ~0015497

Screen-shots in stencil mode are currently black when this feature is enabled.


28.11.2022 21:14

developer   ~0015503

Screen-shot issue fixed with Rev 10187

Issue History

Date Modified Username Field Change
21.08.2022 15:40 stgatilov New Issue
21.08.2022 15:40 stgatilov Status new => assigned
21.08.2022 15:40 stgatilov Assigned To => stgatilov
03.09.2022 09:39 stgatilov Note Added: 0015223
03.09.2022 09:39 stgatilov File Added: Newjob_TiledScencilShadows.png
03.09.2022 09:39 stgatilov Status assigned => resolved
03.09.2022 09:39 stgatilov Resolution open => fixed
03.09.2022 09:39 stgatilov Fixed in Version => TDM 2.11
24.10.2022 20:20 stgatilov Note Added: 0015351
18.11.2022 21:16 stgatilov Note Added: 0015450
28.11.2022 15:44 nbohr1more Note Added: 0015497
28.11.2022 21:14 nbohr1more Note Added: 0015503