LUX: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (ModernNote everywhere)
(Up-to-date Information about the Project)
 
(41 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{lang}}
{{LanguageBar}}
 
{{Infotable
{{infotable
| state = 4
|state=5
| ownwiki = https://github.com/LUX-Shaders-Team/LUX-Shaders/wiki
|ownwiki=https://github.com/ShiroDkxtro2/ACROHS-LUX_-Shaders-Project/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}} ( {{linux|4}} {{src13mp|only}} )
|platform={{only|PC}}
| github = LUX-Shaders-Team/LUX-Shaders
|github=ShiroDkxtro2/ACROHS-LUX_-Shaders-Project
| discord = https://discord.gg/cGv8GGSkpc
|discord=https://discord.gg/cGv8GGSkpc
}}
}}
{{LUX|4}} is a [[Modification|mod]] made for {{src13sp|4.1}} and {{src13mp|4.1}}.<br>
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 is a [[Modification|mod]] specifically made and developed for use in {{src13sp|4}} and {{src13mp|4}}.<br>
LUX can serve as a drop-in replacement to the shaders from {{mapbase|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}}.
Although it references Alien Swarm Code, the branch itself is not supported.<br>
 
Similarly, {{Mac|4.1}} is not supported.<br>
==Goals==
* '''Overhauled/Cleaned <code>materialsystem\stdshaders\</code> Folder'''
:{{ModernWarning|Pretty much everything except existing shader-compile functionality is pretty much "nuked".}}
:{{ModernNote|SDK_ Shaders will fall back to LUX_ Shaders, that way LUX_ can easily be used on {{mapbase|4}} mods without much work.}}
:{{Notice| Implementing LUX Shaders would entail replacing the existing <code>stdshaders\</code> with the one from LUX. Effectively 'nuking' SDK_ Shaders. LUX Shaders should be able to do everything SDK_ Shaders in {{src13}} and {{mapbase}} can do.}}
<br>
* '''Drastically decreased compile-times for all Shaders'''
:{{Why|Valves Shaders take '''forever''' to compile {{src13sp}}{{src13mp}}{{as}}. Especially using the stock Shader-Compiler. This disincentives modding the Shaders.}}
:{{Notice|Even on a good CPU it can take half a day, '''or more'''. As an example for LUX. Compiling the entirety of LUX_LightMappedGeneric takes around 30 seconds on 4 cores @4.1GHz }}
<br>
* '''SM3.0 Shaders Only'''
:{{why|ps20b and below is too limiting. The lack of available constant registers causes extreme branching and a lot of 'combos'. Making the code terrible to read and complicated. This disincentives Modders.}}
:{{Notice|Linux is not officially supported. MacOS is also not officially supported. Users of said system will have to either patche <code>togl</code> to work with SM3.0 or use DxVK. }}
:{{ModernNote|
:* 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'''
:* This means that older hardware not capable of SM3.0 will not be able to use the new Shaders.}}
<br>
* '''Totally rewritten .h, .cpp, .fxc files'''
<br>
* '''More Documentation for Shaders, their parameters, how they work and any possible caveats'''
:{{Notice|You might have noticed Articles like {{ent|$lightwarptexture}}, {{ent|$detail}}, {{ent|UnlitTwoTexture}} and {{ent|$envmapmask}} getting major updates from [[User:ShiroDkxtro2|ShiroDkxtro2]],
:where new information about Caveats and bugs were added for {{tf2}}{{as}}{{src13}}{{csgo}}. This was a direct result of LUX development, although the focus was mainly on {{src13}}{{as}} as their code is publicly available. }}
:{{ModernNote|The current lack of documentation, on how Shaders work in Source, disincentives Modders from learning how to mod Shaders or make their own. The barrier of entry is v. high as a lot of very specific knowledge is required too.}}
<br>
* '''Implementing features that aren't available in {{src13}}'''
:{{Seealso|<code>Planned Features</code>. This includes old features such as [[Glowing_Textures#.24selfillum|$selfillumtexture]] and newer features like [[$phong#Colors|$phongalbedoboost]]{{csgo|only}}.}}
<br>
* '''Fixing most Parameter "bugs:" and other caveats'''
:{{Seealso|<code>Stock Shaders VS LUX</code>}}
<br>
* '''Easy way of disabling features'''
:{{Important|A custom Pre-Processor program has been made. It automatically sets <code>// STATIC:</code>'s to predefined values depending on <code>#define</code>'s in an included header file.}}
:{{ModernNote|Mods that don't require specific features (lightwarptexture/distancealpha/phong/envmaps/etc), can easily disable them. This will speed up Shader-compilation. Most parameters have been <code>#ifdef</code>'d in the c++ code!}}
<br>
* '''Mapbase compatibility'''
:{{Notice|Replacing SDK_ Shaders in SDK mods, SDK2013CE or Mapbase mods should be as simple as replacing the <code>stdshaders\</code> Folder.}}
:{{ModernNote|It is assumed that no custom Shaders apart from SDK_ ones were added. If they do were added however, developers should be capable of adding them back, as that is the prerequisite for adding custom Shaders.}}
<br>
==Planned Features==
This is a list of new features that are being implemented, or features that will be ported/recreated from newer branches such as {{as}}{{l4d2}}{{csgo}}
{{ModernNote|Ported in this case usually means {{as}}{{mapbase}}, however in most of these cases, the code for this will be heavily adapted to simplify or overhaul it.}}
{{Important|LUX does '''not''' use ''any'' leaked code. Features like [[$phong#Colors|$phongalbedoboost]]{{only|csgo}} are not rocket-science. They can safely be recreated without the use of leaked code.}}
:{{ModernWarning|For features that are more complicated, there might be visual disparity when compared to official implementations.}}
<br>
==== Features required for {{mapbase|2}} compatibility ====
* [[$phong#Brightness|$phongdisablehalflambert]] from {{as}}+
* Radial Fog for all "Geometry" Shaders
* Spline-Ropes
* Parallax Corrected Cubemaps ( PCC )
:{{ModernNote|Just like {{mapbase|2}}, this requires custom compilers to work.}}
:{{important|The parameters are the same for LUX and {{mapbase}}. This means that Mapbase compilers can be used for this 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
:{{ModernTodo|Is the {{mapbase}} implementation ported from {{as}}?}}
<br>
==== New Features ====
* In {{src13mp}} Models utilizing Model Lightmapping can use {{ent|$bumpmap}}. Additionally all Model shaders will be able to utilize this feature. Except they have {{ent|$phong}}.
:{{important|The Lightmap does not do bumped-lighting using the bumpmap. Only named-lights/projected textures will be able to do so.}}
:{{ModernNote| 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.
:{{ModernWarning|The way this is currently implemented requires a custom written tool, two smd's ( one with lightmap uv ) and also has a lot of precision loss for the Lightmap UV's. Additionally this requires a custom compiler! }}
::{{ModernTodo|Investigate {{src07}} code, supposedly the Studiomdl code is there. Maybe it can be packed via Blendweights or alternatively the precision loss might be decreased.}}
<br>
==== Features ported/recreated/revived ====
* [[$phong#Brightness|$phongdisablehalflambert]] From {{as}}+ - Also needed for {{mapbase}}
* [[$phong#Masking|$phongexponentfactor]] From {{src13mp}}{{tf2}}, with LUX also on {{src13sp}}
* [[$phong#Colors|$phongalbedoboost]] From {{csgo}} - Its just <code>BaseTexture * $PhongAlbedoBoost</code>... No leaked code!
* [[$phong#Masking|$basemapluminancephongmask]] From {{as}}+
:{{ModernNote|
:* LUX allows the use of Rec. 709 HDTV Luminance Weights. <code>float3(0.2126f, 0.7152f, 0.0722f)</code>.
:* 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}} - This used to be obsolete
:{{ModernNote| 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.}}
* Water Shader with {{ent|$flowmap}} Support - From {{as}}
* {{ent|$envmaplightscale}} From {{as}} for brushes{{as}}+ AND models {{only|{{csgo}}}}+
:{{important|
:* 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, will use the Lightmap. Regardless of whether or not {{ent|$bumpmap}} is used.}}
<br>
==== Features that are being discarded ====
* {{ent|$envmapsphere}} and related - These features have been removed since {{as}} and are obsolete.
:{{ModernNote|This is very easy to re-implement. The 7th face of a Cubemap is still being built in {{src13}} and therefore this feature is still operational given that the code has been implemented!}}
* [[$bumpmap#Additional_Parameters|$bumpmask]] and related
<br>
==== Features that '''won't''' be ported/recreated/revived ====
* $basealphaenvmapmaskminmaxexp from {{as}} - This parameter is not yet documented on the VDC, it is also unclear what exactly it does...
* $EnvMapLightScaleMinMax from {{csgo}}
<br>
==== Not functional - FOR NOW ====
* {{ent|$emissiveblend}} - Non-Existant. Planned for later.
* {{ent|$distancealpha}} - Non-Functional. Planned for later.
* {{ent|$ssbump}} - Non-Functional. Planned for later.
* [[$detail#Parameters and Effects|$detailblendmode]] <code>10 & 11</code>.  - Non-Functional. Planned for later.
<br>
 
=Stock Shaders VS LUX=
{{todo|Move This to their own pages or something like that.}}
<br>
== LightMappedGeneric ==
=== Stock Shaders ===
{{ModernBug|
[[$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}} 1-6, 8 Don't work. 9 Does not work with {{ent|$bumpmap}}, {{ent|$envmap}} or {{ent|$selfillum}}<br>
{{ent|$bumpmap}} + {{ent|$envmapmask}} Doesn't work, except in {{csgo|4}}<br>
{{ent|$lightwarptexture}} + {{ent|$detail}}{{tf2}}{{as}} Doesn't work.<br>
{{ent|$basealphaenvmapmask}} + {{ent|bumpmap}} Doesn't work}}


{{ModernNote|
LUX is based on publicly available code and has a strict no leaked-code policy.<br>
[[Glowing_Textures#.24selfillum|$selfillummask]] Missing<br>
{{ent|$selfillum_envmapmask_alpha}} Missing<br>
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] Missing<br>
{{ent|$blendtintbybasealpha}} Missing<br>
[[$detail#Parameters and Effects|$detailtexturetransform]] Missing<br>
{{ent|$lightwarptexture}}{{csgo}} Missing<br>
{{ent|$envmapfresnelminmaxexp}}{{only|{{l4d}}+}}<br>
{{ent|$envmaplightscale}}{{only|{{as}}+}}}}


{{Notice|{{ent|$basealphaenvmapmask}} requires inverted masks}}
<br>
=== LUX_LightMappedGeneric ===
{{ModernNote|
[[$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 ( does not work in {{as}}{{tf2}} ).<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>
[[$detail#Parameters and Effects|$detailtexturetransform]] Exists now.}}


{{Notice|Caveat - Has higher priority than [[Glowing_Textures#.24selfillum|$selfillum]]/[[Glowing_Textures#.24selfillum|$selfillummask]].}}
== Goals ==
:{{Notice|Caveat - [[Glowing_Textures#.24selfillum|$selfillumtexture]] has higher priority than both.}}
* Total Overhaul of the {{file|materialsystem\}} folder
: Implementing {{LUX|4.1}} is intended to be as easy as possible. To ensure this, changes are restricted to the {{file|materialsystem\}} folder.
: Using Code from the Orange Box and Alien Swarm, {{file|materialsystem\shaderlib}} has been added back in and is used to implement new features.
: Previously LUX was limited to the {{file|materialsystem\stdshaders}} folder. Now it's {{file|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'
* Compatability with {{mapbase|4.1}}
: {{LUX|4.1}} 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|4.1}} allows for the selective replacement of existing shaders on {{src13mp|4.1}}.
: Using Various other methods such as memory patching or material passthrough this may also be used on {{src13sp|4.1}}
* 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 {{src13sp|4.1}} 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 [https://cdn.cloudflare.steamstatic.com/apps/valve/2010/siggraph2010_vlachos_waterflow.pdf 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|4.1}}, Articles on the VDC such as {{Ent|$lightwarptexture}}, {{Ent|$detail}}, {{Ent|UnlitTwoTexture}} and {{Ent|$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.
* 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 )


{{important|{{ent|$basealphaenvmapmask}} does no longer require a flipped mask.}}
= Features =
:{{ModernWorkaround|Materials that previously used have to be adjusted. Use {{ent|$envmapmask}} or {{ent|$normalmapalphaenvmapmask}} instead!}}
Some Features from these Branches have been implemented:
<br>
*{{asbranch|4.1}}
== VertexLitGeneric ==
*{{l4dbranch|4.1}}
=== Stock Shaders ===
*{{csgobranch|4.1}}
==== Always ====
:{{note|Code from {{asbranch|4.1}} is heavily adapted, cross-referencing may be difficult.}}
{{ent|$envmaplightscale}}{{only|{{csgo}}}}.
:{{warning|Features that couldn't be made with code reference will be prone to visual disparity.}}
<br>
==== Without $Bumpmap ====
{{ModernBug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 10-11 Don't work.<br>
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] missing.<br>
{{ent|$lightwarptexture}} missing.}}
{{ModernNote|$lightwarptexture fores bumpmapping by binding a default one, unless one is manually specified.}}
<br>
==== '''With''' $Bumpmap ====
{{ModernBug|
[[$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.}}
{{ModernNote|
{{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}}. {{ModernTodo|Also on other branches than {{as}}?}}}}
<br>
==== With $Phong ====
{{ModernBug|[[$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.}}}}


{{ModernNote|[[$phong#Brightness|$phongdisablehalflambert]] only in {{as}}+<br>
* [[$phong#Brightness|$phongdisablehalflambert]] from {{asbranch|4.1}}.
[[$phong#Masking|$phongexponentfactor]] only in {{tf2}}{{src13mp}}<br>
* {{Ent|$lightmap}} from {{src13mp|4.1}}.
[[$phong#Masking|$basemapluminancephongmask]] only in {{l4d}}+<br>
* Spline Rope Support from {{asbranch|4.1}}.
[[$phong#Colors|$phongalbedoboost]] only in {{csgo}}+}}
* Radial Fog. Originally taken from {{mapbase|4.1}}. However {{src13mp|4.1}} also has the code for this, since TF2SDK.
<br>
* [[Parallax Corrected Cubemaps]] from {{mapbase|4.1}}. Has identical parameter names to Mapbases, allow its vBSP to be used.
=== LUX_VertexLitGeneric ===
* Brush {{Ent|$phong}} ( Original Implementation/Feature )
==== Without $Bumpmap ====
* $Treesway from {{asbranch|4.1}}. However {{src13mp|4.1}} also has the code for this, since TF2SDK.
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>
* [[$phong#Masking|$phongexponentfactor]] from {{src13mp|4.1}}.
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] Exists now.<br>
* [[$phong#Masking|$basemapluminancephongmask]] from {{asbranch|4.1}}.
* {{ent|$lightwarptexture}} Exists now.<br>
* [[$phong#Colors|$phongalbedoboost]] - Logically adapted. {{csgo|since}}
::{{ModernTodo|Make a parameter that allows its usage. Right now default behavior is replicated and a default bumpmap is bound.}}
* Rec. 709 HDTV Luminance Weights. <code>float3(0.2126f, 0.7152f, 0.0722f)</code> usable via lux_luminanceweights.
<br>
* [[Glowing_Textures#.24selfillum|$selfillumtexture]] for VertexLitGeneric. Deprecated since {{src07|4.1}}, works identical to $DetailBlendMode 5.
==== '''With''' $Bumpmap ====
* Water {{Ent|$flowmap}} support from {{as|4.1}}.
* [[$detail#Parameters and Effects|$detailblendmode]] 5-9 work.<br>
* {{Ent|$envmaplightscale}} for brushes and models. From {{as|since}} ( Brushes ) and adapted for models {{csgo|only}}.
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>
* {{Ent|$envmapsphere}} for VertexLitGeneric without $BumpMap and $Phong. ( Has a lot of Caveats )
* {{ent|$envmapmask}} Exists now.<br>
* $ReceiveFlashlight for all Shaders ( Original Implementation/Feature )
* [[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br>
* $NoTint and $AllowDiffuseModulation ( From {{as|4.1}} and {{csgo|4.1}}. Logically derived )
* {{ent|$selfillum_envmapmask_alpha}} Exists now.<br>
* 'Infected' Shader {{l4d|4.1}}. ( Created from publically available Information )
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{ent|$normalmapalphaenvmapmask}} Works now.<br>
* 'Black' Shader {{l4d|since}}. ( Original Implementation/Feature )
<br>
* ..
==== With $Phong ====
* [[$detail#Parameters and Effects|$detailblendmode]] 8-9 work now.<br>
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>


{{ModernNote|[[$phong#Masking|$invertphongmask]] Now only flips the mask used for phong. It will no longer touch the envmapmask ''at all''.<br>
= Features that aren't planned to be supported =
[[$phong#Colors|$phongalbedotint]] can now be used without [[$phong#Masking|$phongexponenttexture]].}}
* [[$bumpmap#Additional_Parameters|$bumpmask]]
:{{Notice|Will use entirety of {{ent|$basetexture}}, without being masked.}}
* $basealphaenvmapmaskminmaxexp from {{as|4.1}}
* $EnvMapLightScaleMinMax from {{csgo|4.1}} - No publically available code and it works a bit whacky?
* ..  


* [[$phong#Colors|$phongwarptexture]] works. ( does not work in {{l4d2}} ).<br>
= Resolved Caveats =
* [[$phong#Colors|$phongalbedoboost]] Exists now. Used to be {{only|{{csgo}}.}}
* {{Ent|$bumpmap}} + {{Ent|$envmapmask}}. Used to be {{only|{{csgo}}}} and {{only|{{mapbase}}}}
* [[$phong#Colors|$phongalbedoboost]] + {{ent|$detail}} Works. Does not work in {{csgo|4}}.<br>
* [[$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.


{{ModernNote|[[$phong#Colors|$phongtint]] does no longer disable [[$phong#Colors|$phongalbedotint]]. It will do <code>($baseTexture * Mask) * $PhongTint</code>}}
= History =
:{{Notice|When no [[$phong#Masking|$phongexponenttexture]] is specified, Mask will be 1.0f!}}
{{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.


* {{ent|$envmap}} Can now be not-masked by using a new parameter (<code>$phongenvmapnomask</code>)
= See also =
: {{important|By default the original masking for the $envmap will be replicated as to not have disparity. However it can now be overriden using two new parameters. <code>$phongforcebasealphaenvmapmask</code> and <code>$phongforcenormalmapalphaenvmapmask</code>}}
* {{LUX|4.1}} [https://discord.gg/cGv8GGSkpc Discord] Server
: Development can be followed here.
: It is also intended as a general place for discussing source related Shader-Modding.


* [[$phong#Masking|$basemapalphaphongmask]] '''no longer''' makes {{ent|$phong}} ignore the {{ent|$bumpmap}}.
* {{LUX|4.1}} [https://github.com/LUX-Shaders-Team/LUX-Shaders-Issues GitHub Issues] Page.
:{{Notice|This will make materials that previously used this intentionally, look different.}}
: For Bug-Reports & Suggestions.
* [[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 {{only|{{l4d}}+}}
* [[$phong#Colors|$phongalbedoboost]] Exists now. ( Used to be {{only|{{csgo}}+}}
<br>
<br>
<br>
<br>


{{todo|Add LUX_WorldVertexTransition and other LUX_ Shaders to this list of comparison and changes.}}
* {{LUX|4.1}} [https://github.com/LUX-Shaders-Team/LUX-Shaders Public GitHub Repository] Page
:{{note| Probably better as their own pages to document all parameters.}}
: 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.