File information

Last updated

Original upload

Created by

KiasuBurger

Uploaded by

KiasuBurger

Virus scan

Safe to use

Tags for this mod

About this mod

This script-based mod turns on ray-traced shadows for all meshes in a new way that doesn't require modifying or patching any game files, ensuring that it will not conflict with other mods and can turn on shadows for both base-game and mod mesh. While it is focused on photo mode player shadows, it can also affect NPCs and environmental objects.

Requirements
Permissions and credits
Changelogs
Description

This script-based mod turns on ray-traced shadows for all meshes in a new way that doesn't require modifying or patching any game files.

While there have been a number of mods from various creators that attempt to turn on ray traced shadows for different subsets of game entities, the fact that this required modifying/patching meshes and entity files meant that it was never possible to do completely, as there are simply too many entities, and mods have to be handled as well. While some mod authors turned on the necessary flags for their mods, others didn't know they had to do anything, and so end up with missing shadows on their items.This can lead to situations where the combination of an existing shadow mod with a clothing or equipment mod results in missing shadows in photo mode.

To try and deal with this once and for all, this mod takes a scripting based approach, using Codeware's capability to hook into resource and entity loading to dynamically set the required shadow properties as the game loads the meshes and entities. This means we can touch every single object, whether it's a base game or modded one.

Additionally, this mod also incorporates disabling the normally un-hidable non-RT player shadow in photo mode. This fake shadow overlaps with the raytraced shadows, creating weird effects - most particularly phantom shadows on hands. I believe this is the first mod to do this for Masc V.

Credits

  • Aeryn for providing an invaluable writeup of the state of raytraced shadows and the techniques that can be used to fix them
  • PinkyDude and Zwei for demonstrating these techniques in their shadow fix mods
  • Psiberx for explaining the Codeware functionality I needed to make this mod possible
  • OneSlowZZ, Gilde136, Sneaky-Badger3, and raemaze for all the testing help!
  • Amon, OneSlowZZ, Gilde136, and Sneaky-Badger3 for providing demonstration images


Thank you all! I couldn't have done this on my own.

Compatibility

  • I have only tested with 2.13. It's likely that it works with older releases, but you will ultimately be constrained by needing Codeware >= 1.9.0 and whatever that depends on.
  • This will only have an effect in RT or PT mode. Raster shadows should remain unchanged.


Implementation Details

There are three primary mechanisms implemented by this mod:

Turning on ray-traced shadows for meshes

This is the standard property that we generally want to set for meshes. It tells the game to ray-trace shadows for them. This is especially important for modded entities because mod authors (me included) generally don't think too much about shadow meshes and so the item may lack one or be using a completely inappropriate one carried over from us base-game entity.

Setting this property on all meshes means that all visual items in the game could benefit, although the focus is on the player. NPCs, Vehicles, and environmental objects could all gain missing shadows, but I haven't tried to verify where this happens.

Setting Component shadow flags to Default

Zwei's mod documents why this seems to be the preferred setting in the latest release of the game. I didn't observe a difference between setting both to Default or both to Always, even in non-RT, but if we ever find a reason to change it, that's easy to do.

Disabling the Player Photo Mode Shadow Mesh

Also as documented in Zwei's mod, this is an odd entity - it's a shadow mesh that is forced on during photo mode regardless of the ray tracing mode. Its presence results in double shadows, and bad visual results, especially on hands.I used a different technique to get rid of this (Zwei replaced it with a different non-player shadow mesh, while I turned off the "isPlayerShadowMesh" flag inside the mesh itself).

Q&A

Why is the first-person player shadow still so terrible?

The game insists on disabling ray-traced shadows for the player body in first-person mode (FPP). Consequently, the body itself is always the fake shadow mesh. I believe the game does this because the actual shape and proportions of the FPP player body are a distorted eldritch horror (as tends to be the case in first-person games) so they have to use a fake shadow that looks more believably human. It's almost certainly possible to find the correct combination of settings that will turn ray traced shadows on, but the result may not be what you hoped for...

The end result is that NPCs have better shadows than V. Such is life in Night City.

My car/bike/dumpster still have crap shadows?

As noted, I've not really tried to improve non player shadows. The mesh flag may benefit these other kinds of entities, but equally there are separate entity level properties that control shadow behaviour, and these may need to have specific values to get proper shadows. Equally, there are some mods that disable ray traced shadows on environmental entities because they look terrible, so maybe it's for the best that I'm not doing more here.

Should there be a difference between RT and PT?

No. While the rendering techniques differ, they both follow the shadow settings in the same way, so you'll get the same results, modulo the inherently better accuracy of PT.

What about non-RT/PT shadows?

In theory, you should see identical shadow behaviour to vanilla if RT/PT are disabled. But if you see anything that's become worse, let me know and I'll investigate.

What if I've found something that looks worse with this mod than without?

This could happen - I am blindly touching all meshes and body/clothing/equipment entities, so there might be some edge cases where the shadows are problematic. This is most likely to happen in situations where multiple Garment Supported enabled items are layered together, as the game appears to calculate shadows from the original item shape, rather than the compressed form. It's hard to handle this situation as you want the item to have shadows under normal conditions and it's not easy, and possibly impossible, to tell if it's being compressed or not. On balance, I believe we're better off with shadows everywhere rather than missing them on mod items. On the other hand, if you find a mesh that has a fundamentally broken shadow, let me know and I can look into filtering it out.

Can I uninstall all my other shadow mods?

There won't be any harm in keeping your existing installed shadow mods, but conceptually, any other mod that is setting Mesh or SkinnedMeshComponent properties should not be required once this mod is installed. Some other shadow mods modify materials or other types of entities, and these mods will continue to provide benefits.