LUX: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (ModernNote everywhere)
Line 18: Line 18:
==Goals==
==Goals==
* '''Overhauled/Cleaned <code>materialsystem\stdshaders\</code> Folder'''
* '''Overhauled/Cleaned <code>materialsystem\stdshaders\</code> Folder'''
:{{warning|Pretty much everything except existing shader-compile functionality is pretty much "nuked".}}
:{{ModernWarning|Pretty much everything except existing shader-compile functionality is pretty much "nuked".}}
:{{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.}}
:{{ModernNote|SDK_ Shaders will fall back to LUX_ Shaders, that way LUX_ can easily be used on {{mapbase|4}} mods without much work.}}
::{{note|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'''
* '''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.}}
:{{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 }}
:{{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'''
* '''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.}}
:{{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'''}}
:{{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. }}
:{{note|This means that older hardware not capable of SM3.0 will not be able to use the new Shaders.}}
:{{ModernNote|
:{{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. }}
:* 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'''
* '''Totally rewritten .h, .cpp, .fxc files'''
<br>
* '''More Documentation for Shaders, their parameters, how they work and any possible caveats'''
* '''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]],
:{{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. }}
: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.}}
:{{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}}'''
* '''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}}.}}
:{{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'''
* '''Fixing most Parameter "bugs:" and other caveats'''
:{{Seealso| <code>Stock Shaders VS LUX</code>}}
:{{Seealso|<code>Stock Shaders VS LUX</code>}}
<br>
* '''Easy way of disabling features'''
* '''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.}}
:{{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!}}
:{{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'''
* '''Mapbase compatibility'''
:{{notice| Replacing SDK_ Shaders in SDK mods, SDK2013CE or Mapbase mods should be as simple as replacing the <code>stdshaders\</code> Folder.}}
:{{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.}}
:{{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==
==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}}
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}}
{{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.}}
{{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.}}
{{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.}}
:{{ModernWarning|For features that are more complicated, there might be visual disparity when compared to official implementations.}}
 
<br>
==== Features required for {{mapbase|4}} compatibility ====
==== Features required for {{mapbase|2}} compatibility ====
* [[$phong#Brightness|$phongdisablehalflambert]] from {{as}}+
* [[$phong#Brightness|$phongdisablehalflambert]] from {{as}}+
* Radial Fog for all "Geometry" Shaders
* Radial Fog for all "Geometry" Shaders
* Spline-Ropes
* Spline-Ropes
* Parallax Corrected Cubemaps ( PCC )
* Parallax Corrected Cubemaps ( PCC )
:{{note|Just like {{mapbase|4}}, this requires custom compilers to work.}}
:{{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.}}
:{{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}}
Line 64: Line 73:
* Brush {{ent|$phong}}
* Brush {{ent|$phong}}
* Treesway
* Treesway
:{{todo|Is the {{mapbase}} implementation ported from {{as}}?}}
:{{ModernTodo|Is the {{mapbase}} implementation ported from {{as}}?}}
 
<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}} 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.}}
:{{important|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!}}  
:{{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.
* 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! }}
:{{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! }}
::{{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.}}
::{{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 ====
==== Features ported/recreated/revived ====
* [[$phong#Brightness|$phongdisablehalflambert]] From {{as}}+ - Also needed for {{mapbase}}
* [[$phong#Brightness|$phongdisablehalflambert]] From {{as}}+ - Also needed for {{mapbase}}
Line 79: Line 88:
* [[$phong#Colors|$phongalbedoboost]] From {{csgo}} - Its just <code>BaseTexture * $PhongAlbedoBoost</code>... No leaked code!
* [[$phong#Colors|$phongalbedoboost]] From {{csgo}} - Its just <code>BaseTexture * $PhongAlbedoBoost</code>... No leaked code!
* [[$phong#Masking|$basemapluminancephongmask]] From {{as}}+
* [[$phong#Masking|$basemapluminancephongmask]] From {{as}}+
:{{note|LUX allows the use of Rec. 709 HDTV Luminance Weights. <code>float3(0.2126f, 0.7152f, 0.0722f)</code>.<br>
:{{ModernNote|
Previously SDK_ Shaders would use the NTSC Analog Television standard of <code>float3(0.2990f, 0.5870f, 0.1140f)</code> }}
:* 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
* [[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.}}
:{{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.}}
:{{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}}
* Water Shader with {{ent|$flowmap}} Support - From {{as}}
* {{ent|$envmaplightscale}} From {{as}} for brushes{{as}}+ AND models {{only|{{csgo}}}}+
* {{ent|$envmaplightscale}} From {{as}} for brushes{{as}}+ AND models {{only|{{csgo}}}}+
:{{important}}
:{{important|
:: * On brushes this will use the Lightmap
:* On brushes this will use the Lightmap
:: * On models '''with''' {{ent|$bumpmap}}, this will use bumped lighting.
:* On models '''with''' {{ent|$bumpmap}}, this will use bumped lighting.
:: * On models without {{ent|$bumpmap}}, this will use Vertex 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.
:* 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 ====
==== Features that are being discarded ====
* {{ent|$envmapsphere}} and related - These features have been removed since {{as}} and are obsolete.
* {{ent|$envmapsphere}} and related - These features have been removed since {{as}} and are obsolete.
:{{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!}}
:{{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
* [[$bumpmap#Additional_Parameters|$bumpmask]] and related
 
<br>
==== Features that '''won't''' be ported/recreated/revived ====
==== 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...
* $basealphaenvmapmaskminmaxexp from {{as}} - This parameter is not yet documented on the VDC, it is also unclear what exactly it does...
* $EnvMapLightScaleMinMax from {{csgo}}
* $EnvMapLightScaleMinMax from {{csgo}}
 
<br>
==== Not functional - FOR NOW ====
==== Not functional - FOR NOW ====
* {{ent|$emissiveblend}} - Non-Existant. Planned for later.
* {{ent|$emissiveblend}} - Non-Existant. Planned for later.
Line 107: Line 117:
* [[$detail#Parameters and Effects|$detailblendmode]] <code>10 & 11</code>.  - Non-Functional. Planned for later.
* [[$detail#Parameters and Effects|$detailblendmode]] <code>10 & 11</code>.  - Non-Functional. Planned for later.
<br>
<br>


=Stock Shaders VS LUX=
=Stock Shaders VS LUX=
{{todo|Move This to their own pages or something like that.}}
{{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|
[[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}}+}}}}


== LightMappedGeneric ==
{{Notice|{{ent|$basealphaenvmapmask}} requires inverted masks}}
=== Stock Shader's ===
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}} 2-9 Don't work.}}
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{as}} 6 Doesn't work.}}
{{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}}}}
<br>
<br>
{{bug|{{ent|$bumpmap}} + {{ent|$envmapmask}} Doesn't work, except in {{csgo|4}}}}
=== LUX_LightMappedGeneric ===
{{bug|{{ent|$lightwarptexture}} + {{ent|$detail}}{{tf2}}{{as}} Doesn't work}}
{{ModernNote|
{{bug|{{ent|$basealphaenvmapmask}} + {{ent|bumpmap}} Doesn't work}}
[[$detail#Parameters and Effects|$detailblendmode]] 1-9 works.<br>
<br>
[[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned.<br>
{{note|[[Glowing_Textures#.24selfillum|$selfillummask]] Missing}}
{{ent|$bumpmap}} + {{ent|$envmapmask}} works, used to be {{only|{{csgo}}.}}<br>
{{note|{{ent|$selfillum_envmapmask_alpha}} Missing}}
{{ent|$lightwarptexture}} + {{ent|$detail}} works ( does not work in {{as}}{{tf2}} ).<br>
{{note|[[Glowing_Textures#.24selfillum|$selfillumfresnel]] Missing}}
{{ent|$basealphaenvmapmask}} + {{ent|$bumpmap}} works.<br>
{{note|{{ent|$blendtintbybasealpha}} Missing}}
[[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br>
{{note|[[$detail#Parameters and Effects|$detailtexturetransform]] Missing}}
{{ent|$blendtintbybasealpha}} Exists now.<br>
{{note|{{ent|$lightwarptexture}}{{csgo}} Missing}}
{{ent|$selfillum_envmapmask_alpha}} Exists now.<br>
{{note|{{ent|$envmapfresnelminmaxexp}}{{only|{{l4d}}+}}}}
[[$detail#Parameters and Effects|$detailtexturetransform]] Exists now.}}
{{note|{{ent|$envmaplightscale}}{{only|{{as}}+}}}}
{{notice|{{ent|$basealphaenvmapmask}} requires inverted masks}}


=== LUX_LightMappedGeneric ===
{{Notice|Caveat - Has higher priority than [[Glowing_Textures#.24selfillum|$selfillum]]/[[Glowing_Textures#.24selfillum|$selfillummask]].}}
* [[$detail#Parameters and Effects|$detailblendmode]] 1-9 works.
:{{Notice|Caveat - [[Glowing_Textures#.24selfillum|$selfillumtexture]] has higher priority than both.}}
* [[$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! }}


{{important|{{ent|$basealphaenvmapmask}} does no longer require a flipped mask.}}
:{{ModernWorkaround|Materials that previously used have to be adjusted. Use {{ent|$envmapmask}} or {{ent|$normalmapalphaenvmapmask}} instead!}}
<br>
== VertexLitGeneric ==
== VertexLitGeneric ==
=== Stock Shader's ===
=== Stock Shaders ===
==== Always ====
==== Always ====
{{ent|$envmaplightscale}}{{only|{{csgo}}}}.
{{ent|$envmaplightscale}}{{only|{{csgo}}}}.
<br>
==== Without $Bumpmap ====
==== Without $Bumpmap ====
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 10-11 Don't work.}}
{{ModernBug|[[$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.}}
{{ModernNote|$lightwarptexture fores bumpmapping by binding a default one, unless one is manually specified.}}
 
<br>
==== '''With''' $Bumpmap ====
==== '''With''' $Bumpmap ====
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 5-11 Don't work.}}
{{ModernBug|
{{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}}?}}}}
{{ModernNote|
{{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}}. {{ModernTodo|Also on other branches than {{as}}?}}}}
<br>
==== With $Phong ====
==== With $Phong ====
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 8-11 Don't work.}}
{{ModernBug|[[$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#Masking|$basemapluminancephongmask]] only in {{l4d}}+}}
{{note|[[$phong#Colors|$phongalbedoboost]] only in {{csgo}}+}}


{{ModernNote|[[$phong#Brightness|$phongdisablehalflambert]] only in {{as}}+<br>
[[$phong#Masking|$phongexponentfactor]] only in {{tf2}}{{src13mp}}<br>
[[$phong#Masking|$basemapluminancephongmask]] only in {{l4d}}+<br>
[[$phong#Colors|$phongalbedoboost]] only in {{csgo}}+}}
<br>
=== LUX_VertexLitGeneric ===
=== LUX_VertexLitGeneric ===
==== Without $Bumpmap ====
==== Without $Bumpmap ====
Line 188: Line 206:
* [[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.}}
::{{ModernTodo|Make a parameter that allows its usage. Right now default behavior is replicated and a default bumpmap is bound.}}
 
<br>
==== '''With''' $Bumpmap ====
==== '''With''' $Bumpmap ====
* [[$detail#Parameters and Effects|$detailblendmode]] 5-9 work.<br>
* [[$detail#Parameters and Effects|$detailblendmode]] 5-9 work.<br>
Line 197: Line 215:
* {{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>
 
<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]].}}
{{ModernNote|[[$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]].}}
:{{Notice|Will use entirety of {{ent|$basetexture}}, without being masked.}}
 
* [[$phong#Colors|$phongwarptexture]] works. ( does not work in {{l4d2}} ).<br>
* [[$phong#Colors|$phongwarptexture]] works. ( does not work in {{l4d2}} ).<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}}.<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!}}
{{ModernNote|[[$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>)
* {{ent|$envmap}} Can now be not-masked by using a new parameter (<code>$phongenvmapnomask</code>)
* {{important|By default the original masking for the $envmap will be replicated as to not have disparity.<br>
: {{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>}}
However it can now be overriden using two new parameters. <code>$phongforcebasealphaenvmapmask</code> and <code>$phongforcenormalmapalphaenvmapmask</code>}}
 
* [[$phong#Masking|$basemapalphaphongmask]] '''no longer''' makes {{ent|$phong}} ignore the {{ent|$bumpmap}}.
* [[$phong#Masking|$basemapalphaphongmask]] '''no longer''' makes {{ent|$phong}} ignore the {{ent|$bumpmap}}.
::{{notice|This will make materials that previously used this intentionally, look different.}}
:{{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>
* [[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}}+}}

Revision as of 10:15, 19 February 2023

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

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

  • Overhauled/Cleaned materialsystem\stdshaders\ Folder
Template:ModernWarning
Template:ModernNote
Note.pngNote: Implementing LUX Shaders would entail replacing the existing stdshaders\ with the one from LUX. Effectively 'nuking' SDK_ Shaders. LUX Shaders should be able to do everything SDK_ Shaders in Source 2013 and Mapbase can do.


  • Drastically decreased compile-times for all Shaders
Why?: Valves Shaders take forever to compile Source 2013 SingleplayerSource 2013 MultiplayerAlien Swarm. Especially using the stock Shader-Compiler. This disincentives modding the Shaders.
Note.pngNote: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.pngNote:Linux is not officially supported. MacOS is also not officially supported. Users of said system will have to either patche togl to work with SM3.0 or use DxVK.
Template:ModernNote


  • Totally rewritten .h, .cpp, .fxc files


  • More Documentation for Shaders, their parameters, how they work and any possible caveats
Note.pngNote:You might have noticed Articles like $lightwarptexture, $detail, UnlitTwoTexture and $envmapmask getting major updates from ShiroDkxtro2,
where new information about Caveats and bugs were added for Team Fortress 2Alien SwarmSource 2013Counter-Strike: Global Offensive. This was a direct result of LUX development, although the focus was mainly on Source 2013Alien Swarm as their code is publicly available.
Template:ModernNote


  • Implementing features that aren't available in 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
See also:  Stock Shaders VS LUX


  • Easy way of disabling features
Icon-Important.pngImportant:A custom Pre-Processor program has been made. It automatically sets // STATIC:'s to predefined values depending on #define's in an included header file.
Template:ModernNote


  • Mapbase compatibility
Note.pngNote:Replacing SDK_ Shaders in SDK mods, SDK2013CE or Mapbase mods should be as simple as replacing the stdshaders\ Folder.
Template:ModernNote


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 Alien SwarmLeft 4 Dead 2Counter-Strike: Global Offensive Template:ModernNote

Icon-Important.pngImportant:LUX does not use any leaked code. Features like $phongalbedoboost(only in csgo) are not rocket-science. They can safely be recreated without the use of leaked code.
Template:ModernWarning


Features required for Mapbase Mapbase compatibility

Template:ModernNote
Icon-Important.pngImportant:The parameters are the same for LUX and Mapbase. This means that Mapbase compilers can be used for this to work.
Template:ModernTodo


New Features

  • In Source 2013 Multiplayer Models utilizing Model Lightmapping can use $bumpmap. Additionally all Model shaders will be able to utilize this feature. Except they have $phong.
Icon-Important.pngImportant:The Lightmap does not do bumped-lighting using the bumpmap. Only named-lights/projected textures will be able to do so.
Template:ModernNote
  • In Source 2013 Multiplayer Models can utilize Lightmap UV's.
Template:ModernWarning
Template:ModernTodo


Features ported/recreated/revived

Template:ModernNote
Template:ModernNote
See also:  PBR Shaders in the community commonly have a $emissiontexture parameter that does EXACTLY what $selfillumtexture does in LUX.

Icon-Important.pngImportant:
  • 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, will use the Lightmap. Regardless of whether or not $bumpmap is used.


Features that are being discarded

  • $envmapsphere and related - These features have been removed since Alien Swarm and are obsolete.
Template:ModernNote


Features that won't be ported/recreated/revived

  • $basealphaenvmapmaskminmaxexp from 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


Not functional - FOR NOW


Stock Shaders VS LUX

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


LightMappedGeneric

Stock Shaders

Template:ModernBug

Template:ModernNote

Note.pngNote:$basealphaenvmapmask requires inverted masks


LUX_LightMappedGeneric

Template:ModernNote

Note.pngNote:Caveat - Has higher priority than $selfillum/$selfillummask.
Note.pngNote:Caveat - $selfillumtexture has higher priority than both.
Icon-Important.pngImportant:$basealphaenvmapmask does no longer require a flipped mask.
Template:ModernWorkaround


VertexLitGeneric

Stock Shaders

Always

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

Without $Bumpmap

Template:ModernBug Template:ModernNote

With $Bumpmap

Template:ModernBug Template:ModernNote

With $Phong

Template:ModernBug

Template:ModernNote

LUX_VertexLitGeneric

Without $Bumpmap

Template:ModernTodo


With $Bumpmap


With $Phong

Template:ModernNote

Note.pngNote:Will use entirety of $basetexture, without being masked.

Template:ModernNote

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 as to not have disparity. However it can now be overriden using two new parameters. $phongforcebasealphaenvmapmask and $phongforcenormalmapalphaenvmapmask
Note.pngNote:This will make materials that previously used this intentionally, look different.





Todo: Add LUX_WorldVertexTransition and other LUX_ Shaders to this list of comparison and changes.
Note.pngNote: Probably better as their own pages to document all parameters.