LUX: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
{{ | {{Language subpage}} | ||
}} | |||
{{LUX|4}} is a [[Modification|mod]] specifically made and developed for use in {{src13sp|4}} and {{src13mp|4}}.<br> | {{LUX|4}} is a [[Modification|mod]] specifically made and developed for use in {{src13sp|4}} and {{src13mp|4}}.<br> | ||
The Project is to entirely rewrite all existing "'''SDK_'''" Shaders, that come with the SDK and all those available in {{mapbase|2}}. | The Project is to entirely rewrite all existing "'''SDK_'''" Shaders, that come with the SDK and all those available in {{mapbase|2}}. | ||
==Goals== | == Goals == | ||
* '''Overhauled/Cleaned <code>materialsystem\stdshaders\</code> Folder''' | * '''Overhauled/Cleaned <code>materialsystem\stdshaders\</code> Folder''' | ||
:{{ModernWarning|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".}} | ||
:{{ModernNote|SDK_ Shaders will fall back to LUX_ Shaders, that way {{LUX|2}} can easily be used on {{mapbase|4}} mods without much work.}} | : {{ModernNote|SDK_ Shaders will fall back to LUX_ Shaders, that way {{LUX|2}} can easily be used on {{mapbase|4}} mods without much work.}} | ||
:{{Notice| Implementing {{LUX|2}} Shaders would entail replacing the existing <code>stdshaders\</code> with the one from {{LUX|2}}. Effectively 'nuking' SDK_ Shaders. {{LUX|2}} Shaders should be able to do everything SDK_ Shaders in {{src13}} and {{mapbase}} can do.}} | : {{Notice| Implementing {{LUX|2}} Shaders would entail replacing the existing <code>stdshaders\</code> with the one from {{LUX|2}}. Effectively 'nuking' SDK_ Shaders. {{LUX|2}} Shaders should be able to do everything SDK_ Shaders in {{src13}} and {{mapbase}} can do.}} | ||
<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}}. 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|2}}. 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|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.}} | ||
:{{Notice|Linux is not officially supported. MacOS is also not officially supported. Users of said system will have to either patch <code>togl</code> to work with SM3.0 or use DxVK. }} | : {{Notice|Linux is not officially supported. MacOS is also not officially supported. Users of said system will have to either patch <code>togl</code> to work with SM3.0 or use DxVK. }} | ||
:{{ModernNote| | : {{ModernNote| | ||
:* SM3.0 released in 2004, and [https://cdn.cloudflare.steamstatic.com/apps/valve/2010/siggraph2010_vlachos_waterflow.pdf Valve considered ps2.0b low end hardware in ~2008]. See slide '''8''' | :* 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.}} | :* This means that older hardware not capable of SM3.0 will not be able to use the new Shaders.}} | ||
Line 36: | Line 24: | ||
<br> | <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 {{ | : {{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. }} | ||
:{{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.}} | : {{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> | <br> | ||
* '''Implementing features that aren't available in {{src13}}''' | * '''Implementing features that aren't available in {{src13}}''' | ||
:{{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}}.}} | : {{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> | <br> | ||
* '''Fixing most Parameter "bugs:" and other caveats''' | * '''Fixing most Parameter "bugs:" and other caveats''' | ||
:{{Seealso|[[LUX#Stock Shaders VS LUX|Stock Shaders VS LUX]]}} | : {{Seealso|[[LUX#Stock Shaders VS LUX|Stock Shaders VS LUX]]}} | ||
<br> | <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.}} | ||
:{{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!}} | : {{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> | <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.}} | ||
:{{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.}} | : {{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> | <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}} | ||
{{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.}} | {{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|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.}} | {{Important|{{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.}} | ||
:{{ModernWarning|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> | <br> | ||
==== Features required for {{mapbase|2}} compatibility ==== | ==== Features required for {{mapbase|2}} compatibility ==== | ||
Line 65: | Line 53: | ||
* Spline-Ropes | * Spline-Ropes | ||
* Parallax Corrected Cubemaps ( PCC ) | * Parallax Corrected Cubemaps ( PCC ) | ||
:{{ModernNote|Just like {{mapbase|2}}, 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|2}} and {{mapbase}}. This means that Mapbase compilers can be used for this to work.}} | ||
* {{ | * {{Ent|$envmapmask}} + {{Ent|$bumpmap}} on {{Ent|VertexLitGeneric}} | ||
* Replacement for the "Postprocessing" Controller Shader | * Replacement for the "Postprocessing" Controller Shader | ||
* Replacement for the "Engine_post" Shader from {{as}} | * Replacement for the "Engine_post" Shader from {{as}} | ||
* Hammer {{ | * Hammer {{Ent|$blendmodulatetexture}} previewing fix. | ||
* Brush {{ | * Brush {{Ent|$phong}} | ||
* Treesway | * Treesway | ||
:{{ModernTodo|Is the {{mapbase}} implementation ported from {{as}}?}} | : {{ModernTodo|Is the {{mapbase}} implementation ported from {{as}}?}} | ||
<br> | <br> | ||
==== New Features ==== | ==== New Features ==== | ||
* In {{src13mp}} Models utilizing Model Lightmapping can use {{ | * In {{src13mp}} Models utilizing Model Lightmapping can use {{Ent|$bumpmap}}. Additionally all Model shaders will be able to utilize this feature. Except they have {{Ent|$phong}}. | ||
:{{ | : {{Important|The Lightmap does not do bumped-lighting using the bumpmap. Only named-lights/projected textures will be able to do so.}} | ||
:{{ModernNote| Lightmapped models will not be able to receive {{ | : {{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. | ||
:{{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! }} | : {{ModernWarning|The way this is currently implemented requires a custom written tool, two smd's ( one with lightmap uv ) and also has a lot of precision loss for the Lightmap UV's. Additionally this requires a custom compiler! }} | ||
::{{ModernTodo|Investigate {{src07}} code, supposedly the Studiomdl code is there. Maybe it can be packed via Blendweights or alternatively the precision loss might be decreased.}} | ::{{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> | <br> | ||
Line 88: | Line 76: | ||
* [[$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}}+ | ||
:{{ModernNote| | : {{ModernNote| | ||
:* {{LUX|2}} allows the use of Rec. 709 HDTV Luminance Weights. <code>float3(0.2126f, 0.7152f, 0.0722f)</code>. | :* {{LUX|2}} 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>}} | :* 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 | ||
:{{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.}} | : {{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|2}}.}} | : {{seealso|PBR Shaders in the community commonly have a $emissiontexture parameter that does EXACTLY what [[Glowing_Textures#.24selfillum|$selfillumtexture]] does in {{LUX|2}}.}} | ||
* Water Shader with {{ | * 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 brushes this will use the Lightmap | ||
:* On models '''with''' {{ | :* On models '''with''' {{Ent|$bumpmap}}, this will use bumped lighting. | ||
:* On models without {{ | :* 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 {{ | :* In {{src13mp}} Models utilizing Model Lightmapping, will use the Lightmap. Regardless of whether or not {{Ent|$bumpmap}} is used.}} | ||
<br> | <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. | ||
:{{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!}} | :{{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 | ||
Line 112: | Line 100: | ||
<br> | <br> | ||
==== Not functional - FOR NOW ==== | ==== Not functional - FOR NOW ==== | ||
* {{ | * {{Ent|$emissiveblend}} - Non-Existant. Planned for later. | ||
* {{ | * {{Ent|$distancealpha}} - Non-Functional. Planned for later. | ||
* {{ | * {{Ent|$ssbump}} - Non-Functional. Planned for later. | ||
* [[$detail#Parameters and Effects|$detailblendmode]] <code>10 & 11</code>. - Non-Functional. Planned for later. | * [[$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.}} | ||
<br> | <br> | ||
== LightMappedGeneric == | == LightMappedGeneric == | ||
Line 129: | Line 117: | ||
[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}} 2-9 Don't work.<br> | [[$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]]{{as}} 6 Doesn't work.<br> | ||
[[$detail#Parameters and Effects|$detailblendmode]]{{csgo}} 1-6, 8 Don't work. 9 Does not work with {{ | [[$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| | {{ModernNote| | ||
[[Glowing_Textures#.24selfillum|$selfillummask]] Missing<br> | [[Glowing_Textures#.24selfillum|$selfillummask]] Missing<br> | ||
{{ | {{Ent|$selfillum_envmapmask_alpha}} Missing<br> | ||
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] Missing<br> | [[Glowing_Textures#.24selfillum|$selfillumfresnel]] Missing<br> | ||
{{ | {{Ent|$blendtintbybasealpha}} Missing<br> | ||
[[$detail#Parameters and Effects|$detailtexturetransform]] Missing<br> | [[$detail#Parameters and Effects|$detailtexturetransform]] Missing<br> | ||
{{ | {{Ent|$lightwarptexture}}{{csgo}} Missing<br> | ||
{{ | {{Ent|$envmapfresnelminmaxexp}}{{only|{{l4d}}+}}<br> | ||
{{ | {{Ent|$envmaplightscale}}{{only|{{as}}+}}}} | ||
{{Notice|{{ | {{Notice|{{Ent|$basealphaenvmapmask}} requires inverted masks}} | ||
| style="width:50%"| | | style="width:50%"| | ||
Line 152: | Line 140: | ||
[[$detail#Parameters and Effects|$detailblendmode]] 1-9 works.<br> | [[$detail#Parameters and Effects|$detailblendmode]] 1-9 works.<br> | ||
[[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned.<br> | [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned.<br> | ||
{{ | {{Ent|$bumpmap}} + {{Ent|$envmapmask}} works, used to be {{only|{{csgo}}.}}<br> | ||
{{ | {{Ent|$lightwarptexture}} + {{Ent|$detail}} works ( does not work in {{as}}{{tf2}} ).<br> | ||
{{ | {{Ent|$basealphaenvmapmask}} + {{Ent|$bumpmap}} works.<br> | ||
[[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br> | [[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br> | ||
{{ | {{Ent|$blendtintbybasealpha}} Exists now.<br> | ||
{{ | {{Ent|$selfillum_envmapmask_alpha}} Exists now.<br> | ||
{{ | {{Ent|$envmaplightscale}} Exists now.<br> | ||
[[$detail#Parameters and Effects|$detailtexturetransform]] Exists now.}} | [[$detail#Parameters and Effects|$detailtexturetransform]] Exists now.}} | ||
Line 164: | Line 152: | ||
:{{Notice|Caveat - [[Glowing_Textures#.24selfillum|$selfillumtexture]] has higher priority than both.}} | :{{Notice|Caveat - [[Glowing_Textures#.24selfillum|$selfillumtexture]] has higher priority than both.}} | ||
{{ | {{Important|{{Ent|$basealphaenvmapmask}} does no longer require a flipped mask.}} | ||
:{{ModernWorkaround|Materials that previously used have to be adjusted. Use {{ | :{{ModernWorkaround|Materials that previously used have to be adjusted. Use {{Ent|$envmapmask}} or {{Ent|$normalmapalphaenvmapmask}} instead!}} | ||
|} | |} | ||
Line 174: | Line 162: | ||
=== Stock Shaders === | === Stock Shaders === | ||
==== Always ==== | ==== Always ==== | ||
{{ | {{Ent|$envmaplightscale}}{{only|{{csgo}}}}. | ||
==== Without $Bumpmap ==== | ==== Without $Bumpmap ==== | ||
{{ModernBug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 10-11 Don't work.<br> | {{ModernBug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 10-11 Don't work.<br> | ||
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] missing.<br> | [[Glowing_Textures#.24selfillum|$selfillumfresnel]] missing.<br> | ||
{{ | {{Ent|$lightwarptexture}} missing.}} | ||
{{ModernNote|$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.}} | ||
Line 188: | Line 176: | ||
[[$detail#Parameters and Effects|$detailblendmode]]{{csgo}} 5-6 & 8-11 Don't work.}} | [[$detail#Parameters and Effects|$detailblendmode]]{{csgo}} 5-6 & 8-11 Don't work.}} | ||
{{ModernNote| | {{ModernNote| | ||
{{ | {{Ent|$envmapmask}} missing. Except {{mapbase}}.<br> | ||
[[Glowing_Textures#.24selfillum|$selfillummask]] missing. {{ModernConfirm|Only in {{mapbase}}?}} | [[Glowing_Textures#.24selfillum|$selfillummask]] missing. {{ModernConfirm|Only in {{mapbase}}?}} | ||
{{ | {{Ent|$selfillum_envmapmask_alpha}}{{mapbase}} missing.<br> | ||
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] disables {{ | [[Glowing_Textures#.24selfillum|$selfillumfresnel]] disables {{Ent|$normalmapalphaenvmapmask}}. {{ModernTodo|Also on other branches than {{as}}?}}}} | ||
==== With $Phong ==== | ==== With $Phong ==== | ||
{{ModernBug|[[$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. | ||
[[$phong#Masking|$invertphongmask]]{{as}}{{src13}} In the shadercode, only flips the mask used for {{ | [[$phong#Masking|$invertphongmask]]{{as}}{{src13}} In the shadercode, only flips the mask used for {{Ent|$envmap}}. {{ModernConfirm|Also on newer branches?}} | ||
[[$phong#Colors|$phongalbedotint]] cannot be used without [[$phong#Masking|$phongexponenttexture]].<br> | [[$phong#Colors|$phongalbedotint]] cannot be used without [[$phong#Masking|$phongexponenttexture]].<br> | ||
{{ | {{Ent|$phongwarptexture}}{{l4d2}} does not work.<br> | ||
[[$phong#Colors|$phongalbedoboost]]{{only|{{csgo}}}} + {{ | [[$phong#Colors|$phongalbedoboost]]{{only|{{csgo}}}} + {{Ent|$detail}} does not work.<br> | ||
[[$phong#Colors|$phongtint]] disables [[$phong#Colors|$phongalbedotint]].<br> | [[$phong#Colors|$phongtint]] disables [[$phong#Colors|$phongalbedotint]].<br> | ||
{{ | {{Ent|$envmap}} always masked by something.<br> | ||
{{Only in {{l4d}}+ {{ | {{Only in {{l4d}}+ {{Ent|$envmap}} masked by {{Ent|$basetexture}} luminance when {{Ent|$normalmapalphaenvmapmask}} and [[$phong#Masking|$basemapluminancephongmask]] is used.<br> | ||
{{ | {{Ent|$envmap}} masked by {{Ent|$basetexture}} alpha when {{Ent|$normalmapalphaenvmapmask}} and [[$phong#Masking|$basemapalphaphongmask]] is used.<br> | ||
[[$phong#Masking|$basemapalphaphongmask]] makes {{ | [[$phong#Masking|$basemapalphaphongmask]] makes {{Ent|$phong}} ignore the {{Ent|$bumpmap}}.<br> | ||
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{ | [[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{Ent|$normalmapalphaenvmapmask}} will cause the {{Ent|$envmap}} to be multiplied by <code>0.0f</code> regardless of whether [[$phong#Masking|$invertphongmask]] is used.<br> | ||
[[Glowing_Textures#.24selfillum|$selfillumfresnel]] will cause {{ | [[Glowing_Textures#.24selfillum|$selfillumfresnel]] will cause {{Ent|$envmap}} to be masked using the {{Ent|$basetexture}} alpha channel.}}}} | ||
{{ModernNote|[[$phong#Brightness|$phongdisablehalflambert]] only in {{as}}+<br> | {{ModernNote|[[$phong#Brightness|$phongdisablehalflambert]] only in {{as}}+<br> | ||
Line 219: | Line 207: | ||
* [[$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> | ||
::{{ModernTodo|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.}} | ||
Line 226: | Line 214: | ||
* [[$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> | ||
* [[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br> | * [[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br> | ||
* {{ | * {{Ent|$selfillum_envmapmask_alpha}} Exists now.<br> | ||
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{ | * [[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{Ent|$normalmapalphaenvmapmask}} Works now.<br> | ||
Line 238: | Line 226: | ||
{{ModernNote|[[$phong#Masking|$invertphongmask]] Now only flips the mask used for phong. It will no longer touch the envmapmask ''at all''.<br> | {{ModernNote|[[$phong#Masking|$invertphongmask]] Now only flips the mask used for phong. It will no longer touch the envmapmask ''at all''.<br> | ||
[[$phong#Colors|$phongalbedotint]] can now be used without [[$phong#Masking|$phongexponenttexture]].}} | [[$phong#Colors|$phongalbedotint]] can now be used without [[$phong#Masking|$phongexponenttexture]].}} | ||
:{{Notice|Will use entirety of {{ | :{{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]] + {{ | * [[$phong#Colors|$phongalbedoboost]] + {{Ent|$detail}} Works. Does not work in {{csgo|4}}.<br> | ||
{{ModernNote|[[$phong#Colors|$phongtint]] does no longer disable [[$phong#Colors|$phongalbedotint]]. It will do <code>($baseTexture * Mask) * $PhongTint</code>}} | {{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!}} | :{{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>) | ||
: {{ | : {{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>}} | ||
* [[$phong#Masking|$basemapalphaphongmask]] '''no longer''' makes {{ | * [[$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]] + {{ | * [[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}}}} | ||
Line 259: | Line 247: | ||
|} | |} | ||
==History== | == History == | ||
{{LUX|2}} started developement on the 20.01.2023 DMY, but it was planned and thought ~14.01.2023 when the lead-developer [[User:ShiroDkxtro2|ShiroDkxtro2]] was in a hospital stay.<br> | {{LUX|2}} started developement on the 20.01.2023 DMY, but it was planned and thought ~14.01.2023 when the lead-developer [[User:ShiroDkxtro2|ShiroDkxtro2]] was in a hospital stay.<br> | ||
Even before 2023, the idea of rewritting Valve's Shaders was in mind. Various people asked [[User:ShiroDkxtro2|ShiroDkxtro2]] if certain modifications could be implemented for default shaders, such as CSM.<br> | Even before 2023, the idea of rewritting Valve's Shaders was in mind. Various people asked [[User:ShiroDkxtro2|ShiroDkxtro2]] if certain modifications could be implemented for default shaders, such as CSM.<br> | ||
Line 265: | Line 253: | ||
The Inception was supposed to be a means to make the existing Shaders more modable, with new features in mind and laid out so that implementing new things would be easier.<br> | The Inception was supposed to be a means to make the existing Shaders more modable, with new features in mind and laid out so that implementing new things would be easier.<br> | ||
==Credits== | == Credits == | ||
* {{LUX|2}} uses [https://github.com/SCell555/ShaderCompile SCell555's ShaderCompiler]<br> | * {{LUX|2}} uses [https://github.com/SCell555/ShaderCompile SCell555's ShaderCompiler]<br> | ||
However, it is only used to compile the Shaders. Include files ( .inc ) are intended to be made using [https://strawberryperl.com/ Perl]. | However, it is only used to compile the Shaders. Include files ( .inc ) are intended to be made using [https://strawberryperl.com/ Perl]. | ||
Line 304: | Line 292: | ||
[[User:ShiroDkxtro2|ShiroDkxtro2]] would also like to thank Joshua Ashton personally for his various open-source work related to the source engine. | [[User:ShiroDkxtro2|ShiroDkxtro2]] would also like to thank Joshua Ashton personally for his various open-source work related to the source engine. | ||
==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. | ||
Line 311: | Line 299: | ||
* {{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.}} |
Revision as of 11:20, 14 April 2023
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
- 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 system will have to either patch
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: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.
- Template:ModernNote
- 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.- Template:ModernNote
- Mapbase compatibility
Note: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
Template:ModernNote


Features required for
Mapbase compatibility
- $phongdisablehalflambert from
+
- Radial Fog for all "Geometry" Shaders
- Spline-Ropes
- Parallax Corrected Cubemaps ( PCC )
- Template:ModernNote
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
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.
- Template:ModernNote
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
+
- $selfillumtexture Deprecated since
- This used to be obsolete
- Template:ModernNote
- 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.
- $bumpmask and related
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
- $emissiveblend - Non-Existant. Planned for later.
- $distancealpha - Non-Functional. Planned for later.
- $ssbump - Non-Functional. Planned for later.
- $detailblendmode
10 & 11
. - Non-Functional. Planned for later.
Stock Shaders VS LUX
LightMappedGeneric
Stock Shaders![]() |
|
VertexLitGeneric
Stock ShadersAlways$envmaplightscale(only in Without $BumpmapTemplate:ModernBug Template:ModernNote
With $BumpmapTemplate:ModernBug Template:ModernNote
With $Phong |
|
History
LUX started developement on the 20.01.2023 DMY, but it was planned and thought ~14.01.2023 when the lead-developer ShiroDkxtro2 was in a hospital stay.
Even before 2023, the idea of rewritting Valve's Shaders was in mind. Various people asked ShiroDkxtro2 if certain modifications could be implemented for default shaders, such as CSM.
These requests would usually result in a simple "no.", modifying the default shaders was not considered feasible for various reasons, most of which are indirectly mentioned in LUX's Goals.
The Inception was supposed to be a means to make the existing Shaders more modable, 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 near 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 partically 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 inhereted with the credits of LUX. You can find Mapbase's credits HERE.
One example would be the NvidiaPCF5x5Gaussian Shadow Filter Template:ModernNote 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.