From b491568b5e33980d425bb03599f1a19ef7cbac26 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Mon, 26 Jan 2026 21:28:14 +0000 Subject: [PATCH 1/4] init --- src/game/client/glow_outline_effect.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/game/client/glow_outline_effect.cpp b/src/game/client/glow_outline_effect.cpp index 7f50e19e4b..1894204bf2 100644 --- a/src/game/client/glow_outline_effect.cpp +++ b/src/game/client/glow_outline_effect.cpp @@ -32,6 +32,7 @@ ConVar glow_outline_effect_enable("glow_outline_effect_enable", "1", FCVAR_ARCHI } ); ConVar glow_outline_effect_width( "glow_outline_effect_width", "1.f", FCVAR_ARCHIVE, "Width of glow outline effect.", true, 0.f, false, 0.f); +ConVar glow_outline_effect_alpha( "glow_outline_effect_alpha", "1.f", FCVAR_ARCHIVE, "Alpha of glow outline effect.", true, 0.f, true, 1.f); ConVar glow_outline_effect_center_alpha("glow_outline_effect_center_alpha", "0.1f", FCVAR_ARCHIVE, "Opacity of the part of the glow effect drawn on top of the player model when obstructed", true, 0.f, true, 1.f); ConVar glow_outline_effect_textured_center_alpha("glow_outline_effect_textured_center_alpha", "0.2f", FCVAR_ARCHIVE, "Opacity of the part of the glow effect drawn on top of the player model when cloaked", true, 0.f, true, 1.f); #else @@ -371,10 +372,13 @@ void CGlowObjectManager::ApplyEntityGlowEffects( const CViewSetup *pSetup, int n // Draw quad #ifdef NEO const float outlineWidth = glow_outline_effect_width.GetFloat(); - if (outlineWidth) + const float outlineAlpha = glow_outline_effect_alpha.GetFloat(); + if (outlineWidth && outlineAlpha) { IMaterialVar* pOutlineVar = pMatHaloAddToScreenOutline->FindVar("$C0_X", NULL); pOutlineVar->SetFloatValue(outlineWidth); + IMaterialVar* pAlphaVar = pMatHaloAddToScreenOutline->FindVar("$C0_Y", NULL); + pAlphaVar->SetFloatValue(outlineAlpha); pRenderContext->DrawScreenSpaceRectangle(pMatHaloAddToScreenOutline, 0, 0, nViewportWidth+1, nViewportHeight+1, 0, 0, pRtQuarterSize1->GetActualWidth(), pRtQuarterSize1->GetActualHeight(), pRtQuarterSize1->GetActualWidth(), From ddc16985f3e8099dd560b8888d117c1767bcdaa5 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Tue, 27 Jan 2026 11:30:01 +0000 Subject: [PATCH 2/4] shader --- .../stdshaders/neo_haloaddoutline_ps2x.fxc | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/materialsystem/stdshaders/neo_haloaddoutline_ps2x.fxc b/src/materialsystem/stdshaders/neo_haloaddoutline_ps2x.fxc index d5614d8962..fe34ee6441 100644 --- a/src/materialsystem/stdshaders/neo_haloaddoutline_ps2x.fxc +++ b/src/materialsystem/stdshaders/neo_haloaddoutline_ps2x.fxc @@ -7,8 +7,10 @@ sampler TexRed : register( s1 ); sampler TexGreen : register( s2 ); sampler TexBlue : register( s3 ); -float g_flOutlineWidth : register( c0 ); -float2 g_vPixelSize : register( c4 ); +const float2 g_flOutlineProperties : register(c0); +#define g_flOutlineWidth g_flOutlineProperties.x +#define g_flDimValue g_flOutlineProperties.y +const float2 g_vPixelSize : register(c4); struct PS_INPUT { @@ -19,12 +21,20 @@ float4 main( PS_INPUT i ) : COLOR { float2 vOffset = g_flOutlineWidth * g_vPixelSize.xy; - // Take the max of 4 offset texture samples + // Take the max of 4(8?) offset texture samples float4 result; result.rgba = tex2D( TexSampler, i.baseTexCoord.xy + float2( vOffset.x, vOffset.y ) ); result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( vOffset.x, -vOffset.y ) ) ); result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( -vOffset.x, vOffset.y ) ) ); result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( -vOffset.x, -vOffset.y ) ) ); + // Far objects or slim objects have holes in the outline unless we check all 8 surrounding neighbors, is the improved outline worth the extra cost? + result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( -vOffset.x, 0 ) ) ); + result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( vOffset.x, 0 ) ) ); + result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( 0, -vOffset.y ) ) ); + result.rgba = max( result.rgba, tex2D( TexSampler, i.baseTexCoord.xy + float2( 0, vOffset.y ) ) ); + + // Scale by dim value before computing luminance below + result.rgb *= saturate( g_flDimValue ); // Store max color component in alpha for alpha blend of one/invSrcAlpha float flLuminance = max( result.r, max( result.g, result.b ) ); From 371958fa0c17ce9d69230ad41b3f79b3304144d3 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Tue, 27 Jan 2026 11:41:35 +0000 Subject: [PATCH 3/4] settings --- src/game/client/neo/ui/neo_root_settings.cpp | 3 +++ src/game/client/neo/ui/neo_root_settings.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/game/client/neo/ui/neo_root_settings.cpp b/src/game/client/neo/ui/neo_root_settings.cpp index 3eabb33b25..6bd3b82efe 100644 --- a/src/game/client/neo/ui/neo_root_settings.cpp +++ b/src/game/client/neo/ui/neo_root_settings.cpp @@ -669,6 +669,7 @@ void NeoSettingsRestore(NeoSettings *ns, const NeoSettings::Keys::Flags flagsKey pHUD->bEnableXray = cvr->glow_outline_effect_enable.GetBool(); pHUD->flOutlineWidth = cvr->glow_outline_effect_width.GetFloat(); + pHUD->flOutlineAlpha = cvr->glow_outline_effect_alpha.GetFloat(); pHUD->flCenterOpacity = cvr->glow_outline_effect_center_alpha.GetFloat(); pHUD->flTexturedOpacity = cvr->glow_outline_effect_textured_center_alpha.GetFloat(); #endif // GLOWS_ENABLE @@ -903,6 +904,7 @@ void NeoSettingsSave(const NeoSettings *ns) cvr->glow_outline_effect_enable.SetValue(pHUD->bEnableXray); cvr->glow_outline_effect_width.SetValue(pHUD->flOutlineWidth); + cvr->glow_outline_effect_alpha.SetValue(pHUD->flOutlineAlpha); cvr->glow_outline_effect_center_alpha.SetValue(pHUD->flCenterOpacity); cvr->glow_outline_effect_textured_center_alpha.SetValue(pHUD->flTexturedOpacity); #endif // GLOWS_ENABLE @@ -1432,6 +1434,7 @@ void NeoSettings_HUD(NeoSettings* ns) NeoUI::Divider(L"XRAY"); NeoUI::RingBoxBool(L"Enable Xray", &pHud->bEnableXray); NeoUI::Slider(L"Outline Width", &pHud->flOutlineWidth, 0, 2, 2, 0.25f); + NeoUI::Slider(L"Outline Opacity", &pHud->flOutlineAlpha, 0, 1, 2, 0.1f); NeoUI::Slider(L"Center Opacity", &pHud->flCenterOpacity, 0, 1, 2, 0.1f); NeoUI::Slider(L"Texture Opacity (Cloak highlight)", &pHud->flTexturedOpacity, 0, 1, 2, 0.1f); #endif // GLOWS_ENABLE diff --git a/src/game/client/neo/ui/neo_root_settings.h b/src/game/client/neo/ui/neo_root_settings.h index e89143992e..5608d8b8f9 100644 --- a/src/game/client/neo/ui/neo_root_settings.h +++ b/src/game/client/neo/ui/neo_root_settings.h @@ -208,6 +208,7 @@ struct NeoSettings // Player Xray bool bEnableXray; float flOutlineWidth; + float flOutlineAlpha; float flCenterOpacity; float flTexturedOpacity; #endif // GLOWS_ENABLE @@ -332,6 +333,7 @@ struct NeoSettings // Xray CONVARREF_DEF(glow_outline_effect_enable); CONVARREF_DEF(glow_outline_effect_width); + CONVARREF_DEF(glow_outline_effect_alpha); CONVARREF_DEF(glow_outline_effect_center_alpha); CONVARREF_DEF(glow_outline_effect_textured_center_alpha); #endif // GLOWS_ENABLE From 6ef77cfb1d744078de004e061b401020c4952713 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Tue, 27 Jan 2026 11:45:46 +0000 Subject: [PATCH 4/4] default to half --- src/game/client/glow_outline_effect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/client/glow_outline_effect.cpp b/src/game/client/glow_outline_effect.cpp index 1894204bf2..5b68d827bb 100644 --- a/src/game/client/glow_outline_effect.cpp +++ b/src/game/client/glow_outline_effect.cpp @@ -32,7 +32,7 @@ ConVar glow_outline_effect_enable("glow_outline_effect_enable", "1", FCVAR_ARCHI } ); ConVar glow_outline_effect_width( "glow_outline_effect_width", "1.f", FCVAR_ARCHIVE, "Width of glow outline effect.", true, 0.f, false, 0.f); -ConVar glow_outline_effect_alpha( "glow_outline_effect_alpha", "1.f", FCVAR_ARCHIVE, "Alpha of glow outline effect.", true, 0.f, true, 1.f); +ConVar glow_outline_effect_alpha( "glow_outline_effect_alpha", "0.5f", FCVAR_ARCHIVE, "Alpha of glow outline effect.", true, 0.f, true, 1.f); ConVar glow_outline_effect_center_alpha("glow_outline_effect_center_alpha", "0.1f", FCVAR_ARCHIVE, "Opacity of the part of the glow effect drawn on top of the player model when obstructed", true, 0.f, true, 1.f); ConVar glow_outline_effect_textured_center_alpha("glow_outline_effect_textured_center_alpha", "0.2f", FCVAR_ARCHIVE, "Opacity of the part of the glow effect drawn on top of the player model when cloaked", true, 0.f, true, 1.f); #else