Difference between revisions of "TF2 Glow Effect (2013 SDK)"

From Valve Developer Community
Jump to: navigation, search
(Materials Download.)
Line 8: Line 8:
 
</source>
 
</source>
  
* Create a .VMT file in /materials/dev/ called "glow_color.vmt" with the following contents:
 
<source>
 
UnlitGeneric
 
{
 
    $basetexture white // or whatever you like
 
    $ignorez 1
 
    $model 1
 
    $linearwrite 1
 
}
 
</source>
 
  
* Create another .VMT file in /materials/dev/ called "halo_add_to_screen.vmt" with the following contents:
+
'''Materials Required:'''
<source>
+
[https://www.dropbox.com/s/ltyomrglekrhriv/sdk2013_tf2_glowoutlinematerials.zip?dl=0 SDK2013_TF2_GlowOutlineMaterials.zip]
"screenspace_general"
+
 
{
 
        "$PIXSHADER" "haloaddoutline_ps20"
 
 
        "$ALPHA_BLEND_COLOR_OVERLAY" 1
 
        "$basetexture" "_rt_fullframefb"
 
        "$ignorez" 1
 
        "$linearread_basetexture" 1
 
        "$linearwrite" 1
 
 
        "$texture1" "dev/glow_red"
 
        "$texture2" "dev/glow_white"
 
        "$texture3" "dev/glow_blue"
 
}
 
</source>
 
  
 
* Precache the effect by placing this code in '''clientmode_shared.cpp''' (search for other references of '''CLIENTEFFECT_REGISTER_BEGIN''' for usage example):
 
* Precache the effect by placing this code in '''clientmode_shared.cpp''' (search for other references of '''CLIENTEFFECT_REGISTER_BEGIN''' for usage example):

Revision as of 15:14, 25 November 2017

Activation

  • Add GLOWS_ENABLE to the preprocessor directives on your client and server projects (don't forget to add it for release and debug, too!)
  • Add the following line to ClientModeShared::DoPostScreenSpaceEffects:
g_GlowObjectManager.RenderGlowEffects( pSetup, 0 );


Materials Required: SDK2013_TF2_GlowOutlineMaterials.zip


  • Precache the effect by placing this code in clientmode_shared.cpp (search for other references of CLIENTEFFECT_REGISTER_BEGIN for usage example):
CLIENTEFFECT_REGISTER_BEGIN( PrecachePostProcessingEffectsGlow )
CLIENTEFFECT_MATERIAL( "dev/glow_color" )
CLIENTEFFECT_MATERIAL( "dev/halo_add_to_screen" )
CLIENTEFFECT_REGISTER_END_CONDITIONAL( engine->GetDXSupportLevel() >= 90 )

Don't forget to add the include defintion for the precache system!

#include "clienteffectprecachesystem.h"

Usage

Objects derived from CBaseEntity are able to glow, but setters and getters for the glow effect only appear to be defined from CBaseCombatCharacter onwards.

To start a glow, call:

myObject->AddGlowEffect(); //Make it glow

To update a glow, call:

myObject->UpdateGlowEffect(); //Update glow

To stop a glow, call:

myObject->RemoveGlowEffect(); //Make it stop glowing