Skip to content

Commit

Permalink
Turn on the SSAO depth pass so we can have some nice SSAO.
Browse files Browse the repository at this point in the history
  • Loading branch information
BSVino committed Jul 3, 2014
1 parent cba3a7a commit 0ded18e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 12 deletions.
38 changes: 38 additions & 0 deletions mp/src/game/client/sdk/da_view_scene.cpp
Expand Up @@ -51,6 +51,44 @@ CDAViewRender::CDAViewRender()
m_flStyleLerp = 0;
}

void CDAViewRender::Init()
{
BaseClass::Init();

ITexture *depthOld = materials->FindTexture( "_rt_ResolvedFullFrameDepth", TEXTURE_GROUP_RENDER_TARGET );
static int flags = TEXTUREFLAGS_NOMIP | TEXTUREFLAGS_NOLOD | TEXTUREFLAGS_RENDERTARGET;
if ( depthOld )
flags = depthOld->GetFlags();

int iW, iH;
materials->GetBackBufferDimensions( iW, iH );
materials->BeginRenderTargetAllocation();
materials->CreateNamedRenderTargetTextureEx(
"_rt_ResolvedFullFrameDepth_DA",
iW, iH, RT_SIZE_NO_CHANGE,
IMAGE_FORMAT_RGBA16161616F,
MATERIAL_RT_DEPTH_NONE,
flags,
0);

materials->CreateNamedRenderTargetTextureEx(
"_rt_ssao_0",
iW, iH, RT_SIZE_NO_CHANGE,
IMAGE_FORMAT_RGBA16161616F,
MATERIAL_RT_DEPTH_NONE,
flags,
0);

materials->CreateNamedRenderTargetTextureEx(
"_rt_ssao_1",
iW, iH, RT_SIZE_NO_CHANGE,
IMAGE_FORMAT_RGBA16161616F,
MATERIAL_RT_DEPTH_NONE,
flags,
0);
materials->EndRenderTargetAllocation();
}

ConVar da_postprocess_compare( "da_postprocess_compare", "0", FCVAR_CHEAT|FCVAR_DEVELOPMENTONLY, "Only render to half of the screen for debug purposes" );
ConVar da_postprocess_deathcam_override( "da_postprocess_deathcam_override", "-1", FCVAR_CHEAT|FCVAR_DEVELOPMENTONLY, "Override the control for death came mode" );

Expand Down
2 changes: 2 additions & 0 deletions mp/src/game/client/sdk/da_view_scene.h
Expand Up @@ -9,6 +9,8 @@ class CDAViewRender : public CViewRender
public:
CDAViewRender();

virtual void Init();

virtual void Render2DEffectsPreHUD( const CViewSetup &view );
virtual void RenderView( const CViewSetup &view, int nClearFlags, int whatToDraw );

Expand Down
17 changes: 6 additions & 11 deletions mp/src/game/client/viewrender.cpp
Expand Up @@ -5318,14 +5318,8 @@ void CBaseWorldView::DrawSetup( float waterHeight, int nSetupFlags, float waterZ
render->PopView( GetFrustum() );
}

#ifdef TF_CLIENT_DLL
bool bVisionOverride = ( localplayer_visionflags.GetInt() & ( 0x01 ) ); // Pyro-vision Goggles

if ( savedViewID == VIEW_MAIN && bVisionOverride && pyro_dof.GetBool() )
{
if ( savedViewID == VIEW_MAIN )
SSAO_DepthPass();
}
#endif

g_CurrentViewID = savedViewID;
}
Expand Down Expand Up @@ -5464,7 +5458,9 @@ void CBaseWorldView::SSAO_DepthPass()
int savedViewID = g_CurrentViewID;
g_CurrentViewID = VIEW_SSAO;

ITexture *pSSAO = materials->FindTexture( "_rt_ResolvedFullFrameDepth", TEXTURE_GROUP_RENDER_TARGET );
ITexture *pSSAO = materials->FindTexture( "_rt_ResolvedFullFrameDepth_DA", TEXTURE_GROUP_RENDER_TARGET );

Assert(!IsErrorTexture(pSSAO));

CMatRenderContextPtr pRenderContext( materials );

Expand Down Expand Up @@ -5506,13 +5502,12 @@ void CBaseWorldView::SSAO_DepthPass()
DrawOpaqueRenderables( DEPTH_MODE_SSA0 );
}

#if 0
if ( m_bRenderFlashlightDepthTranslucents || r_flashlightdepth_drawtranslucents.GetBool() )
{
VPROF_BUDGET( "DrawTranslucentRenderables", VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );
DrawTranslucentRenderables( false, true );
}
#endif

m_pMainView->DrawViewModels(*m_pMainView->GetViewSetup(), true);

modelrender->ForcedMaterialOverride( 0 );

Expand Down
2 changes: 2 additions & 0 deletions mp/src/game/client/viewrender.h
Expand Up @@ -436,10 +436,12 @@ class CViewRender : public IViewRender,
bool DrawOneMonitor( ITexture *pRenderTarget, int cameraNum, C_PointCamera *pCameraEnt, const CViewSetup &cameraView, C_BasePlayer *localPlayer,
int x, int y, int width, int height );

public:
// Drawing primitives
bool ShouldDrawViewModel( bool drawViewmodel );
void DrawViewModels( const CViewSetup &view, bool drawViewmodel );

private:
void PerformScreenSpaceEffects( int x, int y, int w, int h );

// Overlays
Expand Down
2 changes: 1 addition & 1 deletion mp/src/materialsystem/stdshaders/builddashaders.bat
Expand Up @@ -5,7 +5,7 @@ rem ================================
rem ==== MOD PATH CONFIGURATIONS ===

rem == Set the absolute path to your mod's game directory here ==
set GAMEDIR=D:\DoubleAction\Sync\dab
set GAMEDIR=\DoubleAction\Sync\dab

rem == Set the relative or absolute path to Source SDK Base 2013 Singleplayer\bin ==
set SDKBINDIR=C:\Steam\steamapps\common\Source SDK Base 2013 Multiplayer\bin
Expand Down

0 comments on commit 0ded18e

Please sign in to comment.