Implementing Deferred lighting into Source 2013: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
Line 7: Line 7:


==Clientside==
==Clientside==
Firstly we are going to modify cdll_client_int.cpp. Now put the fallowing code before #include "tier0/memdbgon.h".
Firstly we are going to modify '''cdll_client_int.cpp'''. Now put the following code at the top of the file around lines 175 but it must be before #include "tier0/memdbgon.h".
<source lang=cpp>
  #ifdef DEFERRED_ENABLED // @Deferred - Biohazard
  #ifdef DEFERRED_ENABLED // @Deferred - Biohazard
  #include "deferred/deferred_shared_common.h"
  #include "deferred/deferred_shared_common.h"
  #endif
  #endif
</source>
Now aound lines 1816 in void CHLClient::ResetStringTablePointers() place the following code.
<source lang=cpp>
#ifdef DEFERRED_ENABLED // @Deferred - Biohazard
g_pStringTable_LightCookies = NULL;
#endif
</source>
Now around lines 2058 put the following code inside void CHLClient::InstallStringTableCallback( const char *tableName ).
<source lang=cpp>
#ifdef DEFERRED_ENABLED // @Deferred - Biohazard
else if ( !Q_strcasecmp( tableName, COOKIE_STRINGTBL_NAME ) )
{
g_pStringTable_LightCookies = networkstringtable->FindTable( tableName );
g_pStringTable_LightCookies->SetStringChangedCallback( NULL, OnCookieTableChanged );
}
#endif // DEFERRED_ENABLED
</source>


==Serverside==
==Serverside==

Revision as of 04:02, 13 April 2024

English (en)Translate (Translate)

Having deferred lighting in your mod comes with quite a lot of upsides as with it, you can have volumetric lighting, realtime shadows and lighting from the sun and from other light sources, while still keeping the performance steady which is something that Source's regular dynamic light entities would be incapable of (aka projected textures).

Implementing into your Source 2013SP mod

Now we are going to use Lambda Wars's implementation for it as its an enhanced/upgraded version of Alien Swarm Deferred's, but beware implementing deferred lighting in your mod is extremely complex requiring you to modify client and server side code, and even add new shaders to your game. Among other things source's default shaders are also needed to be modified.

Clientside

Firstly we are going to modify cdll_client_int.cpp. Now put the following code at the top of the file around lines 175 but it must be before #include "tier0/memdbgon.h".

 #ifdef DEFERRED_ENABLED // @Deferred - Biohazard
 #include "deferred/deferred_shared_common.h"
 #endif

Now aound lines 1816 in void CHLClient::ResetStringTablePointers() place the following code.

 #ifdef DEFERRED_ENABLED // @Deferred - Biohazard
 g_pStringTable_LightCookies = NULL;
 #endif

Now around lines 2058 put the following code inside void CHLClient::InstallStringTableCallback( const char *tableName ).

#ifdef DEFERRED_ENABLED // @Deferred - Biohazard
	else if ( !Q_strcasecmp( tableName, COOKIE_STRINGTBL_NAME ) )
	{
		g_pStringTable_LightCookies = networkstringtable->FindTable( tableName );

		g_pStringTable_LightCookies->SetStringChangedCallback( NULL, OnCookieTableChanged );
	}
#endif // DEFERRED_ENABLED

Serverside

Shaders

Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality because:
Actually properly research what is needed for this implementation. Until someone actually decides to the hard work this section should be dedicated to the stuff that is most definietly needed for this implementation to work. And when thats done this notice should be deleted.

Lamba War's source code Reference project : Source 2013MP deferred this project uses the older Alien swarm deferred's version but it still should give us some idea what needs to be changed.

Cpp files and header files needed to be modified or added

  • Client
    • cdll_client_int.cpp ,modification needed
    • viewrender.h ,modification needed
    • viewrender.cpp ,modification needed
    • flashlighteffect.h ,modification needed
    • flashlighteffect.cpp ,modification needed
    • c_entityflame.cpp ,modification needed although it's not necessary it's still a quality of life feature
    • deferred ,This folder contents are needed which are:
      • cascade_t.cpp
      • cascade_t.h
      • DefCookieProjectable.cpp
      • DefCookieProjectable.h
      • DefCookieTexture.cpp
      • DefCookieTexture.h
      • IDefCookie.h
      • IDeferredExtClient.cpp
      • cdeferred_manager_client.cpp
      • cdeferred_manager_client.h
      • clight_editor.cpp
      • clight_editor.h
      • clight_manager.cpp
      • clight_manager.h
      • def_light_t.cpp
      • def_light_t.h
      • deferred_client_common.cpp
      • deferred_client_common.h
      • deferred_rt.cpp
      • deferred_rt.h
      • flashlighteffect_deferred.cpp
      • flashlighteffect_deferred.h
      • viewrender_deferred.cpp
      • viewrender_deferred.h
      • vgui ,This folder is also needed
        • projectable_factory.cpp
        • projectable_factory.h
        • vgui_deferred.h
        • vgui_editor_controls.cpp
        • vgui_editor_controls.h
        • vgui_editor_props.cpp
        • vgui_editor_props.h
        • vgui_editor_root.cpp
        • vgui_marquee.cpp
        • vgui_marquee.h
        • vgui_particles.cpp
        • vgui_particles.h
        • vgui_particles.cpp
        • vgui_projectable.cpp
        • vgui_projectable.h
  • Server
    • gameinterface.cpp ,modification needed
    • lights.cpp ,modification needed
    • EntityFlame.h ,modification needed although it's not necessary it's still a quality of life feature
    • deferred ,This folder contents are needed which are:
      • cdeferred_manager_server.cpp
      • deferred_server_common.h
      • cdeferred_manager_server.h
  • Shared
    • deferred ,This folder contents are needed which are:
      • CDefLight.cpp
      • CDefLight.h
      • CDefLightContainer.cpp
      • CDefLightContainer.h
      • CDefLightGlobal.cpp
      • CDefLightGlobal.h
      • deferred_shared_common.cpp
      • deferred_shared_common.h
      • ssemath_ext.h
  • Public
    • renderparm.h ,modification needed

Shaders

  • common_deferred_fxc.h
  • deferred_context.h
  • deferred_global_common.h
  • deferred_includes.h
  • deferred_utility.h
  • defpass_composite.h
  • defpass_gbuffer.h
  • defpass_shadow.h
  • IDeferredExt.h
  • lighting_helper.h
  • lighting_pass_basic.h
  • lighting_pass_volum.h
  • lightshafts_helper.h
  • vertexlitgeneric_dx9_helper.h
  • lightmappedgeneric_deferred_ps30.h
  • lightmappedgeneric_dx9_helper.h
  • debug_lightingctrl.cpp
  • debug_radiosity_grid.cpp
  • deferred_decalModulate.cpp
  • deferred_model.cpp
  • deferred_brush.cpp
  • defpass_composite.cpp
  • deferred_utility.cpp
  • defpass_gbuffer.cpp
  • defpass_shadow.cpp
  • GlobalLitGeneric.cpp
  • IDeferredExt.cpp
  • lighting_global.cpp
  • lighting_pass_basic.cpp
  • lighting_pass_volum.cpp
  • lighting_volume.cpp
  • lighting_world.cpp
  • radiosity_blend.cpp
  • radiosity_global.cpp
  • radiosity_propagate.cpp
  • volume_prepass.cpp
  • volume_blend.cpp
  • unlitgeneric_dx9.cpp
  • vertexlitgeneric_dx9.cpp
  • vertexlitgeneric_dx9_helper.cpp
  • lightmappedgeneric_dx9.cpp
  • lightmappedgeneric_dx9_helper.cpp
  • lightmappedgeneric_dx9_deferred_helper.cpp
  • phong_dx9_helper.cpp
  • gbuffer_vs30.fxc
  • gbuffer_ps30.fxc
  • gbuffer_defshading_ps30.fxc
  • shadowpass_vs30.fxc
  • shadowpass_ps30.fxc
  • composite_vs30.fxc
  • composite_ps30.fxc
  • defconstruct_vs30.fxc
  • decalmodulate_vs20.fxc
  • decalmodulate_ps2x.fxc
  • lightingpass_global_ps30.fxc
  • lightingpass_point_ps30.fxc
  • lightingpass_spot_ps30.fxc
  • screenspace_shading_ps30.fxc
  • screenspace_combine_ps30.fxc
  • volume_blend_ps30.fxc
  • volume_prepass_vs30.fxc
  • volume_prepass_ps30.fxc
  • volumpass_point_ps30.fxc
  • volumpass_spot_ps30.fxc
  • radiosity_gen_global_ps30.fxc
  • radiosity_gen_vs30.fxc
  • radiosity_propagate_ps30.fxc
  • radiosity_propagate_vs30.fxc
  • radiosity_blend_ps30.fxc
  • screenspace_vs20.fxc
  • gaussianblur_6_ps30.fxc
  • debug_shadow_ortho_ps30.fxc
  • debug_lighting_ctrl_ps30.fxc
  • debug_radiosity_grid_ps30.fxc
  • debug_radiosity_grid_vs30.fxc
  • globallitgeneric_ps30.fxc
  • globallitgeneric_vs30.fxc
  • phong_deferred_ps30.fxc
  • lightmappedgeneric_deferred_vs30.fxc
  • lightmappedgeneric_deferred_ps30.fxc
  • vertexlit_and_unlit_generic_bump_deferred_ps30.fxc
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.

External links