The Witcher 3
0 of 0

File information

Last updated

Original upload

Created by

Rob Jessop

Uploaded by

rj200b

Virus scan

Safe to use

About this mod

With RT shadows on, this mod fixes most lighting artefacts on Geralt's hair and reduces pop-in of small objects' shadows by increasing the distance at which they appear, and increases the distance at which trees' shadows move. We get back some of the performance cost using some other optimizations.

Permissions and credits
Changelogs
Note on Witcher 3 4.04 patch:
The patch release notes mention improving lighting on hair - I have briefly tested it and found this mod is still useful to reduce hair issues with RT shadows (as well as improving quality).

Changes in modImprovedRayTracedShadows_v3.4:
  •  Reduced RTSTConfigInstancingDistance to 40, to fully fix all frametime spikes (stutter) that could occur when turning near trees (Thank you CapoM235i.)
Changes in modImprovedRayTracedShadows_v3.3:
  • Reduced RTSTConfigInstancingDistance from 90 to 80, to fix frametime spikes in a couple of places (thank you CapoM235i.)
Changes in modImprovedRayTracedShadows_v3.2:
  • Reduced pop-in of small objects' shadows even more - pop-in distance is now double that of vanilla. This gives great quality but is slightly slower than v3.1. Slightly reduced max distance of shadows to 600 metres.
Changes in modImprovedRayTracedShadows_v3.1:
  • New Speedtree config compatible with patch 4.03 - Now shadows move up to 35m away instead of 20m away. This gives a good balance of quality & performance. The bigger range needed for good quality before patch 4.03 isn't necessary now.
  • Fixed some occasional minor shadow jumping that could still occur in 4.03.
Changes in modImprovedRayTracedShadows_v3.0:
  • Removed Speedtree settings. In Witcher 3 4.03 CDPR have fixed the jumping tree shadow glitches.
  • Mostly fixed issues with Geralt's hair (which is still not fixed in patch 4.03.)
  • New default setting to reduce pop-in of small objects compared to vanilla. 

Known bugs:
  • Hair isn't always perfect, but it is much more often correct, especially at dawn and dusk, than without the mod.
  • Shadows of very small objects like cups may still visibly pop-in. I think Witcher 3's heuristic for what to add to ray tracing underestimates small objects with a cube shaped bounding box.
  • At some angles grass shadows may disappear at the screen edge. This is because grass is only ray-traced in screen-space and not in world-space
These bugs are present in Witcher 3 and can only be reduced, not fixed by the mod.

Dependencies: None

Compatilility:
  • Tested with Witcher 3 4.03 and 4.04.
  • Not compatible with FasterRTifNoRTShadows.ini from "Faster RT if No RT Shadows" mod (https://www.nexusmods.com/witcher3/mods/7891). However, you CAN use it with FasterRTUltraPerformanceGlobalIllumination.ini from that mod.

Install:

Extract ImprovedRayTracedShadowsHigh.ini from the zip and put it in \bin\config\platform\pc inside your Witcher 3 install directory.


Configuration:

In the Graphics menu:
  • Set Ray Traced Shadows to ON.
  • Set Shadow Quality to LOW.

Disabling/uninstalling:
Delete the ini, switch back to a higher Shadow Quality & turn off RT shadows. Note: the mod has some performance cost even if RT shadows are off, so don't just leave the ini file there. 

Info on the in-game "Shadow Quality" setting:

"Shadow Quality" only affects non-RT shadows (cascade shadows). Cascade shadows maps are generated even if RT shadows are ON. Why did CDPR not disable cascade shadows? While RT shadows apply to the main opaque render pass, the old cascade shadows are used in reflections, on the top layer of Geralt's hair, and some other hair and translucent things.

Generating ultra quality cascade shadow maps has a high performance cost. It's not worth it if they're not applied to any normal flat surfaces. 99% of reflections in W3 are water, either muddy puddles or with waves, not perfect mirrors. Therefore you really cannot tell that the shadow maps are lower detail.

You still see problems in Geralt's hair when RT and cascade shadows are significantly different. This mod fixes the big differences near dawn and dusk, but there are still moments when they don't match (if they were identical there would be no point in choosing RT shadows!)

Customization for even higher quality:

I do not recommended this. Even higher settings may seem fine much of time, but in some scenes it can become very CPU limited and performance can drop dramatically - sometimes even below 30FPS.

You can edit the ini file:

  • If you want even less shadow pop-in then try setting ProximityTLASObjectAngleSize a bit lower (e.g. to 0.03).
  • If you want tree shadows to move even further away then increase RTSTConfigUpdateDistance and RTSTConfigUpdateWindSimBlendDistance (e.g. to 60/55).
  • For vanilla quality/performance but with the hair fix remove everything except the [Rendering] section.

Performance:
It can vary a lot depending on your system, other settings, the location in game. It impacts both GPU and CPU. Example on my system:

    GPU: Nvidia 3080Ti
    CPU: AMD Ryzen 9 5900X
    Resolution 3180x2160 DLSS Performance mode
    W3 Version: 4.03
    Settings: All Ray Tracing effects on, Global Illumination performance mode, other settings Ultra, except where noted.
     is installed (from my mod: https://www.nexusmods.com/witcher3/mods/7891),

    Scene: Novigrad square, on step in front of Pyre. This is probably the most demanding scene in the game, and it's CPU bound with or without the mod so difference is small.
    
    Frame-rates with mod:
  • 46FPS (RT Shadows ON, non-RT "Shadow Quality" Low, mod v3.2 - v3.4)
  • 47FPS (RT Shadows ON, non-RT "Shadow Quality" Low, mod v3.1 or v3.0)
Note: these are typical framerates, mod v3.1 - v3.3 had occasional stutter (dropped frames) when turning in areas with trees. v3.4 and v3.0 are much smoother (more consistent frame time.)   
     
    Frame-rates without mod :
  • 48FPS (RT shadows ON, "Shadow Quality" Ultra; more of pop-in and hair issues)
  • 49FPS (RT shadows OFF, "Shadow Quality" Ultra)
        
    Scene: Broken Bridge fast travel point, White Orchard (lots of trees, which are hard work for ray tracing)
        
    Frame-rates with mod:
  • 56FPS (RT Shadows ON, non-RT "Shadow Quality" Low, mod v3.2 - v3.4)
  • 57FPS (RT Shadows ON, non-RT "Shadow Quality" Low, mod v3.1)
  • 60FPS (RT Shadows ON, non-RT "Shadow Quality" Low, mod v3.0 with vanilla tree update distance)
Note: these are typical framerates, mod v3.1 - v3.3 had occasional stutter (dropped frames) when turning in areas with trees. v3.4 and v3.0 are much smoother (more consistent frame time.)
    
    Frame-rates without mod :
  • 56FPS (RT shadows ON, "Shadow Quality" Ultra; more of pop-in and hair issues)
  • 61FPS (RT shadows OFF, "Shadow Quality" Ultra)

Note on Witcher 3 4.04 patch performance compared to 4.03:
  • Some quick testing shows higher FPS on 4.04 both with and without the mod. At the broken bridge it's small (+1FPS) but in Novigrad it's about 4 FPS faster both with and without the mod!


Technical Info:

ImprovedRayTracedShadowsHigh.ini contains:

[Rendering/RT/SpeedTree]   
RTSTConfigInstancingDistance=40
RTSTConfigUpdateDistance=40
RTSTConfigUpdateWindSimBlendDistance=35
RTSTConfigSkinnedTimeout=63

[Rendering/RT]
ProximityTLASObjectAngleSize=0.05
ProximityExtendedTLASSize=600
DebugTlas=0

[Rendering]
TerrainShadowsDegreesLimit=1.000000
CascadeShadowsDegreesLimit=1.000000


It's possible to put that in your dx12user.settings instead of install in the ini. Unfortunately it's not possible to apply the cascade shadow changes from an ini nor make a mod that does everything via a menu (I tried, the game refuses to save some ini settings to dx12user.settings.)


What does each setting do?

[Rendering/RT/SpeedTree]  
RTSTConfigInstancingDistance=40 (default: 20)
    Distance in metres at which trees get their own shadow. Beyond that different trees of the same type share the same model in Ray Tracing's view of the world. Higher values (e.g. 80) can fix some occasional shadow jumps (possible even after the 4.03 patch) where one of several trees sharing a model switches to having it's own model; however, stutter (occasional spikes in frame times) has been observed with values greater than 53. Therefore, to be safe, in mod v3.4 this was reduced to match RTSTConfigUpdateDistance.
    
RTSTConfigUpdateDistance=40 (default: 20)
    Distance in metres at which trees get updates and move with the wind in ray tracing's view of the world. At the default  of 20 you'll notice mid-distance trees' shadows are still. At 35 it's much better but you still notice some static shadows at dawn and dusk when shadows are long, but at least they don't jump since patch 4.03. Increasing this has a big performance cost and that cost increases quickly - proprortionate to the square of the distance. It's updating ray tracing's acceleration structure for each tree each frame that is expensive.
    
RTSTConfigUpdateWindSimBlendDistance=35 (default: 15)
    This is the new feature added in Witcher 3 patch 4.03 to fix jumping tree shadows. It is the distance at which trees move fully with the wind. Between RTSTConfigUpdateWindSimBlendDistance and RTSTConfigUpdateDistance it gradually reduces the wind effect down to zero. This 5 metre transition zone fixes the annoying shadow jumping that occurred prior to patch 4.03.

RTSTConfigSkinnedTimeout=63 (default: 16)
    Added in v3.4. Increasing this valued reduced the stutter that occurred with RTSTConfigInstancingDistance > 53, but did not eliminate it. Smaller values hurt performance. Changing this was perhaps not necessary with RTSTConfigInstancingDistance=40 in v3.4, but I have left the higher value just in case.

[Rendering/RT]
ProximityTLASObjectAngleSize=0.05 (default: 0.1, smaller is higher quality)
    This angle is a slice of a circle around the camera. Only objects estimated to appear bigger than this on screen get added to ray tracing's acceleration structure, and therefore cast shadows, appear in reflections, and affect Global Illumination.
    
    Higher values mean more shadow pop-in nearer the camera. With the default value you get some quite visible pop-in of some objects' shadows; lanterns and plant pots outside the Passiflora in Novigrad are a good example.
    
    Decreasing it has a significant performance cost, because many of the objects affected are people, who are animated every frame, and updating the acceleration structure is expensive. The likely number of objects & people will increase proportionately to the square of 1/ProximityTLASObjectAngleSize, so halving ProximityTLASObjectAngleSize doubles the distance and will result in 4 times the number objects.
       
ProximityTLASSize - unchanged (default 400)
ProximityExtendedTLASSize=600 (default 800)
    This is the max distance in metres at which small and big objects get added to ray tracing. In earlier versions I reduced ProximityTLASSize. Since patch 4.03 ProximityTLASSize seems to have no effect. I believe the performance improvements in that patch merged everything goes in one TLAS controlled by ProximityExtendedTLASSize. Small performance improvement and you probably won't notice the difference. With a very long view across the world shadows are going to disappear at some point anyway and at 600m it still looks fine overall.

DebugTlas=0 (default: 1)
    TLAS stands for top-level acceleration structure, which is ray tracing's view of the world. End users don't need any extra developer debug code running. Setting to 0 has no visual impact but I believe improves performance (it's hard to measure it's < 1FPS)

[Rendering]
TerrainShadowsDegreesLimit=1.000000
(default: 15)
CascadeShadowsDegreesLimit=1.000000 (default: 15)

    This mostly fixes the hair problems when RT shadows are on. Without this, near dawn and dusk you get cases where the bottom layer of Geralt's hair is in shadow but the top layer is lit by the sun, which looks really bad. Why does this happen? The transparent top layer of fine hair is in a later render pass and uses cascade shadows instead of RT shadows. By default when rendering cascade shadow maps Witcher 3 pretends the sun is always at least 15 degrees above the horizon. However for Ray Traced shadows it uses the real position of the sun. Why would it change the angle for cascade shadows? Probably because cascade shadows look bad and pixelated when shadows are very long and stretched.
    
    Changing that minimum angle to 1 degrees makes the RT shadows and cascade shadows line up better so hair issues are much much rarer. Of course they don't match exactly - we use RT shadows because they are more accurate and look better than cascade shadows! However, with this change any inconsistencies should be small and very brief and hard to notice as you move in and out of shadow.
    
    As previously mentioned, lower quality cascade shadows are okay - all big flat surfaces where you'd notice issues use RT shadows.
    
    
My descriptions are based on experimentation and from reading public papers and documentation about rendering. I have no special access or knowledge of Witcher 3's closed source engine so my explanations might not be perfect.

All my MODs:

FSR DLSS improve quality by enabling jitter on transparent - https://www.nexusmods.com/witcher3/mods/8186
Faster Ray Tracing Ultra Performance RT - https://www.nexusmods.com/witcher3/mods/7891
Improved Ray Traced Shadows - https://www.nexusmods.com/witcher3/mods/7685