LUX: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Setting bug notice hidetested=1 param on page where the bug might not need tested in param specified)
(Up-to-date Information about the Project)
 
Line 1: Line 1:
{{LanguageBar}}
{{LanguageBar}}
{{Infotable
{{Infotable
| state = 5
| state = 4
| ownwiki = https://github.com/ShiroDkxtro2/ACROHS-LUX_-Shaders-Project/wiki
| ownwiki = https://github.com/LUX-Shaders-Team/LUX-Shaders/wiki
| type = m0
| type = m0
| dev = [[User:ShiroDkxtro2|ShiroDkxtro2]]
| dev = [[User:ShiroDkxtro2|ShiroDkxtro2]]
| engine = 2
| engine = 2
| base = {{src13|4}}
| base = {{src13|4}}
| platform = {{PC|4}}
| platform = {{PC|4}} ( {{linux|4}} {{src13mp|only}} )
| github = ShiroDkxtro2/ACROHS-LUX_-Shaders-Project
| github = LUX-Shaders-Team/LUX-Shaders
| discord = https://discord.gg/cGv8GGSkpc
| discord = https://discord.gg/cGv8GGSkpc
}}
}}
{{LUX|4}} is a [[Modification|mod]] specifically made and developed for use in {{src13sp|4.1}} and {{src13mp|4.1}}.<br>
{{LUX|4}} is a [[Modification|mod]] made for {{src13sp|4.1}} and {{src13mp|4.1}}.<br>
The Project is to entirely rewrite all existing "'''SDK_'''" Shaders, that come with the SDK and all those available in {{mapbase|4.1}}.
The goal of the Project is a reevaluated and rewritten set of shaders, that are faster to compile, easier to debug and modify.<br>
It resolves caveats and introduces new features, sometimes replicating those from newer source branches.<br>
The shaders are not designed to boost performance, don't expect superficial increases in fps.<br>
 
LUX can serve as a drop-in replacement to the shaders from {{mapbase|4.1}}.<br>
Although it references Alien Swarm Code, the branch itself is not supported.<br>
Similarly, {{Mac|4.1}} is not supported.<br>
 
LUX is based on publicly available code and has a strict no leaked-code policy.<br>
 


== Goals ==
== Goals ==
;Overhaul/Clean {{file|materialsystem\stdshaders\}} Folder
* Total Overhaul of the {{file|materialsystem\}} folder
: Implementing {{LUX|4.1}} Shaders would entail replacing the existing {{file|stdshaders\}} folder. {{LUX|4.1}} Shaders should be able to do everything SDK_ Shaders in {{src13}} and {{mapbase}} can do.
: Implementing {{LUX|4.1}} is intended to be as easy as possible. To ensure this, changes are restricted to the {{file|materialsystem\}} folder.
:SDK_ Shaders will fall back to LUX_ Shaders, that way {{LUX|4.1}} can easily be used on {{mapbase|4.1}} mods without much work.
: Using Code from the Orange Box and Alien Swarm, {{file|materialsystem\shaderlib}} has been added back in and is used to implement new features.
:Many .h, .cpp, .fxc files have been rewritten
: Previously LUX was limited to the {{file|materialsystem\stdshaders}} folder. Now it's {{file|materialsystem\}} to allow for this.
<br>
* Faster compile times for all Shaders
;Drastically decrease compile times for all Shaders
: All shaders have been rewritten from scratch and the systems they use have been reevaluated.
: With {{LUX|4.1}}, compiling the entirety of LUX_LightMappedGeneric takes around 30 seconds on 4 cores @4.1GHz
: Due to this, all shaders in the project can be compiled in about 15 minutes on dated hardware.
<br>
: For newer Hardware ( r9 5950x ), you may see times as low as two minutes.
;SM3.0 Shaders Only
: Various shaders now have their own .bat scripts. Making it easier to develop individual shaders.
: {{linux|4.1}} and {{Mac|4.1}} are not officially supported. Users of said systems will have to either patch <code>togl</code> to work with SM3.0 or use DxVK.
: This means modding specific shaders ( such as VertexLitGeneric ) is much faster.
: {{Note|
: Now changing a header does not mean having to 'recompile the universe'
:* SM3.0 released in 2004, and [https://cdn.cloudflare.steamstatic.com/apps/valve/2010/siggraph2010_vlachos_waterflow.pdf Valve considered ps2.0b low end hardware in ~2008]. See slide '''8'''
* Compatability with {{mapbase|4.1}}
:* This means that older hardware not capable of SM3.0 will not be able to use the new Shaders.}}
: {{LUX|4.1}} intends to serve as a drop-in replacement for Mapbase Shaders
<br>
: Thus it has features such as Parallax Corrected Cubemaps ( and much more.. radial fog, non-location specific Core Shader, .. )
;More Documentation for Shaders, their parameters, how they work and any possible caveats
: To facilitate this, every SDK_ Prefixed Shader will fallback to LUX_
: You might have noticed Articles like {{Ent|$lightwarptexture}}, {{Ent|$detail}}, {{Ent|UnlitTwoTexture}} and {{Ent|$envmapmask}} getting major updates with new information about caveats and bugs.  
* Stock Shader replacement
: This was a direct result of {{LUX|4.1}} development, although the focus was mainly on {{src13}} and {{as}} as their code is publicly available.  
: {{LUX|4.1}} allows for the selective replacement of existing shaders on {{src13mp|4.1}}.
<br>
: Using Various other methods such as memory patching or material passthrough this may also be used on {{src13sp|4.1}}
;Implementing features that aren't available in {{src13|4.1}}
* Shadermodel 3.0 only
: {{Seealso|[[LUX#Planned Features|Planned Features]]. This includes old features such as [[Glowing_Textures#.24selfillum|$selfillumtexture]] and newer features like [[$phong#Colors|$phongalbedoboost]]{{csgo|only}}.}}
: To allow for many of the new features, all of the Shaders use Shadermodel 3.0.
<br>
: A limitation created by this is that Linux on {{src13sp|4.1}} cannot run LUX, since ToGL does not have support for it,
;Fixing most Parameter bugs and other caveats
: DXVK may serve as an alternative here for Linux Users.
: {{Seealso|[[LUX#Stock Shaders VS LUX|Stock Shaders VS LUX]]}}
: SM3.0 released in 2004, and [https://cdn.cloudflare.steamstatic.com/apps/valve/2010/siggraph2010_vlachos_waterflow.pdf Valve considered ps2.0b low end hardware in ~2008]. See slide '''8'''
<br>
: This means that older hardware not capable of SM3.0 will not be able to use the new Shaders either.
;Easy way of disabling features
* Drastically more documentation, including their parameters, how they work and any possible caveats
: 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.
: Due to the Development of {{LUX|4.1}}, Articles on the VDC such as {{Ent|$lightwarptexture}}, {{Ent|$detail}}, {{Ent|UnlitTwoTexture}} and {{Ent|$envmapmask}}
<br>
: received massive updates, filling them with information about caveats and bugs.
;{{mapbase|4.1}} compatibility
: LUX shaders themselves have many comments, notifying when the behaviour of stock shaders has to be considered to keep visual consistency.
: Replacing SDK_ Shaders in SDK mods, SDK2013CE or Mapbase mods should be as simple as replacing the {{file|stdshaders\}} Folder, assuming that no custom [[shaders]] were added. If they were added, developers may need to add them back or recreate them.
: A Github Wiki listing all shader parameters and all shaders in the project is in the works.
<br>
: Helper strings have been added to all parameters and can be read back via the in-game console as well.
* Implementing features unavailable to {{src13|4.1}}
: This includes old features such as [[Glowing_Textures#.24selfillum|$selfillumtexture]] and newer features like [[$phong#Colors|$phongalbedoboost]]{{csgo|only}}.
: Note that LUX is not made from leaked code. Features (such as $SSBumpMathFix) have been derived from visual research in branches with them present and logical conclusions.
* Fixing parameter caveats when they don't break visual consistency.
: Dozens of broken parameter combinations are fixed with LUX.
: LUX has a habit of magically fixing things we didn't even know were broken on stock.
: If there is a broken combination or a caveat that isn't fixed, make a github issue ( please check if it's broken on LUX first )


= Planned Features =
= Features =
This is a list of new features that are being implemented / will be implemented from newer branches such as:  
Some Features from these Branches have been implemented:
*{{asbranch|4.1}}
*{{asbranch|4.1}}
*{{l4dbranch|4.1}}
*{{l4dbranch|4.1}}
*{{csgobranch|4.1}}
*{{csgobranch|4.1}}
The code may be modified for simplification or if it needs a overhaul
:{{note|Code from {{asbranch|4.1}} is heavily adapted, cross-referencing may be difficult.}}
 
:{{warning|Features that couldn't be made with code reference will be prone to visual disparity.}}
{{ModernImportant|{{LUX|2}} does '''not''' use '''any''' leaked code. Features like [[$phong#Colors|$phongalbedoboost]]{{only|{{csgo}}}} are not rocket science and easily be recreated.
:{{warning|For more complicated features, there might be visual disparity when compared to official implementations.}}}}
 
=== {{mapbase|4.1}} compatibility ===
{{ModernImportant|The parameters will be the same as {{mapbase|4.1}}, meaning that Mapbase's compilers can be used}}
* [[$phong#Brightness|$phongdisablehalflambert]], ported from the {{asbranch|4.1}}
* Radial Fog for all "Geometry" Shaders
* Spline-Ropes
* [[Parallax Corrected Cubemaps]]
**Just like with {{mapbase|4.1}}, this will require a custom compiler to work.
* {{Ent|$envmapmask}} + {{Ent|$bumpmap}} on {{Ent|VertexLitGeneric}}
* Replacement for the "Postprocessing" Controller Shader
* Replacement for the "Engine_post" Shader from {{as}}
* Hammer {{Ent|$blendmodulatetexture}} previewing fix.
* Brush {{Ent|$phong}}
* Treesway
: {{confirm|Is the {{mapbase|4.1}} implementation ported from {{as|4.1}}?}}
* [[$bumpmap#Additional_Parameters|$bumpmask]] and related
<br>
 
=== New features ===
* In {{src13mp|4.1}}, models utilizing Model Lightmapping can use {{Ent|$bumpmap}}. Additionally, all Model shaders will be able to utilize this feature, unless they have {{Ent|$phong}}.
**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 {{Ent|$phong}}. This is not planned at the moment but should be possible for named lights/projected textures!
* In {{src13mp}} 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! {{todo|Investigate {{src07|4.1}} code, supposedly the Studiomdl code is there. Maybe it can be packed via Blendweights or the precision loss might be decreased.}}
 
=== Features ported/recreated ===
* [[$phong#Brightness|$phongdisablehalflambert]] {{as|since}} - Also needed for {{mapbase|4.1}}
* [[$phong#Masking|$phongexponentfactor]] From {{src13mp|4.1}}
* [[$phong#Colors|$phongalbedoboost]] {{csgo|since}}
* [[$phong#Masking|$basemapluminancephongmask]] {{as|since}}
**{{LUX|2}} allows the use of Rec. 709 HDTV Luminance Weights. <code>float3(0.2126f, 0.7152f, 0.0722f)</code>.<br>Previously, SDK_ Shaders would use the NTSC Analog Television standard of <code>float3(0.2990f, 0.5870f, 0.1140f)</code>
 
* [[Glowing_Textures#.24selfillum|$selfillumtexture]] Deprecated since {{src07|4.1}}
** Yes, there is a use for this! [[$detail#Parameters and Effects|$detailblendmode]] 5 is commonly used for glowing textures. This parameter allows for not wasting your $detail. Additionally no $emissiveblend is required.
: {{seealso|PBR Shaders in the community commonly have a $emissiontexture parameter that does EXACTLY what [[Glowing_Textures#.24selfillum|$selfillumtexture]] does in {{LUX|4.1}}.}}
* {{Ent|$flowmap}} support - From {{as|4.1}}
* {{Ent|$envmaplightscale}} From for brushes {{as|since}} '''and''' models {{csgo|only}}
:
{{ModernImportant|Features are dependant on types:
* On brushes, this will use the Lightmap
* On models '''with''' {{Ent|$bumpmap}}, this will use Bumped lighting.
* On models '''without''' {{Ent|$bumpmap}}, this will use Vertex Lighting.
* In {{src13mp}} Models utilizing Model Lightmapping, this will use the Lightmap, regardless of if {{Ent|$bumpmap}} is used.}}
 
=== Features that '''won't''' be ported/recreated/revived ===
* $basealphaenvmapmaskminmaxexp from {{as|4.1}} - This parameter is not yet documented on the VDC, it is also unclear what exactly it does...
* $EnvMapLightScaleMinMax from {{csgo|4.1}}
* {{Ent|$envmapsphere}} and related - These features have been removed since {{as|4.1}} and is obsolete.
** This is very easy to re-implement. The 7th face of a [[cubemap]] is still built in {{src13|4.1}}, so this feature is still operational.
 
=== Not functional for now ===
* {{Ent|$distancealpha}} - Non-Functional. Planned for later.
 
= Stock Shaders VS LUX =
{{Todo|Move This to their own pages or something like that. Also, update.}}
<br>
== [[LightmappedGeneric]] ==
{| cellspacing="0"
|- valign="top"
| style="width:50%; padding-right:2em" |
=== Stock Shaders ===
{{bug|hidetested=1|
[[$detail#Parameters and Effects|$detailblendmode]] ({{src13}}{{tf2}}) 2-9 Don't work.<br>
[[$detail#Parameters and Effects|$detailblendmode]] ({{as}}) 6 Doesn't work.<br>
[[$detail#Parameters and Effects|$detailblendmode]] ({{csgo}}) 8 doesn't work. 9 doesn't work with {{Ent|$bumpmap}}, {{Ent|$envmap}} or {{Ent|$selfillum}}<br>
{{Ent|$bumpmap}} + {{Ent|$envmapmask}} Doesn't work, except in {{csgo}}<br>
{{Ent|$lightwarptexture}} + {{Ent|$detail}} ({{tf2}}{{as}}) Doesn't work.<br>
{{Ent|$basealphaenvmapmask}} + {{Ent|bumpmap}} Doesn't work}}
 
[[Glowing_Textures#.24selfillum|$selfillummask]] {{src13|not}}<br>
{{Ent|$selfillum_envmapmask_alpha}} {{src13|not}}<br>
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] {{src13|not}}<br>
{{Ent|$blendtintbybasealpha}} {{src13|not}}<br>
[[$detail#Parameters and Effects|$detailtexturetransform]] {{src13|not}}<br>
{{Ent|$lightwarptexture}}{{csgo|not}}<br>
{{Ent|$envmapfresnelminmaxexp}}{{l4d|since}}<br>
{{Ent|$envmaplightscale}}{{as|since}}<br>
{{Ent|$basealphaenvmapmask}} requires inverted masks
 
| style="width:50%"|
 
=== {{LUX}}LUX_LightMappedGeneric ===
{{Note|
[[$detail#Parameters and Effects|$detailblendmode]] 1-9 works.<br>
[[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned.<br>
{{Ent|$bumpmap}} + {{Ent|$envmapmask}} works, used to be {{only|{{csgo}}.}}<br>
{{Ent|$lightwarptexture}} + {{Ent|$detail}} works<br>
{{Ent|$basealphaenvmapmask}} + {{Ent|$bumpmap}} works.<br>
[[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br>
{{Ent|$blendtintbybasealpha}} Exists now.<br>
{{Ent|$selfillum_envmapmask_alpha}} Exists now.<br>
{{Ent|$envmaplightscale}} Exists now.<br>
[[$detail#Parameters and Effects|$detailtexturetransform]] Exists now.}}
 
{{Notice|Caveat - Has higher priority than [[Glowing_Textures#.24selfillum|$selfillum]]/[[Glowing_Textures#.24selfillum|$selfillummask]].}}
:{{Notice|Caveat - [[Glowing_Textures#.24selfillum|$selfillumtexture]] has higher priority than both.}}
 
{{ModernImportant|{{Ent|$basealphaenvmapmask}} does not require a flipped mask.}}
:{{workaround|There is a new parameter that can flip the envmap mask. It also works with {{Ent|$envmapmask}} and {{Ent|$normalmapalphaenvmapmask}}.}}
|}
 
== [[VertexLitGeneric]] ==
{| cellspacing="0"
|- valign="top"
| style="width:50%; padding-right:2em" |
=== Stock Shaders ===
==== Always ====
{{Ent|$envmaplightscale}}{{only|{{csgo}}}}.
 
==== Without $Bumpmap ====
{{bug|hidetested=1|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 10-11 Don't work.<br>
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] missing.<br>
{{Ent|$lightwarptexture}} missing.}}
{{Note|$lightwarptexture forces bumpmapping by binding a default one, unless one is manually specified.}}
 
 
==== '''With''' $Bumpmap ====
{{bug|hidetested=1|
[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 5-11 Don't work.<br>
[[$detail#Parameters and Effects|$detailblendmode]]{{csgo}} 5-6 & 8-11 Don't work.}}
{{Note|
{{Ent|$envmapmask}} missing. Except {{mapbase}}.<br>
[[Glowing_Textures#.24selfillum|$selfillummask]] missing. {{ModernConfirm|Only in {{mapbase}}?}}
{{Ent|$selfillum_envmapmask_alpha}}{{mapbase}} missing.<br>
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] disables {{Ent|$normalmapalphaenvmapmask}}. {{todo|Also on other branches than {{as}}?}}}}
 
 
==== With $Phong ====
{{bug|hidetested=1|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 8-11 Don't work.
[[$phong#Masking|$invertphongmask]]{{as}}{{src13}} In the shadercode, only flips the mask used for {{Ent|$envmap}}. {{ModernConfirm|Also on newer branches?}}
[[$phong#Colors|$phongalbedotint]] cannot be used without [[$phong#Masking|$phongexponenttexture]].<br>
{{Ent|$phongwarptexture}}{{l4d2}} does not work.<br>
[[$phong#Colors|$phongalbedoboost]]{{only|{{csgo}}}} + {{Ent|$detail}} does not work.<br>
[[$phong#Colors|$phongtint]] disables [[$phong#Colors|$phongalbedotint]].<br>
{{Ent|$envmap}} always masked by something.<br>
{{Only in {{l4d}}+ {{Ent|$envmap}} masked by {{Ent|$basetexture}} luminance when {{Ent|$normalmapalphaenvmapmask}} and [[$phong#Masking|$basemapluminancephongmask]] is used.<br>
{{Ent|$envmap}} masked by {{Ent|$basetexture}} alpha when {{Ent|$normalmapalphaenvmapmask}} and [[$phong#Masking|$basemapalphaphongmask]] is used.<br>
[[$phong#Masking|$basemapalphaphongmask]] makes {{Ent|$phong}} ignore the {{Ent|$bumpmap}}.<br>
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{Ent|$normalmapalphaenvmapmask}} will cause the {{Ent|$envmap}} to be multiplied by <code>0.0f</code> regardless of whether [[$phong#Masking|$invertphongmask]] is used.<br>
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] will cause {{Ent|$envmap}} to be masked using the {{Ent|$basetexture}} alpha channel.}}}}
 
{{Note|[[$phong#Brightness|$phongdisablehalflambert]]{{as|since}}<br>
[[$phong#Masking|$phongexponentfactor]] only in {{tf2}}{{src13mp}}<br>
[[$phong#Masking|$basemapluminancephongmask]]{{l4d|since}}<br>
[[$phong#Colors|$phongalbedoboost]] only in {{csgo|since}}}}
 
| width="50%" |
 
=== {{LUX}}LUX_VertexLitGeneric ===
==== Without $Bumpmap ====
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] Exists now.<br>
* {{Ent|$lightwarptexture}} Exists now.<br>
::{{todo|Make a parameter that allows its usage. Right now default behavior is replicated and a default bumpmap is bound.}}
 
 
==== '''With''' $Bumpmap ====
* [[$detail#Parameters and Effects|$detailblendmode]] 5-9 work.<br>
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>
* {{Ent|$envmapmask}} Exists now.<br>
* [[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br>
* {{Ent|$selfillum_envmapmask_alpha}} Exists now.<br>
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{Ent|$normalmapalphaenvmapmask}} Works now.<br>
 
 
==== With $Phong ====
* [[$detail#Parameters and Effects|$detailblendmode]] 8-9 work now.<br>
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>
 
{{Note|[[$phong#Masking|$invertphongmask]] Now only flips the mask used for phong. It will no longer touch the envmapmask ''at all''.<br>
[[$phong#Colors|$phongalbedotint]] can now be used without [[$phong#Masking|$phongexponenttexture]].}}
:{{Notice|Will use entirety of {{Ent|$basetexture}}, without being masked.}}
 
* [[$phong#Colors|$phongwarptexture]] Works ( {{not|l4d2|4.1}} ).<br>
* [[$phong#Colors|$phongalbedoboost]] Exists now. Used to be {{only|{{csgo}}.}}
* [[$phong#Colors|$phongalbedoboost]] + {{Ent|$detail}} Works. Does not work in {{csgo|4.1}}.<br>
 
{{Note|[[$phong#Colors|$phongtint]] does no longer disable [[$phong#Colors|$phongalbedotint]]. It will do <code>($baseTexture * Mask) * $PhongTint</code>}}
:{{Notice|When no [[$phong#Masking|$phongexponenttexture]] is specified, Mask will be 1.0f!}}
 
* {{Ent|$envmap}} Can now be not-masked by using a new parameter (<code>$phongenvmapnomask</code>)
: {{ModernImportant|By default the original masking for the $envmap will be replicated to not have disparity. However, it can now be overridden using two new parameters. <code>$phongforcebasealphaenvmapmask</code> and <code>$phongforcenormalmapalphaenvmapmask</code>}}
 
* [[$phong#Masking|$basemapalphaphongmask]] '''no longer''' makes {{Ent|$phong}} ignore the {{Ent|$bumpmap}}.
:{{Notice|This will make materials that previously used this intentionally, look different.}}
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{Ent|$normalmapalphaenvmapmask}} will no longer multiply the {{Ent|$envmap}} by <code>0.0f</code>
* [[$phong#Brightness|$phongdisablehalflambert]] Exists now. ( Used to be {{only|{{as}}+}}
* [[$phong#Masking|$phongexponentfactor]] Exists now for {{src13sp}}. ( Used to be {{only|{{tf2}}{{src13mp}}}})
* [[$phong#Masking|$basemapluminancephongmask]] Exists now. ( Used to be {{since|l4d}})
* [[$phong#Colors|$phongalbedoboost]] Exists now. ( Used to be {{since|csgo}})
|}
 
== History ==
{{LUX|4.1}} started development on January 20th, 2023, but it was planned and thought around January 14th, when the lead developer [[User:ShiroDkxtro2|ShiroDkxtro2]] was in a hospital stay.<br>
Even before 2023, the idea of rewriting Valve's shaders was being considered. Various people asked [[User:ShiroDkxtro2|ShiroDkxtro2]] if certain modifications could be implemented for default shaders, such as cascaded shadow mapping.<br>
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#Goals|LUX's Goals]].<br>
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.<br>
 
== Credits ==
;[https://github.com/SCell555/ShaderCompile SCell555's ShaderCompiler]
:Used to compile the Shaders. Include files ( .inc ) are intended to be made using [https://strawberryperl.com/ Perl].
:{{LUX|4.1}} copies various code from [https://github.com/thexa4/source-pbr thexa4's PBR header]<br>
 
;Tottery ( Also known as TotteryNine )
:TotteryNine was crucial to [[User:ShiroDkxtro2|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.
 
;[[User:Ficool2|Ficool2]]
:For enlightening us about the Constant Register Hack, allowing for the use of more than 32 float constant registers on SM3.0<br>
:This Project would be nearly impossible without it.


;ChatGPT
* [[$phong#Brightness|$phongdisablehalflambert]] from {{asbranch|4.1}}.
:Help with programming and the undocumented graphical features of the Source Engine.
* {{Ent|$lightmap}} from {{src13mp|4.1}}.
:It knows things and can make new things to a degree. Various code used in {{LUX|2}} has been partially written by AI.
* Spline Rope Support from {{asbranch|4.1}}.
* Radial Fog. Originally taken from {{mapbase|4.1}}. However {{src13mp|4.1}} also has the code for this, since TF2SDK.
* [[Parallax Corrected Cubemaps]] from {{mapbase|4.1}}. Has identical parameter names to Mapbases, allow its vBSP to be used.
* Brush {{Ent|$phong}} ( Original Implementation/Feature )
* $Treesway from {{asbranch|4.1}}. However {{src13mp|4.1}} also has the code for this, since TF2SDK.
* [[$phong#Masking|$phongexponentfactor]] from {{src13mp|4.1}}.
* [[$phong#Masking|$basemapluminancephongmask]] from {{asbranch|4.1}}.
* [[$phong#Colors|$phongalbedoboost]] - Logically adapted. {{csgo|since}}
* Rec. 709 HDTV Luminance Weights. <code>float3(0.2126f, 0.7152f, 0.0722f)</code> usable via lux_luminanceweights.
* [[Glowing_Textures#.24selfillum|$selfillumtexture]] for VertexLitGeneric. Deprecated since {{src07|4.1}}, works identical to $DetailBlendMode 5.
* Water {{Ent|$flowmap}} support from {{as|4.1}}.
* {{Ent|$envmaplightscale}} for brushes and models. From {{as|since}} ( Brushes ) and adapted for models {{csgo|only}}.
* {{Ent|$envmapsphere}} for VertexLitGeneric without $BumpMap and $Phong. ( Has a lot of Caveats )
* $ReceiveFlashlight for all Shaders ( Original Implementation/Feature )
* $NoTint and $AllowDiffuseModulation ( From {{as|4.1}} and {{csgo|4.1}}. Logically derived )
* 'Infected' Shader {{l4d|4.1}}. ( Created from publically available Information )
* 'Black' Shader {{l4d|since}}. ( Original Implementation/Feature )
* ..


;{{mapbase|4.1}}
= Features that aren't planned to be supported =
:Since one of the goals of this project is to be compatible with it, various code from it has been adapted.
* [[$bumpmap#Additional_Parameters|$bumpmask]]
:This means that all Shader-related things should also be inherited with the credits of {{LUX|2}}. You can find Mapbase's credits [https://github.com/mapbase-source/source-sdk-2013/wiki/Mapbase-Credits here].
* $basealphaenvmapmaskminmaxexp from {{as|4.1}}
* $EnvMapLightScaleMinMax from {{csgo|4.1}} - No publically available code and it works a bit whacky?
* ..  


;[https://github.com/Joshua-Ashton/Source-PlusPlus/ Source++]
= Resolved Caveats =
:Code might be included, like the NvidiaPCF5x5Gaussian Shadow Filter
* {{Ent|$bumpmap}} + {{Ent|$envmapmask}}. Used to be {{only|{{csgo}}}} and {{only|{{mapbase}}}}
* [[$detail#Parameters and Effects|$detailblendmode]] 0-9 and 11 now supported on VertexLitGeneric, LightmappedGeneric and WorldVertexTransition
* [[$detail#Parameters and Effects|$detailblendmode]] 10 now supports $SSBump. {{only|{{p2}}}}
* {{Ent|$lightwarptexture}} + {{Ent|$detail}}. Doesn't work in {{tf2||4.1}} and {{as||4.1}}
* {{Ent|$basealphaenvmapmask}} + {{Ent|bumpmap}} now supported on VertexLitGeneric.
* {{Ent|$blendtintbybasealpha}} for LightmappedGeneric and WorldVertexTransition.
* [[Glowing_Textures#.24selfillum|$selfillummask]] now supported on some Shaders that didn't have it previously.
* For Main Shaders, all Transform Parameters can now work unattached to one another.
* WVT Now supports separate Transforms for: Base, Base2, Bump, Bump2, Detail, Detail2, EnvMapMask, EnvMapMask2, BlendModulate
* EnvMapMasks can now manually be flipped using $EnvMapMaskFlip. This is also used to reproduce stock behaviours.
* {{Ent|$selfillum_envmapmask_alpha}} previously not on some main shaders in {{src13|not}}
* [[$phong#Masking|$invertphongmask]]{{as}}{{src13}} flips only the EnvMapMask on Stock. LUX solves this with $PhongNewBehaviour.
* [[$phong#Colors|$phongalbedotint]] can now be used without [[$phong#Masking|$phongexponenttexture]].
* [[$phong#Colors|$phongalbedoboost]]{{only|{{csgo}}}} and {{Ent|$detail}} can now be used together.
* [[$phong#Colors|$phongtint]] does not disable [[$phong#Colors|$phongalbedotint]] anymore.
* $PhongFlatNormal introduced to override [[$phong#Masking|$basemapalphaphongmask]] behaviour of forcing a flat normal. ( Disabling the Normal Map )
* Many Phong Issues have been resolved. To keep visual consistency with stock shaders, $PhongNewBehaviour has been introduced that disables broken behaviours.
* {{Ent|$lightwarptexture}} can now be used on VertexLitGeneric without forcing BumpMapping, using $LightWarpNoBump.
* [[$detail#Parameters and Effects|$detailblendmode]] 5 and 6 on $BumpMap'd VertexLitGeneric.
* .. Many.. MANY more Issues have been resolved. Simply too many to list here.


;Joshua Ashton
= History =
:For his various open-source work related to the Source Engine
{{LUX|4.1}} started development on January 20th, 2023. Plans for it were made around January 14th.<br>
Even before 2023, the idea of rewriting Valve's shaders was being considered, due to constant modification requests.<br>
Requests are most commonly denied due to stock shader limitations, artificial complexity and long development times.


== See also ==
= See also =
* {{LUX|4.1}} [https://discord.gg/cGv8GGSkpc Discord] Server
* {{LUX|4.1}} [https://discord.gg/cGv8GGSkpc Discord] Server
: Development can be followed here, Bug-Reports & suggestions made.
: Development can be followed here.
: It is also intended as a general place for discussing {{src13|4.1}} related Shader-Modding.
: It is also intended as a general place for discussing source related Shader-Modding.


* {{LUX|4.1}} [https://github.com/ShiroDkxtro2/ACROHS-LUX_-Shaders-Project GitHub] page
* {{LUX|4.1}} [https://github.com/LUX-Shaders-Team/LUX-Shaders-Issues GitHub Issues] Page.
: For Bug-Reports & Suggestions.


{{Todo|Make a new category for LUX_ Shaders and document them and their parameters there, instead of here. Preferably after they were released on the GitHub.}}
* {{LUX|4.1}} [https://github.com/LUX-Shaders-Team/LUX-Shaders Public GitHub Repository] Page
: The public repository that will hold the code once the project releases.

Latest revision as of 02:56, 17 October 2025

English (en)中文 (zh)Translate (Translate)
LUX
Development.png In Closed Beta development
Wiki
TypeModification
DevelopersShiroDkxtro2
EngineSource Source
PlatformsPC PC ( Linux Linux (only in Source 2013 Multiplayer) )
Based onSource 2013 Source 2013
 
GitHub
Join Discord server

LUX LUX is a mod made for Source 2013 Singleplayer Source 2013 Singleplayer and Source 2013 Multiplayer Source 2013 Multiplayer.
The goal of the Project is a reevaluated and rewritten set of shaders, that are faster to compile, easier to debug and modify.
It resolves caveats and introduces new features, sometimes replicating those from newer source branches.
The shaders are not designed to boost performance, don't expect superficial increases in fps.

LUX can serve as a drop-in replacement to the shaders from Mapbase Mapbase.
Although it references Alien Swarm Code, the branch itself is not supported.
Similarly, macOS macOS is not supported.

LUX is based on publicly available code and has a strict no leaked-code policy.


Goals

  • Total Overhaul of the 🖿materialsystem\ folder
Implementing LUX LUX is intended to be as easy as possible. To ensure this, changes are restricted to the 🖿materialsystem\ folder.
Using Code from the Orange Box and Alien Swarm, 🖿materialsystem\shaderlib has been added back in and is used to implement new features.
Previously LUX was limited to the 🖿materialsystem\stdshaders folder. Now it's 🖿materialsystem\ to allow for this.
  • Faster compile times for all Shaders
All shaders have been rewritten from scratch and the systems they use have been reevaluated.
Due to this, all shaders in the project can be compiled in about 15 minutes on dated hardware.
For newer Hardware ( r9 5950x ), you may see times as low as two minutes.
Various shaders now have their own .bat scripts. Making it easier to develop individual shaders.
This means modding specific shaders ( such as VertexLitGeneric ) is much faster.
Now changing a header does not mean having to 'recompile the universe'
LUX LUX intends to serve as a drop-in replacement for Mapbase Shaders
Thus it has features such as Parallax Corrected Cubemaps ( and much more.. radial fog, non-location specific Core Shader, .. )
To facilitate this, every SDK_ Prefixed Shader will fallback to LUX_
  • Stock Shader replacement
LUX LUX allows for the selective replacement of existing shaders on Source 2013 Multiplayer Source 2013 Multiplayer.
Using Various other methods such as memory patching or material passthrough this may also be used on Source 2013 Singleplayer Source 2013 Singleplayer
  • Shadermodel 3.0 only
To allow for many of the new features, all of the Shaders use Shadermodel 3.0.
A limitation created by this is that Linux on Source 2013 Singleplayer Source 2013 Singleplayer cannot run LUX, since ToGL does not have support for it,
DXVK may serve as an alternative here for Linux Users.
SM3.0 released in 2004, and Valve considered ps2.0b low end hardware in ~2008. See slide 8
This means that older hardware not capable of SM3.0 will not be able to use the new Shaders either.
  • Drastically more documentation, including their parameters, how they work and any possible caveats
Due to the Development of LUX LUX, Articles on the VDC such as $lightwarptexture, $detail, UnlitTwoTexture and $envmapmask
received massive updates, filling them with information about caveats and bugs.
LUX shaders themselves have many comments, notifying when the behaviour of stock shaders has to be considered to keep visual consistency.
A Github Wiki listing all shader parameters and all shaders in the project is in the works.
Helper strings have been added to all parameters and can be read back via the in-game console as well.
This includes old features such as $selfillumtexture and newer features like $phongalbedoboost(only in Counter-Strike: Global Offensive).
Note that LUX is not made from leaked code. Features (such as $SSBumpMathFix) have been derived from visual research in branches with them present and logical conclusions.
  • Fixing parameter caveats when they don't break visual consistency.
Dozens of broken parameter combinations are fixed with LUX.
LUX has a habit of magically fixing things we didn't even know were broken on stock.
If there is a broken combination or a caveat that isn't fixed, make a github issue ( please check if it's broken on LUX first )

Features

Some Features from these Branches have been implemented:

Note.pngNote:Code from Alien Swarm engine branch Alien Swarm engine branch is heavily adapted, cross-referencing may be difficult.
Warning.pngWarning:Features that couldn't be made with code reference will be prone to visual disparity.

Features that aren't planned to be supported

Resolved Caveats

  • $bumpmap + $envmapmask. Used to be (only in Counter-Strike: Global Offensive) and (only in Mapbase)
  • $detailblendmode 0-9 and 11 now supported on VertexLitGeneric, LightmappedGeneric and WorldVertexTransition
  • $detailblendmode 10 now supports $SSBump. (only in Portal 2)
  • $lightwarptexture + $detail. Doesn't work in Team Fortress 2 and Alien Swarm
  • $basealphaenvmapmask + bumpmap now supported on VertexLitGeneric.
  • $blendtintbybasealpha for LightmappedGeneric and WorldVertexTransition.
  • $selfillummask now supported on some Shaders that didn't have it previously.
  • For Main Shaders, all Transform Parameters can now work unattached to one another.
  • WVT Now supports separate Transforms for: Base, Base2, Bump, Bump2, Detail, Detail2, EnvMapMask, EnvMapMask2, BlendModulate
  • EnvMapMasks can now manually be flipped using $EnvMapMaskFlip. This is also used to reproduce stock behaviours.
  • $selfillum_envmapmask_alpha previously not on some main shaders in (not in Source 2013)
  • $invertphongmaskAlien SwarmSource 2013 flips only the EnvMapMask on Stock. LUX solves this with $PhongNewBehaviour.
  • $phongalbedotint can now be used without $phongexponenttexture.
  • $phongalbedoboost(only in Counter-Strike: Global Offensive) and $detail can now be used together.
  • $phongtint does not disable $phongalbedotint anymore.
  • $PhongFlatNormal introduced to override $basemapalphaphongmask behaviour of forcing a flat normal. ( Disabling the Normal Map )
  • Many Phong Issues have been resolved. To keep visual consistency with stock shaders, $PhongNewBehaviour has been introduced that disables broken behaviours.
  • $lightwarptexture can now be used on VertexLitGeneric without forcing BumpMapping, using $LightWarpNoBump.
  • $detailblendmode 5 and 6 on $BumpMap'd VertexLitGeneric.
  • .. Many.. MANY more Issues have been resolved. Simply too many to list here.

History

LUX LUX started development on January 20th, 2023. Plans for it were made around January 14th.
Even before 2023, the idea of rewriting Valve's shaders was being considered, due to constant modification requests.
Requests are most commonly denied due to stock shader limitations, artificial complexity and long development times.

See also

Development can be followed here.
It is also intended as a general place for discussing source related Shader-Modding.
For Bug-Reports & Suggestions.
The public repository that will hold the code once the project releases.