Deferred lighting

From Valve Developer Community
Jump to navigation Jump to search

Stub

This article or section is a stub. You can help by expanding it.

Icon-under construction-blue.png
This is a draft page. It is a work in progress open to editing by anyone.
Remember to check for any notes left by the tagger at this article's talk page.

Deferred lighting is an alternate lighting technique, which is much different from the default Radiosity lighting that comes with Source Source. It uses many different lighting passes to generate higher quality lighting, with real time shadows.

Availability

Very few Source Engine games utilize this lighting technique, as it is very complicated to implement, the games that do use this are listed here:

Differences from vanilla radiosity

When compiling a map in any of Valve's games, each map is run through VRAD, which takes data from all the light sources and compile them into a "lightmap" texture. While this does provide high-quality and variable lighting, it is completely static, save for the limited ability to toggle on some lights in a scene. The difference between radiosity and Deferred lighting is that Deferred lighting computes all its lights in real time. The game takes data from the normals of the object, its geometry, its albedo, and its specular lighting to create real time accurate lighting.

Features

  • Quite cheap realtime lighting and shadows
  • Almost infinite number of dynamic lights that can be active (stock Source only allows for one env_projectedtexture at a time)
  • High-fidelity Godray/Volumetric lighting
  • Light cookies (premade shadow maps)

Drawbacks

  • Traditional antialiasing like MSAA might not work with it like in Black Mesa Black Mesa, but it depends how it was implemented into the game. As with Alien Swarm Deferred Alien Swarm Deferred, and Lambda Wars Lambda Wars is still supported.
  • (only in Alien Swarm Deferred) All lightmaps are disabled and only deferred lighting lights the world.
  • Can be more taxing on older systems

Implementing into Source 2013 Singleplayer Source 2013 Singleplayer

Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
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.
Todo: Write a complete tutorial on how to do this with Lambda Wars's implementation as it's the most robust that is available to the public.

Personally I have not been able to implement it yet, but I have been able to identify these files that need to be modified or added to the gamecode.

  • game
    • Client
      • cdll_client_int.cpp
      • viewrender.h
      • viewrender.cpp
      • flashlighteffect.h
      • flashlighteffect.cpp
      • c_entityflame.cpp
      • c_te_explosion.cpp//might not need to modifie it
      • deferred //contents of this folder are also needed
    • Server
      • gameinterface.cpp
      • lights.cpp
      • EntityFlame.h
      • deferred //contents of this folder are also needed
    • Shared
      • deferred //contents of this folder are needed
  • materialsystem
    • stdshaders
      • 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
      • lightmappedgeneric_deferred_ps30.h
      • debug_lightingctrl.cpp
      • debug_radiosity_grid.cpp
      • deferred_decalModulate.cpp
      • deferred_model.cpp //might not be needed
      • deferred_brush.cpp //might not be needed
      • 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
      • 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
      • flora.cpp//might not be needed
      • flora_ps30//might not be needed
      • flora_vs30//might not be needed
  • public
    • renderparm.h

See also

External links