Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/game/client/glow_outline_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", "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
Expand Down Expand Up @@ -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(),
Expand Down
3 changes: 3 additions & 0 deletions src/game/client/neo/ui/neo_root_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/game/client/neo/ui/neo_root_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ struct NeoSettings
// Player Xray
bool bEnableXray;
float flOutlineWidth;
float flOutlineAlpha;
float flCenterOpacity;
float flTexturedOpacity;
#endif // GLOWS_ENABLE
Expand Down Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions src/materialsystem/stdshaders/neo_haloaddoutline_ps2x.fxc
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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 ) );
Expand Down