Source SDK

Source SDK

Not enough 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 )
< >
9 Comments
BAOSIC PRODUCTIONS Mar 27 @ 12:31pm 
Now that guide fixed SSR too
He is Watching you[RUS] Jan 24 @ 5:25am 
gmod. When i put Copy Depth Buffers Before Clear Operation on, game is crashing:Toxic_Geralt:
Someone Sep 18, 2020 @ 2:05pm 
Worm Jun 2, 2020 @ 10:25am 
i'm so happy someone figured this out! AO is so beautiful but the flickering was driving me crazy, now i can play with AO and no issues! thank you.
jelbo May 13, 2020 @ 2:12pm 
Great, thanks for figuring it out and sharing.
Chapmike Apr 26, 2020 @ 10:09pm 
OK I found out what happened. Make sure the game is not running in compatibility mode.
Chapmike Apr 26, 2020 @ 9:57pm 
It doesn't work. I followed the installation instructions precisely, but if the dll file is present with the exe file, the game won't launch at all. And if the dll file is absent from there and only in the bin folder, then reshade doesn't load.
VΞlir ₇₃₃₁  [author] Jan 21, 2020 @ 1:51am 
Ktoś kto ma chęć swoją gierke zrobić ;) A uwierz mi ten silnik nigdy się nie zestarzeje ze względu na wygode i możliwości obsługi :D
GOBAR Jan 20, 2020 @ 8:51pm 
kto normalny gra w hl2 w 2k20 wtf XD