Difference between revisions of "HPL3/Shaders/Overwriting Existing Shaders"

From Frictional Wiki
< HPL3‎ | Shaders
Jump to navigation Jump to search
(Adding initial stub)
 
Line 37: Line 37:
 
For Amnesia: Rebirth and Amnesia: The Bunker, LoadShaderCache MUST be set to false in your mod's user settings configuration file for your mod's custom shaders to be reflected in-game. This will likely lead to slightly degraded performance, but this doesn't seem too noticeable on modern hardware. You will need to overwrite the base game's default_user_settings.cfg in the config folder to automatically set LoadShaderCache to false (for Rebirth) OR you will need to manually instruct users to set LoadShaderCache to false in their .cfg file (for Bunker).  
 
For Amnesia: Rebirth and Amnesia: The Bunker, LoadShaderCache MUST be set to false in your mod's user settings configuration file for your mod's custom shaders to be reflected in-game. This will likely lead to slightly degraded performance, but this doesn't seem too noticeable on modern hardware. You will need to overwrite the base game's default_user_settings.cfg in the config folder to automatically set LoadShaderCache to false (for Rebirth) OR you will need to manually instruct users to set LoadShaderCache to false in their .cfg file (for Bunker).  
  
'''NOTE:''' Make sure SaveShaderCache is set to false! This has much worse performance degradation and worse compatibility than LoadShaderCache, as it constantly regenerates the shadercache.xml file in _shadersource at runtime. This may be useful for directly editing shaders within your base install, but is unlikely to be useful for mods.
+
'''NOTE:''' Make sure SaveShaderCache is set to false! This has much worse performance degradation and worse compatibility than LoadShaderCache, as it constantly regenerates the shadercache.xml file in _shadersource at runtime. This may be useful for directly editing shaders within your base install, but is unlikely to be useful for StandAlone or AddOn mods.

Revision as of 06:00, 13 September 2024

Wip icon.png This page is currently a work in progress! Information will be added over time based on research and testing.


Most shaders can be overwritten at runtime by StandAlone and AddOn mods, allowing for them to easily modify shader behavior.

Alternatively, vanilla shaders can be directly modified in the core\shaders\ directory of your game install. This can be useful for more complex shader mods which edit the few shaders that cannot be reliably overwritten by normal StandAlone or AddOn mods, which are currently:

  • base_vtx.hpsl
  • base_frag.hpsl
  • cache_terrain_diffuse_frag.hpsl
  • clear_frag.hpsl
  • clear_vtx.hpsl
  • deferred_base_frag.hpsl
  • deferred_base_vtx.hpsl
  • deferred_skybox_frag.hpsl
  • deferred_terrain_gbuffer_frag.hpsl
  • deferred_terrain_tess_cs.hpsl
  • deferred_terrain_tess_es.hpsl
  • deferred_terrain_vtx.hpsl
  • null_frag.hpsl
  • null_frag_array.hpsl
  • null_frag_array2.hpsl
  • null_vtx.hpsl

These likely have special behavior in-engine that changes the way they're loaded when compared to other shaders. More testing will be needed to determine why this is the case.

Set Up

For existing shaders, your shader MUST have the same name as the shader you're trying to overwrite. Most of the shader list is hardcoded within the executable and there is no known way to create new GpuPrograms or delete existing ones without access to the source code.

SOMA

The setup process for SOMA is extremely straightforward and is as simple as placing your shaders in your mod's \core\shaders\ directory, and your changes should be reflected in-game after loading your mod. Keep in mind that not all shader code is compiled on startup and is often conditional depending on what is being rendered in the current map, so some changes will not be immediately apparent!

Amnesia: Rebirth and Amnesia: The Bunker

For Amnesia: Rebirth and Amnesia: The Bunker, LoadShaderCache MUST be set to false in your mod's user settings configuration file for your mod's custom shaders to be reflected in-game. This will likely lead to slightly degraded performance, but this doesn't seem too noticeable on modern hardware. You will need to overwrite the base game's default_user_settings.cfg in the config folder to automatically set LoadShaderCache to false (for Rebirth) OR you will need to manually instruct users to set LoadShaderCache to false in their .cfg file (for Bunker).

NOTE: Make sure SaveShaderCache is set to false! This has much worse performance degradation and worse compatibility than LoadShaderCache, as it constantly regenerates the shadercache.xml file in _shadersource at runtime. This may be useful for directly editing shaders within your base install, but is unlikely to be useful for StandAlone or AddOn mods.