LUX

is a mod specifically made and developed for use in and .
The Project is to entirely rewrite all existing "SDK_" Shaders, that come with the SDK and all those available in .
== Goals ==
;Overhaul/Clean Folder
: Implementing Shaders would entail replacing the existing folder. Shaders should be able to do everything SDK_ Shaders in and can do.
:SDK_ Shaders will fall back to LUX_ Shaders, that way can easily be used on mods without much work.
:Many .h, .cpp, .fxc files have been rewritten
;Drastically decrease compile times for all Shaders
: With , compiling the entirety of LUX_LightMappedGeneric takes around 30 seconds on 4 cores @4.1GHz
;SM3.0 Shaders Only
: and are not officially supported. Users of said systems will have to either patch togl to work with SM3.0 or use DxVK.
: 
 
;More Documentation for Shaders, their parameters, how they work and any possible caveats
: You might have noticed Articles like , , and getting major updates with new information about caveats and bugs. 
: This was a direct result of development, although the focus was mainly on and as their code is publicly available. 
 
;Implementing features that aren't available in 
: 
 
;Fixing most Parameter bugs and other caveats
: 
;Easy way of disabling features
: A custom Pre-Processor program has been made, allowing Mods that don't require specific features to easily disable them and further increase Shader compilation speed.
 
; compatibility
: Replacing SDK_ Shaders in SDK mods, SDK2013CE or Mapbase mods should be as simple as replacing the Folder, assuming that no custom shaders were added. If they were added, developers may need to add them back or recreate them.
= Planned Features =
This is a list of new features that are being implemented / will be implemented from newer branches such as: 
*
*
*
The code may be modified for simplification or if it needs a overhaul
=== compatibility ===
* $phongdisablehalflambert, ported from the 
* Radial Fog for all "Geometry" Shaders
* Spline-Ropes
* Parallax Corrected Cubemaps
**Just like with , this will require a custom compiler to work.
* + on 
* Replacement for the "Postprocessing" Controller Shader
* Replacement for the "Engine_post" Shader from 
* Hammer previewing fix.
* Brush 
* Treesway
: 
* $bumpmask and related
=== New features ===
* In , models utilizing Model Lightmapping can use . Additionally, all Model shaders will be able to utilize this feature, unless they have .
**The Lightmap does not do bumped-lighting using the bumpmap. Only named lights/projected textures will be able to do so.
**Lightmapped models will not be able to receive . This is not planned at the moment but should be possible for named lights/projected textures!
* In Models can utilize Lightmap UV's.
**The way this is currently implemented requires a custom-written tool, two SMDs (one with a lightmap uv), and also has a lot of precision loss for the Lightmap UVs. Additionally, this requires a custom compiler! 
=== Features ported/recreated ===
* $phongdisablehalflambert - Also needed for 
* $phongexponentfactor From 
* $phongalbedoboost 
* $basemapluminancephongmask 
** allows the use of Rec. 709 HDTV Luminance Weights. float3(0.2126f, 0.7152f, 0.0722f).Previously, SDK_ Shaders would use the NTSC Analog Television standard of float3(0.2990f, 0.5870f, 0.1140f)
* $selfillumtexture Deprecated since 
** Yes, there is a use for this! $detailblendmode 5 is commonly used for glowing textures. This parameter allows for not wasting your $detail. Additionally no $emissiveblend is required.
: 
* support - From 
* From for brushes and models 
: 
=== Features that won't be ported/recreated/revived ===
* $basealphaenvmapmaskminmaxexp from - This parameter is not yet documented on the VDC, it is also unclear what exactly it does...
* $EnvMapLightScaleMinMax from 
* and related - These features have been removed since and is obsolete.
** This is very easy to re-implement. The 7th face of a cubemap is still built in , so this feature is still operational.
=== Not functional for now ===
* - Non-Functional. Planned for later.
= Stock Shaders VS LUX =
== LightmappedGeneric ==
=== Stock Shaders ===
$selfillummask 
 
$selfillumfresnel 
 
$detailtexturetransform 
 requires inverted masks	
=== LUX_LightMappedGeneric ===
:
:
== VertexLitGeneric ==
=== Stock Shaders ===
==== Always ====
.
==== Without $Bumpmap ====
==== With $Bumpmap ====
==== With $Phong ====
{{bug|$detailblendmode 8-11 Don't work.
$invertphongmask In the shadercode, only flips the mask used for . 
$phongalbedotint cannot be used without $phongexponenttexture.
 does not work.
$phongalbedoboost + does not work.
$phongtint disables $phongalbedotint.
 always masked by something.
{{Only in + masked by luminance when and $basemapluminancephongmask is used.
 masked by alpha when and $basemapalphaphongmask is used.
$basemapalphaphongmask makes ignore the .
$selfillumfresnel + will cause the to be multiplied by 0.0f regardless of whether $invertphongmask is used.
$selfillumfresnel will cause to be masked using the alpha channel.}}}}	
=== LUX_VertexLitGeneric ===
==== Without $Bumpmap ====
* $detailblendmode 10-11 planned. If possible.
* $selfillumfresnel Exists now.
* Exists now.
::
==== With $Bumpmap ====
* $detailblendmode 5-9 work.
* $detailblendmode 10-11 planned. If possible.
* Exists now.
* $selfillummask Exists now.
* Exists now.
* $selfillumfresnel + Works now.
==== With $Phong ====
* $detailblendmode 8-9 work now.
* $detailblendmode 10-11 planned. If possible.
:
* $phongwarptexture Works ( ).
* $phongalbedoboost Exists now. Used to be 
* $phongalbedoboost + Works. Does not work in .
:
* Can now be not-masked by using a new parameter ($phongenvmapnomask)
: 
* $basemapalphaphongmask no longer makes ignore the .
:
* $selfillumfresnel + will no longer multiply the by 0.0f
* $phongdisablehalflambert Exists now. ( Used to be 
* $phongexponentfactor Exists now for . ( Used to be )
* $basemapluminancephongmask Exists now. ( Used to be )
* $phongalbedoboost Exists now. ( Used to be )
== History ==
 started development on January 20th, 2023, but it was planned and thought around January 14th, when the lead developer ShiroDkxtro2 was in a hospital stay.
Even before 2023, the idea of rewriting Valve's shaders was being considered. Various people asked ShiroDkxtro2 if certain modifications could be implemented for default shaders, such as cascaded shadow mapping.
These requests would usually result in a simple "no", as modifying the default shaders was not considered feasible for various reasons, most of which are indirectly mentioned in LUX's Goals.
The project's inception was supposed to be a means to make the existing shaders more moddable, with new features in mind and laid out so that implementing new things would be easier.
== Credits ==
;SCell555's ShaderCompiler
:Used to compile the Shaders. Include files ( .inc ) are intended to be made using Perl.
: copies various code from thexa4's PBR header
;Tottery ( Also known as TotteryNine )
:TotteryNine was crucial to ShiroDkxtro2 for learning the basics and more complicated aspects of making and compiling Shaders.
;Sitkinator
:Aiding with the initial logo and adding a screen-reflection effect to it.
;Mr.Kleiner
:For writing various tools. Including a VTF Flagging tool for Cubemaps inside a .bsp file, a tool for packing lightmap UV's into .smd files
;roman_memes
:Various logical checks and ideas. Also helped with prototyping new features and finding siggraph or other papers regarding modern and oldschool graphical implementations.
;Alivebyte!
:For doing modifications to the ShaderCompiler, which so far have not been implemented into the repo.
;Ficool2
:For enlightening us about the Constant Register Hack, allowing for the use of more than 32 float constant registers on SM3.0
:This Project would be nearly impossible without it.
;ChatGPT
:Help with programming and the undocumented graphical features of the Source Engine.
:It knows things and can make new things to a degree. Various code used in has been partially written by AI.
;
:Since one of the goals of this project is to be compatible with it, various code from it has been adapted.
:This means that all Shader-related things should also be inherited with the credits of . You can find Mapbase's credits here.
;Source++
:Code might be included, like the NvidiaPCF5x5Gaussian Shadow Filter
;Joshua Ashton
:For his various open-source work related to the Source Engine
== See also ==
* Discord Server
: Development can be followed here, Bug-Reports & suggestions made.
: It is also intended as a general place for discussing related Shader-Modding.
* GitHub page