Talk:L4D Glow Effect

From Valve Developer Community
Jump to: navigation, search

Hello i need help getting the entities to register themselves with the effect. I'm trying to make a npc_metrocop glow. Help would be much appreciated.


First you should implement the screenspace effect as in the tutorial. Then add these lines of code the the Spawn() function of the npc_metrocop if you want the effect to be active during the entire life of the npc:

CEntGlowEffect *pGlowEffect = (CEntGlowEffect*)g_pScreenSpaceEffects->GetScreenSpaceEffect("ge_entglow");
pGlowEffect->RegisterEnt( this, Color(255, 255, 255, 100) );

Make sure you #include "ge_screeneffects.h" in the npc_metrocop cpp file so that you can properly find the glow effect. --killermonkey 03:07, 16 December 2009 (UTC)


Thanks for responding. First, I wan't the effect to be toggled on and off. So how would i implement this with the npc? I could place it in hl2_player.cpp, but then how would i register it with the npc? Last of all, in the section "Once the effect is enabled, we still have to get entities to register themselves with the effect so that they are drawn with it on. Since we are using the effect to highlight gameplay tokens I will show a method to active the effect from the server using Server/Client sendtable:" This won't be necessary anymore if i'm just registering it from the npc, correct? --Error3972 20:21, 17 December 2009 (UTC)


As a test i tried what you suggested. When i compiled my the metrocop i got these errors:

 1>Compiling...
1>cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
1>npc_metropolice.cpp
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(40) : error C2061: syntax error : identifier 'IMatRenderContext'
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(41) : error C2061: syntax error : identifier 'IMatRenderContext'
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(53) : error C2146: syntax error : missing ';' before identifier 'm_GlowBuff1'
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(53) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(53) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(54) : error C2146: syntax error : missing ';' before identifier 'm_GlowBuff2'
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(54) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(54) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(56) : error C2146: syntax error : missing ';' before identifier 'm_WhiteMaterial'
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(56) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(56) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(57) : error C2146: syntax error : missing ';' before identifier 'm_EffectMaterial'
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(57) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(57) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(59) : error C2146: syntax error : missing ';' before identifier 'm_BlurX'
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(59) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(59) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(60) : error C2146: syntax error : missing ';' before identifier 'm_BlurY'
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(60) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\Darkness\E2-Work\src\game\server\ge_screeneffects.h(60) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

This doesn't happen when ge_screeneffects.h is in client, Just in server. Any help? --Error3972 21:30, 17 December 2009 (UTC)


Sorry for the delay in answering. The effect is CLIENT SIDE ONLY. None of these rendering functions exist on the server. That is why you have to use the server/client send table or some other server message to the client in order to activate the effect from the server.

For your npc, you have many options. Following my tutorial for server/client network table will work fine. killermonkey 13:24, 31 December 2009 (UTC)


Sorry for being thick, but the problem is I don't understand your tutorial for the server/client network table. Noob question alert, Where am i supposed to put it? And how would i send the information needed to hl2_player.cpp in order to activate it? I'm not familiar with the server/client network table. --Error3972 00:39, 6 January 2010 (UTC)

Update: Lol, man i needed some more experience. I fully understand the tutorial now. --Error3972 20:41, 23 July 2010 (UTC)


I can't download L4D Glow Effect Materials.rar from divshare anymore... could you refresh the download link please? --Ferocildo 17:42, 1 May 2010 (UTC)

I am also having this problem. I don't own L4d and therefore can not get the required materials from there. Any help please? -- Crocs 03:16, 11 December 2010 (UTC)

Download Updated

I updated the download link. Sorry for the delay guys! killermonkey 20:24, 30 December 2010 (UTC)

screeneffects in general

Hello, I have a little problem, I tried to write an own Screenspace effect and I got stuck when I wanted to draw my modified scene into the rendertarget.
How to do that?
Does it have anything to do with Push- and PopRenderTargetAndViewport? --Pfannkuchen 21:18, 22 January 2011 (UTC)

Yeah, that's the key.--1/4 Life 05:48, 23 January 2011 (UTC)
and how to render a modified scene to the rendertarget now? --Pfannkuchen 11:31, 23 January 2011 (UTC)

Having a little trouble making it so that the glow doesn't show through walls.

I'm not sure what I need to change to allow these to not show through walls. I'm guessing it has something to do with the Zpass and Zfail operations during the render to stencil part, and the stencil comparison during the render portion. I also figure that I may need to not compress the depth range that way I get the proper Z values. I keep trying different combinations, but I'm really just shooting blind. Maybe someone who has a better understanding could help me out? --Stoopdapoop 11:46, 6 June 2012 (PDT)