Difference between revisions of "User:Yakumo koishi/LUX:zh-cn"

From Valve Developer Community
Jump to: navigation, search
m (A small change in Lang)
(Replaced content with "{{delete|just a copy-paste of the old version of the page LUX}}")
(Tag: Replaced)
 
Line 1: Line 1:
{{lang|User:Yakumo koishi/LUX}}
+
{{delete|just a copy-paste of the old version of the page [[LUX]]}}
 
 
{{infotable
 
|state=5
 
|ownwiki=https://github.com/ShiroDkxtro2/ACROHS-LUX_-Shaders-Project/wiki
 
|type=m0
 
|dev=[[User:ShiroDkxtro2|ShiroDkxtro2]]
 
|engine=2
 
|base={{src13|4}}
 
|platform={{only|PC}}
 
|github=ShiroDkxtro2/ACROHS-LUX_-Shaders-Project
 
|discord=https://discord.gg/cGv8GGSkpc
 
}}
 
 
 
LUX 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|4}}.
 
 
 
==Goals==
 
* '''Overhauled/Cleaned <code>materialsystem\stdshaders\</code> Folder'''
 
:{{warning|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.}}
 
::{{note|SDK_ Shaders will fall back to LUX_ Shaders, that way LUX_ can easily be used on {{mapbase|4}} mods without much work.}}
 
* '''Drastically decreased compile-times for all Shaders'''
 
:{{why|Valves Shaders take '''forever''' to compile {{src13sp}}{{src13mp}}{{as}}. Especially using the stock Shader-Compiler. This disincentives modding the Shaders.}}
 
:{{notice|Even on a good CPU it can take half a day, '''or more'''. As an example for LUX. Compiling the entirety of LUX_LightMappedGeneric takes around 30 seconds on 4 cores @4.1GHz }}
 
* '''SM3.0 Shaders Only'''
 
:{{why|ps20b and below is too limiting. The lack of available constant registers causes extreme branching and a lot of 'combos'. Making the code terrible to read and complicated. This disincentives Modders.}}
 
:{{note|SM3.0 released in 2004, and [https://cdn.cloudflare.steamstatic.com/apps/valve/2010/siggraph2010_vlachos_waterflow.pdf Valve considered ps2.0b low end hardware in ~2008]. See slide '''8'''}}
 
:{{note|This means that older hardware not capable of SM3.0 will not be able to use the new Shaders.}}
 
:{{notice|Linux is not officially supported. MacOS is also not officially supported. Users of said system will have to either patche <code>togl</code> to work with SM3.0 or use DxVK. }}
 
* '''Totally rewritten .h, .cpp, .fxc files'''
 
* '''More Documentation for Shaders, their parameters, how they work and any possible caveats'''
 
:{{notice| You might have noticed Articles like {{ent|$lightwarptexture}}, {{ent|$detail}}, {{ent|UnlitTwoTexture}} and {{ent|$envmapmask}} getting major updates from [[User:ShiroDkxtro2|ShiroDkxtro2]],
 
:where new information about Caveats and bugs were added for {{tf2}}{{as}}{{src13}}{{csgo}}. This was a direct result of LUX development, although the focus was mainly on {{src13}}{{as}} as their code is publicly available. }}
 
:{{note|The current lack of documentation, on how Shaders work in Source, disincentives Modders from learning how to mod Shaders or make their own. The barrier of entry is v. high as a lot of very specific knowledge is required too.}}
 
* '''Implementing features that aren't available in {{src13}}'''
 
:{{Seealso| <code>Planned Features</code>. This includes old features such as [[Glowing_Textures#.24selfillum|$selfillumtexture]] and newer features like [[$phong#Colors|$phongalbedoboost]]{{only|csgo}}.}}
 
* '''Fixing most Parameter "bugs:" and other caveats'''
 
:{{Seealso| <code>Stock Shaders VS LUX</code>}}
 
* '''Easy way of disabling features'''
 
:{{important|A custom Pre-Processor program has been made. It automatically sets <code>// STATIC:</code>'s to predefined values depending on <code>#define</code>'s in an included header file.}}
 
::{{note|Mods that don't require specific features (lightwarptexture/distancealpha/phong/envmaps/etc), can easily disable them. This will speed up Shader-compilation. Most parameters have been <code>#ifdef</code>'d in the c++ code!}}
 
* '''Mapbase compatibility'''
 
:{{notice| Replacing SDK_ Shaders in SDK mods, SDK2013CE or Mapbase mods should be as simple as replacing the <code>stdshaders\</code> Folder.}}
 
:{{note| It is assumed that no custom Shaders apart from SDK_ ones were added. If they do were added however, developers should be capable of adding them back, as that is the prerequisite for adding custom Shaders.}}
 
 
 
==Planned Features==
 
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.}}
 
{{important|LUX does '''not''' use ''any'' leaked code. Features like [[$phong#Colors|$phongalbedoboost]]{{only|csgo}} are not rocket-science. They can safely be recreated without the use of leaked code.}}
 
:{{warning|For features that are more complicated, there might be visual disparity when compared to official implementations.}}
 
 
 
==== Features required for {{mapbase|4}} compatibility ====
 
* [[$phong#Brightness|$phongdisablehalflambert]] from {{as}}+
 
* Radial Fog for all "Geometry" Shaders
 
* Spline-Ropes
 
* Parallax Corrected Cubemaps ( PCC )
 
:{{note|Just like {{mapbase|4}}, this requires custom compilers to work.}}
 
:{{important|The parameters are the same for LUX and {{mapbase}}. This means that Mapbase compilers can be used for this to work.}}
 
* {{ent|$envmapmask}} + {{ent|$bumpmap}} on {{ent|VertexLitGeneric}}
 
* Replacement for the "Postprocessing" Controller Shader
 
* Replacement for the "Engine_post" Shader from {{as}}
 
* Hammer {{ent|$blendmodulatetexture}} previewing fix.
 
* Brush {{ent|$phong}}
 
* Treesway
 
:{{todo|Is the {{mapbase}} implementation ported from {{as}}?}}
 
 
 
==== New Features ====
 
* In {{src13mp}} Models utilizing Model Lightmapping can use {{ent|$bumpmap}}. Additionally all Model shaders will be able to utilize this feature. Except they have {{ent|$phong}}.
 
:{{important|The Lightmap does not do bumped-lighting using the bumpmap. Only named-lights/projected textures will be able to do so.}}
 
:{{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.
 
:{{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! }}
 
::{{todo|Investigate {{src07}} code, supposedly the Studiomdl code is there. Maybe it can be packed via Blendweights or alternatively the precision loss might be decreased.}}
 
 
 
==== Features ported/recreated/revived ====
 
* [[$phong#Brightness|$phongdisablehalflambert]] From {{as}}+ - Also needed for {{mapbase}}
 
* [[$phong#Masking|$phongexponentfactor]] From {{src13mp}}{{tf2}}, with LUX also on {{src13sp}}
 
* [[$phong#Colors|$phongalbedoboost]] From {{csgo}} - Its just <code>BaseTexture * $PhongAlbedoBoost</code>... No leaked code!
 
* [[$phong#Masking|$basemapluminancephongmask]] From {{as}}+
 
:{{note|LUX allows the use of Rec. 709 HDTV Luminance Weights. <code>float3(0.2126f, 0.7152f, 0.0722f)</code>.<br>
 
Previously SDK_ Shaders would use the NTSC Analog Television standard of <code>float3(0.2990f, 0.5870f, 0.1140f)</code> }}
 
* [[Glowing_Textures#.24selfillum|$selfillumtexture]] Deprecated since {{src07}} - This used to be obsolete
 
:{{note| Yes, there is a use for this! [[$detail#Parameters and Effects|$detailblendmode]] 5 is commonly used for glowing textures. This parameter allows for not wasting your $detail. Additionally no $emissiveblend is required.}}
 
:{{seealso|PBR Shaders in the community commonly have a $emissiontexture parameter that does EXACTLY what [[Glowing_Textures#.24selfillum|$selfillumtexture]] does in LUX.}}
 
* Water Shader with {{ent|$flowmap}} Support - From {{as}}
 
* {{ent|$envmaplightscale}} From {{as}} for brushes{{as}}+ AND models {{only|{{csgo}}}}+
 
:{{important}}
 
:: * On brushes this will use the Lightmap
 
:: * On models '''with''' {{ent|$bumpmap}}, this will use bumped lighting.
 
:: * On models without {{ent|$bumpmap}}, this will use Vertex Lighting.
 
:: * In {{src13mp}} Models utilizing Model Lightmapping, will use the Lightmap. Regardless of whether or not {{ent|$bumpmap}} is used.
 
 
 
==== Features that are being discarded ====
 
* {{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!}}
 
* [[$bumpmap#Additional_Parameters|$bumpmask]] and related
 
 
 
==== Features that '''won't''' be ported/recreated/revived ====
 
* $basealphaenvmapmaskminmaxexp from {{as}} - This parameter is not yet documented on the VDC, it is also unclear what exactly it does...
 
* $EnvMapLightScaleMinMax from {{csgo}}
 
 
 
==== Not functional - FOR NOW ====
 
* {{ent|$emissiveblend}} - Non-Existant. Planned for later.
 
* {{ent|$distancealpha}} - Non-Functional. Planned for later.
 
* {{ent|$ssbump}} - Non-Functional. Planned for later.
 
* [[$detail#Parameters and Effects|$detailblendmode]] <code>10 & 11</code>.  - Non-Functional. Planned for later.
 
<br>
 
 
 
 
 
=Stock Shaders VS LUX=
 
{{todo|Move This to their own pages or something like that.}}
 
 
 
== LightMappedGeneric ==
 
=== 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>
 
{{bug|{{ent|$bumpmap}} + {{ent|$envmapmask}} Doesn't work, except in {{csgo|4}}}}
 
{{bug|{{ent|$lightwarptexture}} + {{ent|$detail}}{{tf2}}{{as}} Doesn't work}}
 
{{bug|{{ent|$basealphaenvmapmask}} + {{ent|bumpmap}} Doesn't work}}
 
<br>
 
{{note|[[Glowing_Textures#.24selfillum|$selfillummask]] Missing}}
 
{{note|{{ent|$selfillum_envmapmask_alpha}} Missing}}
 
{{note|[[Glowing_Textures#.24selfillum|$selfillumfresnel]] Missing}}
 
{{note|{{ent|$blendtintbybasealpha}} Missing}}
 
{{note|[[$detail#Parameters and Effects|$detailtexturetransform]] Missing}}
 
{{note|{{ent|$lightwarptexture}}{{csgo}} Missing}}
 
{{note|{{ent|$envmapfresnelminmaxexp}}{{only|{{l4d}}+}}}}
 
{{note|{{ent|$envmaplightscale}}{{only|{{as}}+}}}}
 
{{notice|{{ent|$basealphaenvmapmask}} requires inverted masks}}
 
 
 
=== LUX_LightMappedGeneric ===
 
* [[$detail#Parameters and Effects|$detailblendmode]] 1-9 works.
 
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned.
 
* {{ent|$bumpmap}} + {{ent|$envmapmask}} works, used to be {{only|{{csgo}}.}}
 
* {{ent|$lightwarptexture}} + {{ent|$detail}} works ( does not work in {{as}}{{tf2}} ).
 
* {{ent|$basealphaenvmapmask}} + {{ent|$bumpmap}} works.
 
* [[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.
 
* {{ent|$blendtintbybasealpha}} Exists now.
 
* {{ent|$selfillum_envmapmask_alpha}} Exists now.
 
* [[$detail#Parameters and Effects|$detailtexturetransform]] Exists now.
 
::{{notice|Caveat - Has higher priority than [[Glowing_Textures#.24selfillum|$selfillum]]/[[Glowing_Textures#.24selfillum|$selfillummask]].}}
 
:::{{notice|Caveat - [[Glowing_Textures#.24selfillum|$selfillumtexture]] has higher priority than both.}}
 
:{{important|{{ent|$basealphaenvmapmask}} does no longer require a flipped mask.}}
 
::{{workaround|Materials that previously used have to be adjusted. Use {{ent|$envmapmask}} or {{ent|$normalmapalphaenvmapmask}} instead! }}
 
 
 
== VertexLitGeneric ==
 
=== Stock Shader's ===
 
==== Always ====
 
{{ent|$envmaplightscale}}{{only|{{csgo}}}}.
 
==== Without $Bumpmap ====
 
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 10-11 Don't work.}}
 
{{bug|[[Glowing_Textures#.24selfillum|$selfillumfresnel]] missing.}}
 
{{bug|{{ent|$lightwarptexture}} missing.}}
 
:{{note|$lightwarptexture fores bumpmapping by binding a default one, unless one is manually specified.}}
 
 
 
==== '''With''' $Bumpmap ====
 
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{src13}}{{tf2}}{{as}}{{csgo}} 5-11 Don't work.}}
 
{{bug|[[$detail#Parameters and Effects|$detailblendmode]]{{csgo}} 5-6 & 8-11 Don't work.}}
 
{{note|{{ent|$envmapmask}} missing. Except {{mapbase}}.}}
 
{{note|[[Glowing_Textures#.24selfillum|$selfillummask]] missing. {{confirm|Only in {{mapbase}}?}}}}
 
{{note|{{ent|$selfillum_envmapmask_alpha}}{{mapbase}} missing.}}
 
{{bug|[[Glowing_Textures#.24selfillum|$selfillumfresnel]] disables {{ent|$normalmapalphaenvmapmask}}. {{todo|Also on other branches than {{as}}?}}}}
 
 
 
==== With $Phong ====
 
{{bug|[[$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?}}}}
 
{{bug|[[$phong#Colors|$phongalbedotint]] cannot be used without [[$phong#Masking|$phongexponenttexture]].}}
 
{{bug|{{ent|$phongwarptexture}}{{l4d2}} does not work.}}
 
{{bug|[[$phong#Colors|$phongalbedoboost]]{{only|{{csgo}}}} + {{ent|$detail}} does not work.}}
 
{{bug|[[$phong#Colors|$phongtint]] disables [[$phong#Colors|$phongalbedotint]].}}
 
{{bug|{{ent|$envmap}} always masked by something.}}
 
{{bug|Only in {{l4d}}+ {{ent|$envmap}} masked by {{ent|$basetexture}} luminance when {{ent|$normalmapalphaenvmapmask}} and [[$phong#Masking|$basemapluminancephongmask]] is used.}}
 
{{bug|{{ent|$envmap}} masked by {{ent|$basetexture}} alpha when {{ent|$normalmapalphaenvmapmask}} and [[$phong#Masking|$basemapalphaphongmask]] is used.}}
 
{{bug|[[$phong#Masking|$basemapalphaphongmask]] makes {{ent|$phong}} ignore the {{ent|$bumpmap}}.}}
 
{{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.}}
 
{{bug|[[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}}+}}
 
 
 
=== LUX_VertexLitGeneric ===
 
==== Without $Bumpmap ====
 
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>
 
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] 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.}}
 
 
 
==== '''With''' $Bumpmap ====
 
* [[$detail#Parameters and Effects|$detailblendmode]] 5-9 work.<br>
 
* [[$detail#Parameters and Effects|$detailblendmode]] 10-11 planned. If possible.<br>
 
* {{ent|$envmapmask}} Exists now.<br>
 
* [[Glowing_Textures#.24selfillum|$selfillummask]] Exists now.<br>
 
* {{ent|$selfillum_envmapmask_alpha}} Exists now.<br>
 
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{ent|$normalmapalphaenvmapmask}} Works now.<br>
 
 
 
==== With $Phong ====
 
* [[$detail#Parameters and Effects|$detailblendmode]] 8-9 work now.<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]].}}
 
::{{notice|Will use entirety of {{ent|$basetexture}}, without being masked.}}
 
* [[$phong#Colors|$phongwarptexture]] works. ( does not work in {{l4d2}} ).<br>
 
* [[$phong#Colors|$phongalbedoboost]] Exists now. Used to be {{only|{{csgo}}.}}
 
* [[$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!}}
 
* {{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>
 
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}}.
 
::{{notice|This will make materials that previously used this intentionally, look different.}}
 
* [[Glowing_Textures#.24selfillum|$selfillumfresnel]] + {{ent|$normalmapalphaenvmapmask}} will no longer multiply the {{ent|$envmap}} by <code>0.0f</code>
 
* [[$phong#Brightness|$phongdisablehalflambert]] Exists now. ( Used to be {{only|{{as}}+}}
 
* [[$phong#Masking|$phongexponentfactor]] Exists now for {{src13sp}}. ( Used to be {{only|{{tf2}}{{src13mp}}}}
 
* [[$phong#Masking|$basemapluminancephongmask]] Exists now. ( Used to be {{only|{{l4d}}+}}
 
* [[$phong#Colors|$phongalbedoboost]] Exists now. ( Used to be {{only|{{csgo}}+}}
 
<br>
 
<br>
 
<br>
 
<br>
 
 
 
{{todo|Add LUX_WorldVertexTransition and other LUX_ Shaders to this list of comparison and changes.}}
 
:{{note| Probably better as their own pages to document all parameters.}}
 

Latest revision as of 07:55, 3 August 2023

Warning icon.png
This article has been marked as a candidate for speedy deletion for the following reason:
just a copy-paste of the old version of the page LUX
If you object to this decision, then please discuss why hereIf this page doesn't meet the criteria for speedy deletion, then please remove this notice, but do not remove it from pages that you have created yourself
Administrators - Remember to check if anything links here and the page history (last edit) before deleting.