LUX
LUX | |
---|---|
In Alpha development | |
Wiki | |
Type | Modification |
Developers | ShiroDkxtro2 |
Engine | Source |
Platforms | PC |
Based on | Source 2013 |
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
- Overhaul/Clean
materialsystem\stdshaders\
Folder - Implementing LUX Shaders would entail replacing the existing
stdshaders\
folder. LUX Shaders should be able to do everything SDK_ Shaders in and can do. - SDK_ Shaders will fall back to LUX_ Shaders, that way LUX can easily be used on Mapbase mods without much work.
- Many .h, .cpp, .fxc files have been rewritten
- Drastically decrease compile times for all Shaders
- With LUX, compiling the entirety of LUX_LightMappedGeneric takes around 30 seconds on 4 cores @4.1GHz
- SM3.0 Shaders Only
- Linux and macOS are 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.
- More Documentation for Shaders, their parameters, how they work and any possible caveats
- You might have noticed Articles like $lightwarptexture, $detail, UnlitTwoTexture and $envmapmask getting major updates with new information about caveats and bugs.
- This was a direct result of LUX development, although the focus was mainly on and as their code is publicly available.
- 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 ).
- Fixing most Parameter bugs and other caveats
- See also: Stock Shaders VS LUX
- Easy way of disabling features
- A custom Pre-Processor program has been made, allowing Mods that don't require specific features to easily disable them and further increase Shader compilation speed.
- Mapbase compatibility
- Replacing SDK_ Shaders in SDK mods, SDK2013CE or Mapbase mods should be as simple as replacing the
stdshaders\
Folder, assuming that no custom shaders were added. If they were added, developers may need to add them back or recreate them.
Planned Features
This is a list of new features that are being implemented / will be implemented from newer branches such as:
The code may be modified for simplification or if it needs a overhaul
- Warning:For more complicated features, there might be visual disparity when compared to official implementations.
Mapbase compatibility
- $phongdisablehalflambert, ported from the Alien Swarm engine branch
- Radial Fog for all "Geometry" Shaders
- Spline-Ropes
- Parallax Corrected Cubemaps
- Just like with Mapbase, this will require a custom compiler 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
- Confirm:Is the Mapbase implementation ported from Alien Swarm?
- $bumpmask and related
New features
- In Source 2013 Multiplayer, models utilizing Model Lightmapping can use $bumpmap. Additionally, all Model shaders will be able to utilize this feature, unless they have $phong.
- The Lightmap does not do bumped-lighting using the bumpmap. Only named lights/projected textures will be able to do so.
- Lightmapped models will not be able to receive $phong. This is not planned at the moment but should be possible for named lights/projected textures!
- In Models can utilize Lightmap UV's.
- The way this is currently implemented requires a custom-written tool, two SMDs (one with a lightmap uv), and also has a lot of precision loss for the Lightmap UVs. Additionally, this requires a custom compiler! Todo: Investigate Source 2007 code, supposedly the Studiomdl code is there. Maybe it can be packed via Blendweights or the precision loss might be decreased.
- The way this is currently implemented requires a custom-written tool, two SMDs (one with a lightmap uv), and also has a lot of precision loss for the Lightmap UVs. Additionally, this requires a custom compiler!
Features ported/recreated
- $phongdisablehalflambert (in all games since ) - Also needed for Mapbase
- $phongexponentfactor From Source 2013 Multiplayer
- $phongalbedoboost (in all games since )
- $basemapluminancephongmask (in all games since )
- 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 offloat3(0.2990f, 0.5870f, 0.1140f)
- LUX allows the use of Rec. 709 HDTV Luminance Weights.
- $selfillumtexture Deprecated since Source 2007
- Yes, there is a use for this! $detailblendmode 5 is commonly used for glowing textures. This parameter allows for not wasting your $detail. Additionally no $emissiveblend is required.
- See also: PBR Shaders in the community commonly have a $emissiontexture parameter that does EXACTLY what $selfillumtexture does in LUX.
- $flowmap support - From Alien Swarm
- $envmaplightscale From for brushes (in all games since ) and models (only in )
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
- $envmapsphere and related - These features have been removed since Alien Swarm and is obsolete.
- This is very easy to re-implement. The 7th face of a cubemap is still built in Source 2013, so this feature is still operational.
Not functional for now
- $distancealpha - Non-Functional. Planned for later.
Stock Shaders VS LUX
LightmappedGeneric
Stock ShadersBug:
$detailblendmode () 2-9 Don't work. $selfillummask (not in ) |
LUX_LightMappedGenericNote:
$detailblendmode 1-9 works. Note:Caveat - Has higher priority than $selfillum/$selfillummask.
Important:$basealphaenvmapmask does not require a flipped mask.
|
VertexLitGeneric
Stock ShadersAlways$envmaplightscale(only in ). Without $BumpmapBug:$detailblendmode 10-11 Don't work. $selfillumfresnel missing. Note:$lightwarptexture forces bumpmapping by binding a default one, unless one is manually specified.
With $BumpmapBug:
$detailblendmode 5-11 Don't work. Note:
$envmapmask missing. Except . $selfillum_envmapmask_alpha missing.
With $PhongBug:$detailblendmode 8-11 Don't work.
$invertphongmask In the shadercode, only flips the mask used for $envmap. Confirm:Also on newer branches?
$phongalbedotint cannot be used without $phongexponenttexture. Note:$phongdisablehalflambert(in all games since )
$phongexponentfactor only in |
LUX_VertexLitGenericWithout $Bumpmap
With $Bumpmap
With $Phong
Note:$invertphongmask Now only flips the mask used for phong. It will no longer touch the envmapmask at all.
$phongalbedotint can now be used without $phongexponenttexture.
Note:$phongtint does no longer disable $phongalbedotint. It will do
($baseTexture * Mask) * $PhongTint
|
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
- SCell555's ShaderCompiler
- 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.
- Ficool2
- For enlightening us about the Constant Register Hack, allowing for the use of more than 32 float constant registers on SM3.0
- This Project would be nearly impossible without it.
- ChatGPT
- Help with programming and the undocumented graphical features of the Source Engine.
- It knows things and can make new things to a degree. Various code used in LUX has been partially written by AI.
- Mapbase
- Since one of the goals of this project is to be compatible with it, various code from it has been adapted.
- This means that all Shader-related things should also be inherited with the credits of LUX. You can find Mapbase's credits here.
- Source++
- Code might be included, like the NvidiaPCF5x5Gaussian Shadow Filter
- Joshua Ashton
- For his various open-source work related to the Source Engine
See also
- Development can be followed here, Bug-Reports & suggestions made.
- It is also intended as a general place for discussing Source 2013 related Shader-Modding.