LUX: Difference between revisions
Thunder4ik (talk | contribs) m (clean up, replaced: {{ModernBug → {{bug (4)) |
m (cleanup, needs more work) |
||
Line 10: | Line 10: | ||
<br> | <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}} | : {{Why|Valves Shaders take '''forever''' to compile {{src13sp}}/{{src13mp}}/{{as}}, especially using the stock Shader-Compiler. This disincentives modding Shaders.}} | ||
: {{Notice|Even on a good CPU it can take half a day, '''or more | : {{Notice|Even on a good CPU it can take half a day, '''or more''. As an example for {{LUX|2}}. Compiling the entirety of LUX_LightMappedGeneric takes around 30 seconds on 4 cores @4.1GHz }} | ||
<br> | <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.}} | ||
: {{Notice|Linux is not officially supported. MacOS is also not officially supported. Users of said | : {{Notice|Linux is not officially supported. MacOS is also not officially supported. Users of said systems will have to either patch <code>togl</code> to work with SM3.0 or use DxVK. }} | ||
: {{Note| | : {{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''' | :* 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''' | ||
Line 25: | Line 25: | ||
: {{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|2}} 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|2}} development, although the focus was mainly on {{src13}}{{as}} as their code is publicly available. }} | ||
: {{Note|The current lack of documentation | : {{Note|The current lack of documentation on how Shaders work in Source, disincentives learning how to mod Shaders or make their own. The barrier of entry is very high as a lot of very specific knowledge is required too.}} | ||
<br> | <br> | ||
* '''Implementing features that aren't available in {{src13}}''' | * '''Implementing features that aren't available in {{src13}}''' | ||
Line 35: | Line 35: | ||
* '''Easy way of disabling features''' | * '''Easy way of disabling features''' | ||
: {{ModernImportant|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.}} | : {{ModernImportant|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 | : {{Note|Mods that don't require specific features (lightwarptexture/distancealpha/phong/envmaps/etc), can easily disable them and further increase Shader compilation speed. Most parameters have been <code>#ifdef</code>'d in the c++ code!}} | ||
<br> | <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 | : {{Note|It is assumed that no custom Shaders apart from SDK_ ones were added. If they were added, developers should be capable of adding them back/recreating them.}} | ||
<br> | <br> | ||
== Planned Features == | == Planned Features == | ||
This is a list of new features that are being implemented | 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.}} | {{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.}} | ||
{{ModernImportant|{{LUX|2}} 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.}} | {{ModernImportant|{{LUX|2}} 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 | : {{warning|For more complicated features, there might be visual disparity when compared to official implementations.}} | ||
<br> | <br> | ||
==== Features required for {{mapbase|2}} compatibility ==== | ==== Features required for {{mapbase|2}} compatibility ==== | ||
Line 64: | Line 64: | ||
<br> | <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}}. | ||
: {{ModernImportant|The Lightmap does not do bumped-lighting using the bumpmap. Only named | : {{ModernImportant|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!}} | : {{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!}} | ||
* 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 | : {{warning|The way this is currently implemented requires a custom written tool, two SMDs ( one with lightmap uv ), and also has a lot of precision loss for the Lightmap UVs. 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.}} | ::{{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.}} | ||
<br> | <br> | ||
==== Features ported/recreated/revived ==== | ==== Features ported/recreated/revived ==== | ||
Line 92: | Line 92: | ||
==== 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 | :{{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!}} | ||
<br> | <br> | ||
==== Features that '''won't''' be ported/recreated/revived ==== | ==== Features that '''won't''' be ported/recreated/revived ==== | ||
Line 163: | Line 163: | ||
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] missing.<br> | [[Glowing_Textures#.24selfillum|$selfillumfresnel]] missing.<br> | ||
{{Ent|$lightwarptexture}} missing.}} | {{Ent|$lightwarptexture}} missing.}} | ||
{{Note|$lightwarptexture | {{Note|$lightwarptexture forces bumpmapping by binding a default one, unless one is manually specified.}} | ||
Line 231: | Line 231: | ||
* {{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>) | ||
: {{ModernImportant|By default the original masking for the $envmap will be replicated | : {{ModernImportant|By default the original masking for the $envmap will be replicated to not have disparity. 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}}. | ||
Line 244: | Line 244: | ||
== History == | == History == | ||
{{LUX|2}} 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> | {{LUX|2}} 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 | 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> | 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> | 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> | ||
Line 261: | Line 261: | ||
* Mr.Kleiner | * Mr.Kleiner | ||
For writing various tools. Including a VTF Flagging tool for Cubemaps inside a .bsp file, a tool for packing lightmap | 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 | * roman_memes | ||
Line 272: | Line 272: | ||
For enlightening us about the Constant Register Hack.<br> | For enlightening us about the Constant Register Hack.<br> | ||
Which allows for the use of more than 32 float constant registers on sm3.0<br> | Which allows for the use of more than 32 float constant registers on sm3.0<br> | ||
This Project would be | This Project would be nearly impossible without it. | ||
* ChatGPT | * ChatGPT | ||
Line 280: | Line 280: | ||
* {{mapbase|2}} | * {{mapbase|2}} | ||
Since one of the goals of this project is to be compatible with it, various code from it has been adapted. | 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 | 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 with {{LUX|2}}. | * [https://github.com/Joshua-Ashton/Source-PlusPlus/ Source++] code might be included with {{LUX|2}}. | ||
Line 289: | Line 289: | ||
== See also == | == See also == | ||
* {{LUX|2}} [https://discord.gg/cGv8GGSkpc Discord] Server | * {{LUX|2}} [https://discord.gg/cGv8GGSkpc Discord] Server | ||
:Development can be followed here, Bug-Reports & suggestions made. | : Development can be followed here, Bug-Reports & suggestions made. | ||
:It is also intended as a general place for discussing {{src13|2}} related Shader-Modding. | : It is also intended as a general place for discussing {{src13|2}} related Shader-Modding. | ||
* {{LUX|2}} [https://github.com/ShiroDkxtro2/ACROHS-LUX_-Shaders-Project GitHub] page | * {{LUX|2}} [https://github.com/ShiroDkxtro2/ACROHS-LUX_-Shaders-Project GitHub] page | ||
{{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.}} | {{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.}} |
Revision as of 13:04, 5 February 2024
LUX is a mod specifically made and developed for use in
Source 2013 Singleplayer and
Source 2013 Multiplayer.
The Project is to entirely rewrite all existing "SDK_" Shaders, that come with the SDK and all those available in Mapbase.
Goals
- Overhauled/Cleaned
materialsystem\stdshaders\
Folder
Warning:Pretty much everything except existing shader-compile functionality is pretty much "nuked".
- Drastically decreased compile-times for all Shaders
Note: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:Linux is not officially supported. MacOS is also not officially supported. Users of said systems will have to either patch
togl
to work with SM3.0 or use DxVK.Note:
- 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.
- Totally rewritten .h, .cpp, .fxc files
- More Documentation for Shaders, their parameters, how they work and any possible caveats
Note: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
. This was a direct result of
LUX development, although the focus was mainly on
as their code is publicly available.
Note:The current lack of documentation on how Shaders work in Source, disincentives learning how to mod Shaders or make their own. The barrier of entry is very high as a lot of very specific knowledge is required too.
- See also: Planned Features. This includes old features such as $selfillumtexture and newer features like $phongalbedoboost(only in
).
- Fixing most Parameter "bugs:" and other caveats
- See also: Stock Shaders VS LUX
- Easy way of disabling features
Important: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.Note:Mods that don't require specific features (lightwarptexture/distancealpha/phong/envmaps/etc), can easily disable them and further increase Shader compilation speed. Most parameters have been
#ifdef
'd in the c++ code!
- Mapbase compatibility
Note:Replacing SDK_ Shaders in SDK mods, SDK2013CE or Mapbase mods should be as simple as replacing the
stdshaders\
Folder.Note:It is assumed that no custom Shaders apart from SDK_ ones were added. If they were added, developers should be capable of adding them back/recreating them.
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





Warning:For more complicated features, there might be visual disparity when compared to official implementations.
Features required for
Mapbase compatibility
- $phongdisablehalflambert from
+
- Radial Fog for all "Geometry" Shaders
- Spline-Ropes
- Parallax Corrected Cubemaps ( PCC )
Note:Just like
Mapbase, this requires custom compilers to work.
Important:The parameters are the same for
LUX and
. This means that Mapbase compilers can be used for this to work.
- $envmapmask + $bumpmap on VertexLitGeneric
- Replacement for the "Postprocessing" Controller Shader
- Replacement for the "Engine_post" Shader from
- Hammer $blendmodulatetexture previewing fix.
- Brush $phong
- Treesway
- $bumpmask and related
New Features
- In
Models utilizing Model Lightmapping can use $bumpmap. Additionally, all Model shaders will be able to utilize this feature. Except they have $phong.
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 $phong. This is not planned at the moment but should be possible for named-lights/projected textures!
Warning:The way this is currently implemented requires a custom written tool, two SMDs ( one with lightmap uv ), and also has a lot of precision loss for the Lightmap UVs. Additionally, this requires a custom compiler!
Features ported/recreated/revived
- $phongdisablehalflambert From
+ - Also needed for
- $phongexponentfactor From
, with
LUX also on
- $phongalbedoboost From
- Its just
BaseTexture * $PhongAlbedoBoost
... No leaked code! - $basemapluminancephongmask From
+
Note:
LUX allows the use of Rec. 709 HDTV Luminance Weights.
float3(0.2126f, 0.7152f, 0.0722f)
.- Previously SDK_ Shaders would use the NTSC Analog Television standard of
float3(0.2990f, 0.5870f, 0.1140f)
- $selfillumtexture Deprecated since
- This used to be obsolete
Note: 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.
- Water Shader with $flowmap Support - From
- $envmaplightscale From
for brushes
+ AND models (only in
)+
Features that are being discarded
- $envmapsphere and related - These features have been removed since
and are obsolete.
Note:This is very easy to re-implement. The 7th face of a cubemap is still being built in
and therefore this feature is still operational given that the code has been implemented!
Features that won't be ported/recreated/revived
- $basealphaenvmapmaskminmaxexp from
- This parameter is not yet documented on the VDC, it is also unclear what exactly it does...
- $EnvMapLightScaleMinMax from
Not functional - FOR NOW
- $distancealpha - Non-Functional. Planned for later.
Stock Shaders VS LUX
LightmappedGeneric
Stock Shaders![]() $detailblendmode ![]() $selfillummask Missing ![]() ![]() |
|
VertexLitGeneric
Stock ShadersAlways$envmaplightscale(only in Without $Bumpmap![]() ![]() ![]() ![]() ![]() $selfillumfresnel missing. ![]()
With $Bumpmap![]() $detailblendmode ![]() ![]() $envmapmask missing. Except $selfillum_envmapmask_alpha
With $Phong![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() $phongalbedotint cannot be used without $phongexponenttexture. ![]() ![]() $phongexponentfactor only in ![]() |
|
History
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
However, it is only used to compile the Shaders. Include files ( .inc ) are intended to be made using Perl.
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.
For enlightening us about the Constant Register Hack.
Which allows 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 undocumented graphical features of the Source Engine.
It knows things and can make new things to a degree. Various code used in LUX has been partially written by the AI.
Since one of the goals of this project is to be compatible with it, various code from it has been adapted.
This means that all Shader-related things should also be inherited with the credits of LUX. You can find Mapbase's credits HERE.
One example would be the NvidiaPCF5x5Gaussian Shadow Filter


ShiroDkxtro2 would also like to thank Joshua Ashton personally 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 related Shader-Modding.