-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Details
Since _rt_ResolvedFullFrameDepth is IMAGE_FORMAT_RGBA8888 and only using red channel, it has very little precision. Custom shaders were allowed recently, but they still suffer from imprecision because of this limitation. Upgrading the depth buffer will allow for better screenspace shader effects, such as SSAO. For now, it's not possible because of a crappy 8 bit depth buffer.
This removes large artifacts from using depth buffer in custom shaders (Normal reconstruction is an example of that)
But it might not work with default DOF with gmod shaders.
Proposed solution
Make a separate _rt_ResolvedFullFrameDepth32 rendertarget with the IMAGE_FORMAT_R32F image format, which will be copied to the good old rt_ResolvedFullFrameDepth rendertarget with IMAGE_FORMAT_RGBA8888 image format. This preserves backwards compatibility, whilst improving precision.
Activity
artemking4 commentedon Jan 12, 2025
An example of some artifacts caused by the current depth buffer.
goodusername123 commentedon Jan 12, 2025
If a separate render target where to be added as purposed in this request the name should a bit more verbose imo "
_rt_ResolvedFullFrameDepth32" I feel is slightly too ambiguous, something more upfront like "_rt_ResolvedFullFrameDepth_R32F" or "_rt_ResolvedFullFrameDepthR32F" might be better.Akabenko commentedon Jun 24, 2025
32 bit depth buffer fix:
DepthWrite&ProjPosZ#2968