Skip to content

Generic Depth Mod

BlueSkyDefender edited this page Sep 5, 2026 · 1 revision

Generic Depth Mod (GDM)

Enhanced automatic depth buffer detection for SuperDepth3D.

The Generic Depth Mod is a ReShade add-on - not a shader. It is a modification of ReShade's own depth buffer detection add-on (Example 09-depth by Patrick Mours, BSD-3-Clause) that picks the right depth buffer far more reliably, and then hands SuperDepth3D the exact numbers it needs instead of leaving the shader to guess them.

Where to get it: the Depth3D Discord, or deploy it from the Depth3D card in GPU Selector. There is no public download page for it.


What it fixes

Without the add-on the shader has to infer two things from the picture itself, and both guesses can be wrong:

1. Where the game actually rendered inside the depth texture. Engines pad the depth allocation. Unreal is the usual offender - Moss renders a 2560x1440 scene into a 2560x1536 depth texture and leaves dead rows at the bottom. Upscalers make it worse: Pools on FSR3 renders 1600x900, 1312x738 or 880x496 into a 2560x1440 texture depending on the quality setting. The shader's Letter Box Detection and Auto Scaler try to find that sub-rect by looking at the content. GDM just tells it.

2. Which pixels are the weapon hand. Traditionally the weapon hand is separated out of the shared depth buffer with a hand-tuned CutOff Point in the Weapon Hand Adjust section - one number per game, found by trial and error. GDM can supply a separate depth buffer that only contains the first-person hand, so no cutoff tuning is needed at all.


Install

The easy way - GPU Selector (recommended)

GPU Selector deploys it for you and, critically, automatically disables ReShade's built-in Generic Depth in ReShade.ini when the add-on is deployed to a game. Two depth-detection add-ons fighting over the same buffer is the single most common reason people say "I installed GDM and nothing changed", and this removes that failure mode.

  1. Open the Mods tab (press 5).
  2. On the ReShade card, set Build Type to Full Add-on Support, then Download ReShade and Launch the wizard against your game.
  3. Deploy the Depth3D card - the Enhanced Generic Depth (GDM) add-on is installed from here.
  4. Use Manage Add-on Games if you want it active for some games but not others.

The manual way

  1. Install ReShade with full add-on support. The add-on API is not present in the add-on-free build.
  2. Get the add-on from the Depth3D Discord and put the .addon64 (or .addon32 for a 32-bit game) next to the game's .exe, in the same folder as the ReShade DLL.
  3. Launch the game. Open the ReShade menu and go to the Add-ons tab - Generic Depth Mod should be listed there with its own settings.
  4. Turn ReShade's stock Generic Depth add-on off. GDM replaces it, and if both are running they will fight over the buffer. GPU Selector does this step for you; by hand, you have to remember it.

The two shader-side switches below are set in ReShade's Preprocessor Definitions panel, at the bottom of SuperDepth3D's settings.


GDM_DEPTH_AUTOFIT - Exact Depth Buffer Fit

GDM_DEPTH_AUTOFIT 1   (default - leave it on)

While the add-on is present and its Depth Auto-Fit switch is on, it feeds the shader four values:

depth_resolution      float2   The full size of the depth texture, padding included.
depth_viewport_size   float4   XY = the origin of the rendered sub-rect inside that texture.
                               ZW = the size of that sub-rect.
depth_autofit         bool     The master on/off. Everything below is gated on this.
depth_render_size     float2   The largest viewport the add-on has seen - the real render region.
                               Only sent when the add-on's "full render region" switch is on;
                               zero otherwise, and then the back buffer is used as the reference.

From those the shader maps the screen coordinate straight onto the rendered sub-rect. Two cases:

  • Normal case - the rendered region is what the screen shows, so it stretches across the screen. One ratio covers a padded texture (Moss) and any upscaled or windowed render (Pools).
  • Letter/pillar box - the region's shape does not match the render region. It sits top-aligned in the depth texture but centred on screen (The Suffering 2: 2560x1071 inside 2560x1440), so the shader scales from the full region and shifts by half the gap. A 2% tolerance separates a real letterbox from ordinary rounding - render resolutions land on multiples of 8 or 16, so an upscaled region is only approximately the screen aspect.

While Auto-Fit is active the shader deliberately stands down its own guesswork:

  • Letter Box Detection is switched off.
  • The Upscaler Guided / Starting Resolution rescale is skipped, so a stale value left in an old preset cannot stack on top and double-correct.

Why it defaults to 1 and why that is safe

Every one of those uniforms reads zero when the add-on is absent or switched off, so the branch is never taken and the behaviour for anyone without the add-on is completely unchanged. The runtime depth_autofit uniform is the real switch. It defaults to 1 rather than 0 specifically so that ReShade's "Reset all to default" - which clears preprocessor definitions - cannot silently compile the fit back out from under someone who is relying on it.

DX9

Auto-Fit is compiled out entirely on DirectX 9. The D3D9 ps_3_0 uniform budget is 224 float4 constant registers and SuperDepth3D has them all spoken for; a float4 uniform needs one whole aligned register and there is not one left, so declaring depth_viewport_size on DX9 fails every game with error X4509 maximum constant register index exceeded. The add-on-fed data is not needed on DX9 anyway, so it only exists on DX10 and up, where constant buffers are large.


GDM_WEAPON_DEPTH - Dedicated Weapon Hand Buffer

GDM_WEAPON_DEPTH 0   (default - legacy shared-DepthBuffer path)
GDM_WEAPON_DEPTH 1   (use the dedicated WDEPTH buffer)

Turn this on only when GDM is installed and supplying a weapon buffer for your game. With it on, the shader allocates a second depth texture bound to the WDEPTH semantic and reads two more add-on uniforms:

weapon_present    bool   The add-on has a weapon buffer for this game right now.
bufready_wdepth   bool   The WDEPTH resource is ready to sample.
WDEPTH          texture  The weapon-hand depth buffer itself.

How the automatic cutout works. The WDEPTH buffer clears its background to the far plane, and the shader linearises it so 0 is near and 1 is far. The hand is therefore simply every pixel nearer than far - detected straight from the buffer:

Legacy   CutOFFCal = step(DM.x, (CoP / DMA()) * 0.5)   ← needs a per-game CutOff Point
GDM      CutOFFCal = WPresentCheck ? step(WD, 0.999) : 0   ← no tuning at all

So with GDM_WEAPON_DEPTH 1 the X CutOff Point in Weapon Hand Adjust stops mattering. The other three - Precision, Tuning and Scale - still do their normal jobs on the hand once it has been isolated.

The same Auto-Fit correction is applied to WDEPTH with no extra numbers: the add-on only accepts a weapon buffer whose width, height and format match the world buffer, so the world fit is correct for the hand too.

It is off by default because it costs a texture/render-target slot, which matters on slot-limited APIs like DX9.


Quick reference

Without GDM With GDM
Depth buffer choice ReShade Add-ons/Depth tab, by hand Automatic, improved detection
Padded depth texture (Unreal) Letter Box Detection guesses it Exact viewport from the add-on
Upscaler changing render size Upscaler Guided / Auto Scaler, by hand Handled per frame
Letterboxed render Content-based Letter Box Detection Exact sub-rect, centred correctly
Weapon hand isolation Per-game CutOff Point, by trial and error Automatic from the WDEPTH buffer
DX9 - Auto-Fit not available (register limit)

Troubleshooting

The shader banner says "Needs Mod". That is the profile telling you this game wants an external mod or add-on - GDM is one of the things it means.

Nothing changed after installing. Check the Add-ons tab actually lists Generic Depth Mod. Check ReShade is the add-on-enabled build. Check the stock Generic Depth add-on is off - this is the usual culprit, and deploying through GPU Selector handles it automatically.

The image drifted after turning Auto-Fit on. Clear any leftover manual correction from your preset - Upscaler Guided, Upscaler Offset, Letter Box Scaler, and anything in Reposition Depth. Auto-Fit already accounts for what those were compensating for, and the shader only auto-disables the ones it knows about.

Weapon hand looks wrong with GDM_WEAPON_DEPTH 1. The add-on has no weapon buffer for that game. Set it back to 0 and use the normal CutOff Point workflow.


Credits & License

Original work: ReShade Example 09-depth by Patrick Mours, BSD-3-Clause. Modifications by Jose Negrete (BlueSkyDefender), October 2023. Personal use is permitted; redistribution requires authorization from the author.

Buy Me a Coffee  |  🌐 Depth3D.info  |  Discord

Clone this wiki locally