LUX: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (Fixed minor mistake - Github Link is doubled, a bunch of typo's)
m (Setting bug notice hidetested=1 param on page where the bug might not need tested in param specified)
 
(42 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{lang}}
{{LanguageBar}}
 
{{Infotable
{{infotable
| state = 5
|{{{1}}}=LUX
| ownwiki = https://github.com/ShiroDkxtro2/ACROHS-LUX_-Shaders-Project/wiki
|state=5
| type = m0
|ownwiki=https://github.com/ShiroDkxtro2/ACROHS-LUX_-Shaders-Project/wiki
| dev = [[User:ShiroDkxtro2|ShiroDkxtro2]]
|type=m0
| engine = 2
|dev=[[User:ShiroDkxtro2|ShiroDkxtro2]]<span style=float:right;font-size:18px>[[LUX_#Credits|<span title="Go to Credits">↴</span>]]</span>
| base = {{src13|4}}
|engine=2
| platform = {{PC|4}}
|base={{src13|4}}
| github = ShiroDkxtro2/ACROHS-LUX_-Shaders-Project
|platform={{only|PC}}
| discord = https://discord.gg/cGv8GGSkpc
|github=ShiroDkxtro2/ACROHS-LUX_-Shaders-Project/
|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>
The Project is to entirely rewrite all existing "'''SDK_'''" Shaders, that come with the SDK and all those available in {{mapbase|4.1}}.


LUX is a [[modification|mod]] specifically made and developed for use in {{src13sp|4}} and {{src13mp|4}}.<br>
== Goals ==
The Project is to entirely rewrite all existing "'''SDK_'''" Shaders, that come with the SDK and all those available in {{mapbase|4}}.
;Overhaul/Clean {{file|materialsystem\stdshaders\}} 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.
: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.
:Many .h, .cpp, .fxc files have been rewritten
<br>
;Drastically decrease compile times for all Shaders
: With {{LUX|4.1}}, compiling the entirety of LUX_LightMappedGeneric takes around 30 seconds on 4 cores @4.1GHz
<br>
;SM3.0 Shaders Only
: {{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.
: {{Note|
:* 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>
;More Documentation for Shaders, their parameters, how they work and any possible caveats
: 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.
: 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.
<br>
;Implementing features that aren't available in {{src13|4.1}}
: {{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}}.}}
<br>
;Fixing most Parameter bugs and other caveats
: {{Seealso|[[LUX#Stock Shaders VS LUX|Stock Shaders VS LUX]]}}
<br>
;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.
<br>
;{{mapbase|4.1}} compatibility
: 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.
<br>


==Goals==
= Planned Features =
* '''Overhauled/Cleaned <code>materialsystem\stdshaders\</code> Folder'''
This is a list of new features that are being implemented / will be implemented from newer branches such as:  
:{{warning|Pretty much everything except existing shader-compile functionality is pretty much "nuked".}}
*{{asbranch|4.1}}
:{{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.}}
*{{l4dbranch|4.1}}
::{{note|SDK_ Shaders will fall back to LUX_ Shaders, that way LUX_ can easily be used on {{mapbase|4}} mods without much work.}}
*{{csgobranch|4.1}}
* '''Drastically decreased compile-times for all Shaders'''
The code may be modified for simplification or if it needs a overhaul
:{{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 }}
* '''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.}}
:{{note|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'''}}
:{{note|This means that older hardware not capable of SM3.0 will not be able to use the new Shaders.}}
:{{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. }}
* '''Totally rewritten .h, .cpp, .fxc files'''
* '''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. }}
:{{note|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.}}
* '''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]]{{only|csgo}}.}}
* '''Fixing most Parameter "bugs:" and other caveats'''
:{{Seealso| <code>Stock Shaders VS LUX</code>}}
* '''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.}}
::{{note|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!}}
* '''Mapbase compatibility'''
:{{notice| Replacing SDK_ Shaders in SDK mods, SDK2013CE or Mapbase mods should be as simple as replacing the <code>stdshaders\</code> Folder.}}
:{{note| 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.}}


==Planned Features==
{{ModernImportant|{{LUX|2}} does '''not''' use '''any''' leaked code. Features like [[$phong#Colors|$phongalbedoboost]]{{only|{{csgo}}}} are not rocket science and easily be recreated.
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}}
:{{warning|For more complicated features, there might be visual disparity when compared to official implementations.}}}}
{{note|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.}}
:{{warning|For features that are more complicated, there might be visual disparity when compared to official implementations.}}


==== Features required for {{mapbase|4}} compatibility ====
=== {{mapbase|4.1}} compatibility ===
* [[$phong#Brightness|$phongdisablehalflambert]] from {{as}}+
{{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
* Radial Fog for all "Geometry" Shaders
* Spline-Ropes
* Spline-Ropes
* Parallax Corrected Cubemaps ( PCC )
* [[Parallax Corrected Cubemaps]]
:{{note|Just like {{mapbase|4}}, this requires custom compilers to work.}}
**Just like with {{mapbase|4.1}}, this will require a custom compiler 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}}
* {{ent|$envmapmask}} + {{ent|$bumpmap}} on {{ent|VertexLitGeneric}}
* Replacement for the "Postprocessing" Controller Shader
* Replacement for the "Postprocessing" Controller Shader
* Replacement for the "Engine_post" Shader from {{as}}
* Replacement for the "Engine_post" Shader from {{as}}
* Hammer {{ent|$blendmodulatetexture}} previewing fix.
* Hammer {{Ent|$blendmodulatetexture}} previewing fix.
* Brush {{ent|$phong}}
* Brush {{Ent|$phong}}
* Treesway
* Treesway
:{{todo|Is the {{mapbase}} implementation ported from {{as}}?}}
: {{confirm|Is the {{mapbase|4.1}} implementation ported from {{as|4.1}}?}}
* [[$bumpmap#Additional_Parameters|$bumpmask]] and related
<br>


==== New Features ====
=== 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}}.
* 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}}.
:{{important|The Lightmap does not do bumped-lighting using the bumpmap. Only named-lights/projected textures will be able to do so.}}
**The Lightmap does not do bumped-lighting using the bumpmap. Only named lights/projected textures will be able to do so.
:{{note| 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!}}
**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.
* In {{src13mp}} Models can utilize Lightmap UV's.
:{{warning|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! }}
**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.}}
::{{todo|Investigate {{src07}} code, supposedly the Studiomdl code is there. Maybe it can be packed via Blendweights or alternatively the precision loss might be decreased.}}


==== Features ported/recreated/revived ====
=== Features ported/recreated ===
* [[$phong#Brightness|$phongdisablehalflambert]] From {{as}}+ - Also needed for {{mapbase}}
* [[$phong#Brightness|$phongdisablehalflambert]] {{as|since}} - Also needed for {{mapbase|4.1}}
* [[$phong#Masking|$phongexponentfactor]] From {{src13mp}}{{tf2}}, with LUX also on {{src13sp}}
* [[$phong#Masking|$phongexponentfactor]] From {{src13mp|4.1}}
* [[$phong#Colors|$phongalbedoboost]] From {{csgo}} - Its just <code>BaseTexture * $PhongAlbedoBoost</code>... No leaked code!
* [[$phong#Colors|$phongalbedoboost]] {{csgo|since}}
* [[$phong#Masking|$basemapluminancephongmask]] From {{as}}+
* [[$phong#Masking|$basemapluminancephongmask]] {{as|since}}
:{{note|LUX allows the use of Rec. 709 HDTV Luminance Weights. <code>float3(0.2126f, 0.7152f, 0.0722f)</code>.<br>
**{{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>
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
:{{note| 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.


==== Features that are being discarded ====
* [[Glowing_Textures#.24selfillum|$selfillumtexture]] Deprecated since {{src07|4.1}}
* {{ent|$envmapsphere}} and related - These features have been removed since {{as}} and are obsolete.
** 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.
:{{note|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!}}
: {{seealso|PBR Shaders in the community commonly have a $emissiontexture parameter that does EXACTLY what [[Glowing_Textures#.24selfillum|$selfillumtexture]] does in {{LUX|4.1}}.}}
* [[$bumpmap#Additional_Parameters|$bumpmask]] and related
* {{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.


==== Features that '''won't''' be ported/recreated/revived ====
=== Not functional for now ===
* $basealphaenvmapmaskminmaxexp from {{as}} - This parameter is not yet documented on the VDC, it is also unclear what exactly it does...
* {{Ent|$distancealpha}} - Non-Functional. Planned for later.
* $EnvMapLightScaleMinMax from {{csgo}}


==== Not functional - FOR NOW ====
= Stock Shaders VS LUX =
* {{ent|$emissiveblend}} - Non-Existant. Planned for later.
{{Todo|Move This to their own pages or something like that. Also, update.}}
* {{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>
<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


=Stock Shaders VS LUX=
| style="width:50%"|
{{todo|Move This to their own pages or something like that.}}


== LightMappedGeneric ==
=== {{LUX}}LUX_LightMappedGeneric ===
=== Stock Shader's ===
{{Note|
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}} 2-9 Don't work.}}
[[$detail#Parameters and Effects|$detailblendmode]] 1-9 works.<br>
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{as}} 6 Doesn't work.}}
[[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned.<br>
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{csgo}} 1-6, 8 Don't work. 9 Does not work with {{ent|$bumpmap}}, {{ent|$envmap}} or {{ent|$selfillum}}}}
{{Ent|$bumpmap}} + {{Ent|$envmapmask}} works, used to be {{only|{{csgo}}.}}<br>
<br>
{{Ent|$lightwarptexture}} + {{Ent|$detail}} works<br>
{{bug|{{ent|$bumpmap}} + {{ent|$envmapmask}} Doesn't work, except in {{csgo|4}}}}
{{Ent|$basealphaenvmapmask}} + {{Ent|$bumpmap}} works.<br>
{{bug|{{ent|$lightwarptexture}} + {{ent|$detail}}{{tf2}}{{as}} Doesn't work}}
[[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br>
{{bug|{{ent|$basealphaenvmapmask}} + {{ent|bumpmap}} Doesn't work}}
{{Ent|$blendtintbybasealpha}} Exists now.<br>
<br>
{{Ent|$selfillum_envmapmask_alpha}} Exists now.<br>
{{note|[[Glowing_Textures#.24selfillum|$selfillummask]] Missing}}
{{Ent|$envmaplightscale}} Exists now.<br>
{{note|{{ent|$selfillum_envmapmask_alpha}} Missing}}
[[$detail#Parameters and Effects|$detailtexturetransform]] Exists now.}}
{{note|[[Glowing_Textures#.24selfillum|$selfillumfresnel]] Missing}}
 
{{note|{{ent|$blendtintbybasealpha}} Missing}}
{{Notice|Caveat - Has higher priority than [[Glowing_Textures#.24selfillum|$selfillum]]/[[Glowing_Textures#.24selfillum|$selfillummask]].}}
{{note|[[$detail#Parameters and Effects|$detailtexturetransform]] Missing}}
:{{Notice|Caveat - [[Glowing_Textures#.24selfillum|$selfillumtexture]] has higher priority than both.}}
{{note|{{ent|$lightwarptexture}}{{csgo}} Missing}}
{{note|{{ent|$envmapfresnelminmaxexp}}{{only|{{l4d}}+}}}}
{{note|{{ent|$envmaplightscale}}{{only|{{as}}+}}}}
{{notice|{{ent|$basealphaenvmapmask}} requires inverted masks}}


=== LUX_LightMappedGeneric ===
{{ModernImportant|{{Ent|$basealphaenvmapmask}} does not require a flipped mask.}}
* [[$detail#Parameters and Effects|$detailblendmode]] 1-9 works.
:{{workaround|There is a new parameter that can flip the envmap mask. It also works with {{Ent|$envmapmask}} and {{Ent|$normalmapalphaenvmapmask}}.}}
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned.
|}
* {{ent|$bumpmap}} + {{ent|$envmapmask}} works, used to be {{only|{{csgo}}.}}
* {{ent|$lightwarptexture}} + {{ent|$detail}} works ( does not work in {{as}}{{tf2}} ).
* {{ent|$basealphaenvmapmask}} + {{ent|$bumpmap}} works.
* [[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.
* {{ent|$blendtintbybasealpha}} Exists now.
* {{ent|$selfillum_envmapmask_alpha}} Exists now.
* [[$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.}}
:{{important|{{ent|$basealphaenvmapmask}} does no longer require a flipped mask.}}
::{{workaround|Materials that previously used have to be adjusted. Use {{ent|$envmapmask}} or {{ent|$normalmapalphaenvmapmask}} instead! }}


== VertexLitGeneric ==
== [[VertexLitGeneric]] ==
=== Stock Shader's ===
{| cellspacing="0"
|- valign="top"
| style="width:50%; padding-right:2em" |
=== Stock Shaders ===
==== Always ====
==== Always ====
{{ent|$envmaplightscale}}{{only|{{csgo}}}}.
{{Ent|$envmaplightscale}}{{only|{{csgo}}}}.
 
==== Without $Bumpmap ====
==== Without $Bumpmap ====
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 10-11 Don't work.}}
{{bug|hidetested=1|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 10-11 Don't work.<br>
{{bug|[[Glowing_Textures#.24selfillum|$selfillumfresnel]] missing.}}
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] missing.<br>
{{bug|{{ent|$lightwarptexture}} missing.}}
{{Ent|$lightwarptexture}} missing.}}
:{{note|$lightwarptexture fores bumpmapping by binding a default one, unless one is manually specified.}}
{{Note|$lightwarptexture forces bumpmapping by binding a default one, unless one is manually specified.}}
 


==== '''With''' $Bumpmap ====
==== '''With''' $Bumpmap ====
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 5-11 Don't work.}}
{{bug|hidetested=1|
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{csgo}} 5-6 & 8-11 Don't work.}}
[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 5-11 Don't work.<br>
{{note|{{ent|$envmapmask}} missing. Except {{mapbase}}.}}
[[$detail#Parameters and Effects|$detailblendmode]]{{csgo}} 5-6 & 8-11 Don't work.}}
{{note|[[Glowing_Textures#.24selfillum|$selfillummask]] missing. {{confirm|Only in {{mapbase}}?}}}}
{{Note|
{{note|{{ent|$selfillum_envmapmask_alpha}}{{mapbase}} missing.}}
{{Ent|$envmapmask}} missing. Except {{mapbase}}.<br>
{{bug|[[Glowing_Textures#.24selfillum|$selfillumfresnel]] disables {{ent|$normalmapalphaenvmapmask}}. {{todo|Also on other branches than {{as}}?}}}}
[[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 ====
==== With $Phong ====
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 8-11 Don't work.}}
{{bug|hidetested=1|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 8-11 Don't work.
{{bug|[[$phong#Masking|$invertphongmask]]{{as}}{{src13}} In the shadercode, only flips the mask used for {{ent|$envmap}}. {{confirm|Also on newer branches?}}}}
[[$phong#Masking|$invertphongmask]]{{as}}{{src13}} In the shadercode, only flips the mask used for {{Ent|$envmap}}. {{ModernConfirm|Also on newer branches?}}
{{bug|[[$phong#Colors|$phongalbedotint]] cannot be used without [[$phong#Masking|$phongexponenttexture]].}}
[[$phong#Colors|$phongalbedotint]] cannot be used without [[$phong#Masking|$phongexponenttexture]].<br>
{{bug|{{ent|$phongwarptexture}}{{l4d2}} does not work.}}
{{Ent|$phongwarptexture}}{{l4d2}} does not work.<br>
{{bug|[[$phong#Colors|$phongalbedoboost]]{{only|{{csgo}}}} + {{ent|$detail}} does not work.}}
[[$phong#Colors|$phongalbedoboost]]{{only|{{csgo}}}} + {{Ent|$detail}} does not work.<br>
{{bug|[[$phong#Colors|$phongtint]] disables [[$phong#Colors|$phongalbedotint]].}}
[[$phong#Colors|$phongtint]] disables [[$phong#Colors|$phongalbedotint]].<br>
{{bug|{{ent|$envmap}} always masked by something.}}
{{Ent|$envmap}} always masked by something.<br>
{{bug|Only in {{l4d}}+ {{ent|$envmap}} masked by {{ent|$basetexture}} luminance when {{ent|$normalmapalphaenvmapmask}} and [[$phong#Masking|$basemapluminancephongmask]] is used.}}
{{Only in {{l4d}}+ {{Ent|$envmap}} masked by {{Ent|$basetexture}} luminance when {{Ent|$normalmapalphaenvmapmask}} and [[$phong#Masking|$basemapluminancephongmask]] is used.<br>
{{bug|{{ent|$envmap}} masked by {{ent|$basetexture}} alpha when {{ent|$normalmapalphaenvmapmask}} and [[$phong#Masking|$basemapalphaphongmask]] is used.}}
{{Ent|$envmap}} masked by {{Ent|$basetexture}} alpha when {{Ent|$normalmapalphaenvmapmask}} and [[$phong#Masking|$basemapalphaphongmask]] is used.<br>
{{bug|[[$phong#Masking|$basemapalphaphongmask]] makes {{ent|$phong}} ignore the {{ent|$bumpmap}}.}}
[[$phong#Masking|$basemapalphaphongmask]] makes {{Ent|$phong}} ignore the {{Ent|$bumpmap}}.<br>
{{bug|[[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.}}
[[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>
{{bug|[[Glowing_Textures#.24selfillum|$selfillumfresnel]] will cause {{ent|$envmap}} to be masked using the {{ent|$basetexture}} alpha channel}}
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] will cause {{Ent|$envmap}} to be masked using the {{Ent|$basetexture}} alpha channel.}}}}
{{note|[[$phong#Brightness|$phongdisablehalflambert]] only in {{as}}+}}
 
{{note|[[$phong#Masking|$phongexponentfactor]] only in {{tf2}}{{src13mp}}}}
{{Note|[[$phong#Brightness|$phongdisablehalflambert]]{{as|since}}<br>
{{note|[[$phong#Masking|$basemapluminancephongmask]] only in {{l4d}}+}}
[[$phong#Masking|$phongexponentfactor]] only in {{tf2}}{{src13mp}}<br>
{{note|[[$phong#Colors|$phongalbedoboost]] only in {{csgo}}+}}
[[$phong#Masking|$basemapluminancephongmask]]{{l4d|since}}<br>
[[$phong#Colors|$phongalbedoboost]] only in {{csgo|since}}}}
 
| width="50%" |


=== LUX_VertexLitGeneric ===
=== {{LUX}}LUX_VertexLitGeneric ===
==== Without $Bumpmap ====
==== Without $Bumpmap ====
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] Exists now.<br>
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] Exists now.<br>
* {{ent|$lightwarptexture}} 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.}}
::{{todo|Make a parameter that allows its usage. Right now default behavior is replicated and a default bumpmap is bound.}}


==== '''With''' $Bumpmap ====
==== '''With''' $Bumpmap ====
* [[$detail#Parameters and Effects|$detailblendmode]] 5-9 work.<br>
* [[$detail#Parameters and Effects|$detailblendmode]] 5-9 work.<br>
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>
* {{ent|$envmapmask}} Exists now.<br>
* {{Ent|$envmapmask}} Exists now.<br>
* [[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br>
* [[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br>
* {{ent|$selfillum_envmapmask_alpha}} Exists now.<br>
* {{Ent|$selfillum_envmapmask_alpha}} Exists now.<br>
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{ent|$normalmapalphaenvmapmask}} Works now.<br>
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{Ent|$normalmapalphaenvmapmask}} Works now.<br>
 


==== With $Phong ====
==== With $Phong ====
* [[$detail#Parameters and Effects|$detailblendmode]] 8-9 work now.<br>
* [[$detail#Parameters and Effects|$detailblendmode]] 8-9 work now.<br>
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<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''.}}
 
* {{note|[[$phong#Colors|$phongalbedotint]] can now be used without [[$phong#Masking|$phongexponenttexture]].}}
{{Note|[[$phong#Masking|$invertphongmask]] Now only flips the mask used for phong. It will no longer touch the envmapmask ''at all''.<br>
::{{notice|Will use entirety of {{ent|$basetexture}}, without being masked.}}
[[$phong#Colors|$phongalbedotint]] can now be used without [[$phong#Masking|$phongexponenttexture]].}}
* [[$phong#Colors|$phongwarptexture]] works. ( does not work in {{l4d2}} ).<br>
:{{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]] Exists now. Used to be {{only|{{csgo}}.}}
* [[$phong#Colors|$phongalbedoboost]] + {{ent|$detail}} Works. Does not work in {{csgo|4}}.<br>
* [[$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!}}
{{Note|[[$phong#Colors|$phongtint]] does no longer disable [[$phong#Colors|$phongalbedotint]]. It will do <code>($baseTexture * Mask) * $PhongTint</code>}}
* {{ent|$envmap}} Can now be not-masked by using a new parameter (<code>$phongenvmapnomask</code>)
:{{Notice|When no [[$phong#Masking|$phongexponenttexture]] is specified, Mask will be 1.0f!}}
* {{important|By default the original masking for the $envmap will be replicated as to not have disparity.<br>
 
However it can now be overriden using two new parameters. <code>$phongforcebasealphaenvmapmask</code> and <code>$phongforcenormalmapalphaenvmapmask</code>}}
* {{Ent|$envmap}} Can now be not-masked by using a new parameter (<code>$phongenvmapnomask</code>)
* [[$phong#Masking|$basemapalphaphongmask]] '''no longer''' makes {{ent|$phong}} ignore the {{ent|$bumpmap}}.
: {{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>}}
::{{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#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#Brightness|$phongdisablehalflambert]] Exists now. ( Used to be {{only|{{as}}+}}
* [[$phong#Masking|$phongexponentfactor]] Exists now for {{src13sp}}. ( Used to be {{only|{{tf2}}{{src13mp}}}}
* [[$phong#Masking|$phongexponentfactor]] Exists now for {{src13sp}}. ( Used to be {{only|{{tf2}}{{src13mp}}}})
* [[$phong#Masking|$basemapluminancephongmask]] Exists now. ( Used to be {{only|{{l4d}}+}}
* [[$phong#Masking|$basemapluminancephongmask]] Exists now. ( Used to be {{since|l4d}})
* [[$phong#Colors|$phongalbedoboost]] Exists now. ( Used to be {{only|{{csgo}}+}}
* [[$phong#Colors|$phongalbedoboost]] Exists now. ( Used to be {{since|csgo}})
<br>
|}
<br>
 
<br>
== History ==
<br>
{{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
: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 {{LUX|2}} has been partially written by AI.
 
;{{mapbase|4.1}}
: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 {{LUX|2}}. You can find Mapbase's credits [https://github.com/mapbase-source/source-sdk-2013/wiki/Mapbase-Credits here].
 
;[https://github.com/Joshua-Ashton/Source-PlusPlus/ 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 ==
* {{LUX|4.1}} [https://discord.gg/cGv8GGSkpc Discord] Server
: Development can be followed here, Bug-Reports & suggestions made.
: It is also intended as a general place for discussing {{src13|4.1}} related Shader-Modding.
 
* {{LUX|4.1}} [https://github.com/ShiroDkxtro2/ACROHS-LUX_-Shaders-Project GitHub] page


{{todo|Add LUX_WorldVertexTransition and other LUX_ Shaders to this list of comparison and changes.}}
{{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.}}
:{{note| Probably better as their own pages to document all parameters.}}

Latest revision as of 07:20, 20 May 2025

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

LUX LUX is a mod specifically made and developed for use in Source 2013 Singleplayer Source 2013 Singleplayer and Source 2013 Multiplayer Source 2013 Multiplayer.
The Project is to entirely rewrite all existing "SDK_" Shaders, that come with the SDK and all those available in Mapbase Mapbase.

Goals

Overhaul/Clean 🖿materialsystem\stdshaders\ Folder
Implementing LUX LUX Shaders would entail replacing the existing 🖿stdshaders\ folder. LUX LUX Shaders should be able to do everything SDK_ Shaders in Source 2013 and Mapbase can do.
SDK_ Shaders will fall back to LUX_ Shaders, that way LUX LUX can easily be used on Mapbase Mapbase mods without much work.
Many .h, .cpp, .fxc files have been rewritten


Drastically decrease compile times for all Shaders
With LUX LUX, compiling the entirety of LUX_LightMappedGeneric takes around 30 seconds on 4 cores @4.1GHz


SM3.0 Shaders Only
Linux Linux and macOS macOS are not officially supported. Users of said systems will have to either patch togl to work with SM3.0 or use DxVK.
Note.pngNote:


More Documentation for Shaders, their parameters, how they work and any possible caveats
You might have noticed Articles like $lightwarptexture, $detail, UnlitTwoTexture and $envmapmask getting major updates with new information about caveats and bugs.
This was a direct result of LUX LUX development, although the focus was mainly on Source 2013 and Alien Swarm as their code is publicly available.


Implementing features that aren't available in Source 2013 Source 2013
See also:  Planned Features. This includes old features such as $selfillumtexture and newer features like $phongalbedoboost(only in Counter-Strike: Global Offensive).


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.


Mapbase Mapbase compatibility
Replacing SDK_ Shaders in SDK mods, SDK2013CE or Mapbase mods should be as simple as replacing the 🖿stdshaders\ 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

Icon-Important.pngImportant:LUX LUX does not use any leaked code. Features like $phongalbedoboost(only in Counter-Strike: Global Offensive) are not rocket science and easily be recreated.
Warning.pngWarning:For more complicated features, there might be visual disparity when compared to official implementations.

Mapbase Mapbase compatibility

Icon-Important.pngImportant:The parameters will be the same as Mapbase Mapbase, meaning that Mapbase's compilers can be used
Confirm:Is the Mapbase Mapbase implementation ported from Alien Swarm Alien Swarm?


New features

  • In Source 2013 Multiplayer Source 2013 Multiplayer, models utilizing Model Lightmapping can use $bumpmap. Additionally, all Model shaders will be able to utilize this feature, unless they have $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 $phong. This is not planned at the moment but should be possible for named lights/projected textures!
  • In Source 2013 Multiplayer 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 Source 2007 Source 2007 code, supposedly the Studiomdl code is there. Maybe it can be packed via Blendweights or the precision loss might be decreased.

Features ported/recreated

  • $selfillumtexture Deprecated since Source 2007 Source 2007
    • 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.
See also:  PBR Shaders in the community commonly have a $emissiontexture parameter that does EXACTLY what $selfillumtexture does in LUX LUX.

Icon-Important.pngImportant:Features are dependant on types:
  • On brushes, this will use the Lightmap
  • On models with $bumpmap, this will use Bumped lighting.
  • On models without $bumpmap, this will use Vertex Lighting.
  • In Source 2013 Multiplayer Models utilizing Model Lightmapping, this will use the Lightmap, regardless of if $bumpmap is used.

Features that won't be ported/recreated/revived

  • $basealphaenvmapmaskminmaxexp from Alien Swarm Alien Swarm - This parameter is not yet documented on the VDC, it is also unclear what exactly it does...
  • $EnvMapLightScaleMinMax from Counter-Strike: Global Offensive Counter-Strike: Global Offensive
  • $envmapsphere and related - These features have been removed since Alien Swarm Alien Swarm and is obsolete.
    • This is very easy to re-implement. The 7th face of a cubemap is still built in Source 2013 Source 2013, so this feature is still operational.

Not functional for now

Stock Shaders VS LUX

Todo: Move This to their own pages or something like that. Also, update.


LightmappedGeneric

Stock Shaders

Icon-Bug.pngBug:

$detailblendmode (Source 2013Team Fortress 2) 2-9 Don't work.
$detailblendmode (Alien Swarm) 6 Doesn't work.
$detailblendmode (Counter-Strike: Global Offensive) 8 doesn't work. 9 doesn't work with $bumpmap, $envmap or $selfillum
$bumpmap + $envmapmask Doesn't work, except in Counter-Strike: Global Offensive
$lightwarptexture + $detail (Team Fortress 2Alien Swarm) Doesn't work.

$basealphaenvmapmask + bumpmap Doesn't work

$selfillummask (not in Source 2013)
$selfillum_envmapmask_alpha (not in Source 2013)
$selfillumfresnel (not in Source 2013)
$blendtintbybasealpha (not in Source 2013)
$detailtexturetransform (not in Source 2013)
$lightwarptexture(not in Counter-Strike: Global Offensive)
$envmapfresnelminmaxexp(in all games since Left 4 Dead)
$envmaplightscale(in all games since Alien Swarm)
$basealphaenvmapmask requires inverted masks

LUXLUX_LightMappedGeneric

Note.pngNote:

$detailblendmode 1-9 works.
$detailblendmode 10-11 planned.
$bumpmap + $envmapmask works, used to be (only in Counter-Strike: Global Offensive.)
$lightwarptexture + $detail works
$basealphaenvmapmask + $bumpmap works.
$selfillummask Exists now.
$blendtintbybasealpha Exists now.
$selfillum_envmapmask_alpha Exists now.
$envmaplightscale Exists now.

$detailtexturetransform Exists now.
Note.pngNote:Caveat - Has higher priority than $selfillum/$selfillummask.
Note.pngNote:Caveat - $selfillumtexture has higher priority than both.
Icon-Important.pngImportant:$basealphaenvmapmask does not require a flipped mask.
PlacementTip.pngWorkaround:There is a new parameter that can flip the envmap mask. It also works with $envmapmask and $normalmapalphaenvmapmask.

VertexLitGeneric

Stock Shaders

Always

$envmaplightscale(only in Counter-Strike: Global Offensive).

Without $Bumpmap

Icon-Bug.pngBug:$detailblendmodeSource 2013Team Fortress 2Alien SwarmCounter-Strike: Global Offensive 10-11 Don't work.

$selfillumfresnel missing.

$lightwarptexture missing.
Note.pngNote:$lightwarptexture forces bumpmapping by binding a default one, unless one is manually specified.


With $Bumpmap

Icon-Bug.pngBug:

$detailblendmodeSource 2013Team Fortress 2Alien SwarmCounter-Strike: Global Offensive 5-11 Don't work.

$detailblendmodeCounter-Strike: Global Offensive 5-6 & 8-11 Don't work.
Note.pngNote:

$envmapmask missing. Except Mapbase.

$selfillummask missing.
Confirm:Only in Mapbase?

$selfillum_envmapmask_alphaMapbase missing.

$selfillumfresnel disables $normalmapalphaenvmapmask.
Todo: Also on other branches than Alien Swarm?


With $Phong

Icon-Bug.pngBug:$detailblendmodeSource 2013Team Fortress 2Alien SwarmCounter-Strike: Global Offensive 8-11 Don't work. $invertphongmaskAlien SwarmSource 2013 In the shadercode, only flips the mask used for $envmap.
Confirm:Also on newer branches?

$phongalbedotint cannot be used without $phongexponenttexture.
$phongwarptextureLeft 4 Dead 2 does not work.
$phongalbedoboost(only in Counter-Strike: Global Offensive) + $detail does not work.
$phongtint disables $phongalbedotint.
$envmap always masked by something.
{{Only in Left 4 Dead+ $envmap masked by $basetexture luminance when $normalmapalphaenvmapmask and $basemapluminancephongmask is used.
$envmap masked by $basetexture alpha when $normalmapalphaenvmapmask and $basemapalphaphongmask is used.
$basemapalphaphongmask makes $phong ignore the $bumpmap.
$selfillumfresnel + $normalmapalphaenvmapmask will cause the $envmap to be multiplied by 0.0f regardless of whether $invertphongmask is used.

$selfillumfresnel will cause $envmap to be masked using the $basetexture alpha channel.}}
Note.pngNote:$phongdisablehalflambert(in all games since Alien Swarm)

$phongexponentfactor only in Team Fortress 2Source 2013 Multiplayer
$basemapluminancephongmask(in all games since Left 4 Dead)

$phongalbedoboost only in (in all games since Counter-Strike: Global Offensive)

LUXLUX_VertexLitGeneric

Without $Bumpmap

Todo: Make a parameter that allows its usage. Right now default behavior is replicated and a default bumpmap is bound.


With $Bumpmap


With $Phong

Note.pngNote:$invertphongmask Now only flips the mask used for phong. It will no longer touch the envmapmask at all.
$phongalbedotint can now be used without $phongexponenttexture.
Note.pngNote:Will use entirety of $basetexture, without being masked.
Note.pngNote:$phongtint does no longer disable $phongalbedotint. It will do ($baseTexture * Mask) * $PhongTint
Note.pngNote:When no $phongexponenttexture is specified, Mask will be 1.0f!
  • $envmap Can now be not-masked by using a new parameter ($phongenvmapnomask)
Icon-Important.pngImportant: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. $phongforcebasealphaenvmapmask and $phongforcenormalmapalphaenvmapmask
Note.pngNote:This will make materials that previously used this intentionally, look different.

History

LUX LUX 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.
LUX LUX 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 LUX LUX has been partially written by AI.
Mapbase Mapbase
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 LUX LUX. 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

Development can be followed here, Bug-Reports & suggestions made.
It is also intended as a general place for discussing Source 2013 Source 2013 related Shader-Modding.
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.