Hi, you are using UE4.26 so there is an example created by Unreal Engine team under the plugin Water.
Start with enabling the Water plugin in the editor : Settings->Plugins->Water and the restart your engine.
Once you enable the plugin you can enable “Show plugin Content” in the content browser :
You can find a post process material for “Under Water”, this is the reference and the path to the material :
Water/Materials/PostProcessing/M_UnderWater_PostProcess_Volume.M_UnderWater_PostProcess_Volume
UnrealEngine/Engine/Plugins/Experimental/Water/Content/Materials/PostProcessing/M_UnderWater_PostProcess_Volume.uasset
The material doesn’t go darker when you swim deeper but I think this could be a starting point for you to create a material based on this one.
Here’s the release note of UE4.26 : Unreal Engine 4.26 Release Notes | Unreal Engine Documentation you can search water for more explanation about the water plugin.
Have a nice day