Source SDK

Source SDK

29 ratings
How to install and fix ReShade SSAO (Ambient Occlusion) for Source Engine
By VΞlir ₇₃₃₁
In this tutorial i will show you how to install ReShade and repair messed DepthBuffer in Source Engine for SSAO/DepthOfField shaders
   
Award
Favorite
Favorited
Unfavorite
General
I am making sourcemod in SDK 2013 branch and I want to improve Source graphic a bit so i installed ReShade but then i realised something is wrong with AO, so i started to tweak settings with another depth buffers, disabling HUD...
But, i found a way to fix it a bit, that why i wanted to create this tutorial :D

So you want to have this?
|
No Problem! Follow my steps to fix messed DepthBuffer

Why i need DepthBuffer for ReShade?:
  • In easy words it has "informations" about depth on your ingame screen ( how far props/walls/sky is from player`s camera ) and ReShade needs these informations for SSAO, Depth Of Field and all depth related shaders
Why DepthBuffer in Source is "broken" for ReShade?:
  • VGUI ( HUD elements: health, ammo, crosshair ) makes it solid color so it has no depth information. You can fix it by typing r_drawvgui 0 in console ( but who wants to play without HUD ? ) or by choosing right Depth Buffer from DX9 Tab in ReShade but it still needs some fixes

  • MSAA makes it solid color aswell so you need to disable Antialiasing in game options ( but you can enable Anti-Aliasing in ReShade so git gut )

  • When 3D Skybox is enabled ( it usually is ) DepthBuffer will flicker ( switching between playable area and 3D Skybox`s architecture ) when player is moving and looking around ( from what i saw it switch when your crosshair is on hidden 3D Skybox area but not always ) so you need to disable 3D Skybox architecture by typing r_3dsky 0 in console or SSAO will turns ON and OFF on player`s movement

  • Color Correction can make it solid sometimes, so turn it OFF ( but in my case i can have it enabled and everything is fine )

NOTE: There are just some tricks to make it work. It is not a full DepthBuffer repair and they have also some cons! You need to disable 3D Skybox or DepthBuffer will flickers when you are moving! I have not found any solution for this yet. If you have a solution to keep 3D Skybox enabled, write a comment. Thank you :D

I will show you how to make it work for Half-Life 2, but it should works for all Source Engine games/mods in most cases.
ReShade installation
You can download it here: https://reshade.me/

> Open ReShade Setup

> Click Select game to install

> Find your game .exe ( hl2.exe in most cases ) it should be in C:\Program Files (x86)\Steam\steamapps\common\half-life 2 by default ( or in your Source SDK Base if you are working with source mod ) and click on it

> Check "Direct3D 9" API below in ReShade setup

> When window Do you want do download collection... shows up, click YES and Check All effects so you can tweak with some cool settings later

> Open your game folder ( folder where you installed ReShade and where hl2.exe is )

> Copy these files:
  • reshade-shaders folder
  • d3d9.dll
  • ReShade.ini

> Paste them in your game "bin" folder hl2/bin ( "bin" folder is in same place where hl2.exe is ) or in Source SDK Base/bin if you have a sourcemod
In game ReShade configuration
> Run your game

> You should see that ReShade is working if you see it on top

> First of all open Options --> Video --> Advanced: Turn Anti-Aliasing to None and Disable Color Correction

> Load any map

> Click "Home" key to open ReShade

> Tutorial will appear, you can read this or just Skip Tutorial

> In ReShade window go to Home tab ( it is on top )
Next
> Create your own Preset by clicking " + " on the right and write name for your Preset ( you should not use DefaultPreset )
Next
> In Home tab find DisplayDepth [DisplayDepth.fx] and active it
Next
> Go to DX9 tab and active Copy Depth Buffers Before Clear Operation
You can see something is going on

Left: Normal map ( is reversed )
Right: Depth map ( still broken, only view model is visible )

Next
> Go back to DisplayDepth in Home tab and change RESHADE_DEPTH_INPUT_IS_REVERSED from 1 to 0

Next
> Click Edit global preprocessor definitions you should have here RESHADE_DEPTH_INPUT_IS_REVERSED 0, but if there is nothing, in Current Preset ( or Global if you want to have many presets ) click on "+" and in first window write RESHADE_DEPTH_INPUT_IS_REVERSED and in second window 0 and then click Reload on bottom

> You can deactive DisplayDepth [DisplayDepth.fx] now

> We are almost done! Go back to Home tab, find MXAO [MXAO.fx] and active it
Next
> AO will flickers sometimes, so you need to disable 3D Skybox. Write r_3dsky 0 in console
Maybe someone will find solution for this :D

And you have fixed DepthBuffer! You can tweak with MXAO settings or active another depth related shader like Depth Of Field --> DOF.fx shaders, active FXAA.fx to have Anti-Aliasing

In MXAO there is not a big difference between Medium AO quality and higher and my fps stay the same on my PC when its on Medium, but when on Maximum i lose 100fps and i barely see any visual quality in FullHD resolution, so not worth for me go higher than medium :D

END
( Sorry for my poor english :D )
17 Comments
Hangdapoor236 Feb 28 @ 8:47pm 
holy shit thank you so much will never forget
Cicero Jan 8 @ 2:00pm 
THANK YOU SO MUCH MAN
Solar Oct 5, 2023 @ 12:51am 
i dont have a DX9 tab in reshade
pedroalvarez1986@gmail.com.mx Sep 22, 2022 @ 11:54am 
okay im dumb as fuck and didnt read, everything is working great, thanks alot
pedroalvarez1986@gmail.com.mx Sep 22, 2022 @ 11:51am 
many of the RESHADE_depth bullshit doesnt appear in my home tab, its not in the advanced options either
Kaz Aug 28, 2022 @ 7:27pm 
Thanks for this! For anyone using a more recent version of ReShade, you can find the "Copy Depth Buffers Before Clear Operation" setting under the "Generic Depth" section in the "Add-ons" tab.
sudologic Mar 29, 2022 @ 8:24pm 
It seems like a recent update to ReShade removed the D3D9 tab. For now I'll be using the older version as that still seems to work.
METRO Feb 24, 2022 @ 6:26pm 
I think I've found a fix for the AO flickering. You need to disable steam overlay to prevent it from happening, no need to disable 3dsky
BAOSIC PRODUCTIONS Mar 27, 2021 @ 12:31pm 
Now that guide fixed SSR too
Killa Jan 24, 2021 @ 5:25am 
gmod. When i put Copy Depth Buffers Before Clear Operation on, game is crashing:Toxic_Geralt: