View Issue Details

IDProjectCategoryView StatusLast Update
0006490The Dark ModGraphicspublic07.03.2024 20:18
Reporterwellingtoncrab Assigned Tostgatilov  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
PlatformPCOSWindowsOS Version11
Product VersionTDM 2.12 
Target VersionTDM 2.13Fixed in VersionTDM 2.13 
Summary0006490: Incorrect Specular Response on Translucent Materials in Stencil Shadows Implementation
DescriptionWhen using the stencil shadows implementation, the specular channel on translucent materials such as water seem to respond as if geometry in the lights path are non shadow casting.

Maps:
http://tinyurl.com/5fzwn9st

Stencil:
http://tinyurl.com/245sts3x

Occurs in 2.11 as well as current 2.12 beta. Occurs across entities and worldspawn regardless of light radius or material.
Does not occur with opaque materials.

See attached test map.
Steps To Reproduce-Install test_specularstencilbug.pk4
-load test_specular.map
-Toggle game settings between maps and stencil shadow implementations
TagsNo tags attached.
Attached Files
test_specularstencilbug.pk4 (1,382,043 bytes)

Activities

nbohr1more

nbohr1more

17.02.2024 21:49

developer   ~0016525

Copied from external conversation:

I think there should be some shadow response but specular also shouldn't cutoff right on the shadow edge. I think the correct thing to do is reduce the specular response in the shadow region rather than stopping it completely
nbohr1more

nbohr1more

17.02.2024 22:08

developer   ~0016526

Yep, looking at literature specular or reflections will produce glancing illumination regardless of occlusion due to the reflection angle
but the shadow will partially attenuate the reflection.
stgatilov

stgatilov

18.02.2024 10:43

administrator   ~0016529

Translucent objects cannot have stencil shadows cast on them.

They compute shadows in screen space once per light, so they can only compute them at solid objects.
To support translucent objects, one would have to recompute all shadows individually for each translucent object.

As for shadow maps, they support translucent object by some kind of bug/accident.
Here is the code inside InteractionStage which disables soft shadows for translucent objects:
    if ( !translucent && ( vLight->globalShadows || vLight->localShadows ) && !viewDef->IsLightGem() ) {
        uniforms->softShadowsQuality.Set( r_softShadowsQuality.GetInteger() );
    } else {
        uniforms->softShadowsQuality.Set( 0 );
    }
In case of stencil shadows, stencil test is used in non-soft case, which is basically disabled just before rendering translucents:
       qglStencilFunc( GL_ALWAYS, 128, 255 );
But in case of shadow maps, the shadow map still gets attached to the shader and thus takes effect (in hard code).

Now the logical resolution to this situation would be to put shadows on translucents under cvar in case of shadow map, thus making default behavior consistent between two modes.
stgatilov

stgatilov

18.02.2024 10:55

administrator   ~0016530

Committed in svn rev 10647.

I guess yet another reason to improve shadow maps in the future... sigh.

Issue History

Date Modified Username Field Change
17.02.2024 19:36 wellingtoncrab New Issue
17.02.2024 19:36 wellingtoncrab File Added: test_specularstencilbug.pk4
17.02.2024 21:49 nbohr1more Note Added: 0016525
17.02.2024 22:08 nbohr1more Note Added: 0016526
18.02.2024 10:43 stgatilov Note Added: 0016529
18.02.2024 10:55 stgatilov Note Added: 0016530
20.02.2024 18:22 nbohr1more Assigned To => stgatilov
20.02.2024 18:22 nbohr1more Status new => feedback
24.02.2024 10:16 stgatilov Status feedback => assigned
24.02.2024 10:16 stgatilov Target Version TDM 2.12 => TDM 2.13
07.03.2024 20:18 stgatilov Status assigned => resolved
07.03.2024 20:18 stgatilov Resolution open => fixed
07.03.2024 20:18 stgatilov Fixed in Version => TDM 2.13