doodlum / skyrim-community-shaders

Community-driven advanced graphics modifications for AE, SE and VR. Also fixes bugs and improves performance.
GNU General Public License v3.0
187 stars 46 forks source link

SSR causes dark/transparent water below the compass #510

Open alandtse opened 2 months ago

alandtse commented 2 months ago

I also confirmed this is vanilla IS behavior too. The issue is ISReflectionsRayTracing.hlsl.

If you dip your view lower in water, there is a small area above the reflection that is just the basecolor for the scene. This is basically the texture without water so it gives an xray view of water (and is normally darker than the actual water).

This is coc guardianstones; fw skyrimclear_a around 10AM.

In the image, notice that dark line indicated by the red hash. Above it you can see the rock, but that is actually a transparency coming from SSR. image

This can be seen by looking at the kSSR_RAW. image The red arrow points to the actual SSR. Black areas indicate where no ray was returned. Above the arrow you will see the kMain texture which is the scene without any water and is the cause of the bug. Basically, the SSR texture is incorrectly detecting a ray hit and finding the actual texture available at that location. image

Potentially solution probably in the water shader. There are two values from kSSR_RAW that can probably be treated as erroneous and should be ignored.

  1. float4 (0,0,0,0), which is when no ray was hit and the default color from ISReflectionsRayTracing.
  2. The value at RefractionTex, which is the erroneous x-ray value identified here.

NOTE: kSSR is a blurred version of kSSR_RAW and it's values will not be exact anymore. However, if the erroneous value is detected in kSSR_RAW, both should be ignored and potentially replaced with the CubeMapTex if available, or some other valid value. Renderdoc keeps saying ReflectionTex is empty (and may just be an alias for kSSR_RAW), so that may not be available.

EDIT: The issue is by water shader ISSAOComposite has been run on RefractionTex so the values will not match so 2 may not be detectable.

alandtse commented 2 months ago

The other question is why the actual SSR reflection is so much lower. Best seen in game, you can see the SSR reflection slowly lower as the view is lowered and see the bad values stretch downwards. Beyond just ignoring the bad values, it may be worthwhile to just figure out where this happens and then delete the entire section with the problem and shift up the remaining values: image

alandtse commented 2 months ago

Another note on when the artifacts starts appearing, if you use the crosshair, it actually seems to be a decent way to figure out when the artifacts will start. Without moving, just tilt the crosshair. As long as the crosshair is pointing at the valid reflection or above, there are no artifacts. As soon as it crosses below the point where the reflection was valid into an area without a reflection, the distortion begins to happen and the reflection shifts down.