LUX
< Zh
Jump to navigation
Jump to search
LUX是一个专门为
起源2013 单人分支和
起源2013 多人分支制作和开发的模组,其目的皆在为完全重写所有原版和
Mapbase的着色器
目标
- 大修\清理
materialsystem\stdshaders\
目录
警告:除了现有的着色器编译功能外,几乎所有的东西都被“扬了”。
-
- 大幅减少所有着色器的编译时间
注意:即便使用高端CPU也至少需要半天或更久的时间进行编译。以
LUX为例,在4核@4.1Hz环境下编译整个LUX_Lightmappedgeneric仅需要大约30秒
- 着色器仅使用SM 3.0
- Why?: ps20b及以下有太多限制。缺少可用的常量寄存器会导致极端分支和大量“组合”。使代码变成一坨难以阅读和理解的屎山。这会抑制模组制作者的积极性。
注意:SM3.0于2004年发布,V社在2008年考虑到了ps2.0及以下的低端硬件。详见幻灯片第8页
注意:这意味着不支持SM3.0的低端硬件将无法使用新的着色器
注意:Linux和MacOS暂无官方支持。以上系统用户需要使用
togl
进行补丁才能使用SM3.0,或使用DXVK
- 完全重写.h, .cpp, .fxc文件
- 更多有关着色器、自身参数、如何工作以及任何可能的注意事项的文档
注意:你可能已经注意到了如$lightwarptexture、$detail、UnlitTwoTexture、$envmapmask得到了由ShiroDkxtro2贡献的重大更新
- 他为
添加了新的注意事项和bug记录。这些文档是
LUX开发的直接结果,尽管开发的重点集中在
上,因为他们是开源项目
注意:目前缺少有关着色器如何在起源中工作的文档,这导致起源的图形学领域门槛很高,需要有大量的相关经验,阻碍了模组制作者们修改着色器和创作自己的
- 参见:
计划实现的功能
. 这个目标包含了例如$selfillumtexture的旧功能和例如$phongalbedoboost(仅存在于 csgo 之中)的新功能
- 修复大多数参数的Bug和警告
- 参见:
原版着色器与LUX着色器对比
- 禁用特定功能的简单方法
注意:已制作一个自定义的预处理程序,可以通过禁用不需要的功能来使着色器编译的更快
- 对Mapbase的兼容性
注意:要替换其他mod(如Source 2013社区版,以Mapbase为本体的mod)修改的原版着色器,应该和直接替换
stdshaders\
目录一样简单注意: 以上假定除修改的原版着色器外无其他的自定义着色器,但如果确实有,开发者应该能将它们添加回来,因为这是添加自定义着色器的先决条件
计划实现的功能
这是正在实施的新功能列表,或者将从较新的引擎分支移植/复刻的功能,例如


警告:对于更复杂的功能,与V社的实现方法相比可能存在视觉差异。
出于
Mapbase兼容性而需实现的功能
- 来自
的$phongdisablehalflambert+
- 所有“几何”用着色器的径向雾
- Spline-Ropes
- 视差修正反射贴图
注意:就像
Mapbase一样,视差反射需要自定义的地图编译器
- VertexLitGeneric上同时使用$envmapmask 反射遮罩和$bumpmap 法线贴图的支持
- 控制器着色器"Postprocessing"的替代品
- 来自
的着色器"Engine_post"替代品
- $blendmodulatetexture的Hammer内预览修复
- 固体用漫反射
- 树叶飘动
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.
重要: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!
警告: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!
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
+
注意: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
注意: 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.
- 参见: 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 (仅存在于
之中)+
重要:
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
待完善: Move This to their own pages or something like that.
LightMappedGeneric
Stock Shader's

























LUX_LightMappedGeneric
- $detailblendmode 1-9 works.
- $detailblendmode 10-11 planned.
- $bumpmap + $envmapmask works, used to be (仅存在于
. 之中)
- $lightwarptexture + $detail works ( does not work in
).
- $basealphaenvmapmask + $bumpmap works.
- $selfillummask Exists now.
- $blendtintbybasealpha Exists now.
- $selfillum_envmapmask_alpha Exists now.
- $detailtexturetransform Exists now.
注意:Caveat - Has higher priority than $selfillum/$selfillummask.
注意:Caveat - $selfillumtexture has higher priority than both.
重要:$basealphaenvmapmask does no longer require a flipped mask.
解决方案:Materials that previously used have to be adjusted. Use $envmapmask or $normalmapalphaenvmapmask instead!
VertexLitGeneric
Stock Shader's
Always
$envmaplightscale(仅存在于 之中).
Without $Bumpmap







注意:$lightwarptexture fores bumpmapping by binding a default one, unless one is manually specified.
With $Bumpmap













With $Phong




















0.0f
regardless of whether $invertphongmask is used. [todo tested in ?]









LUX_VertexLitGeneric
Without $Bumpmap
- $detailblendmode 10-11 planned. If possible.
- $selfillumfresnel Exists now.
- $lightwarptexture Exists now.
- 待完善: Make a parameter that allows its usage. Right now default behavior is replicated and a default bumpmap is bound.
With $Bumpmap
- $detailblendmode 5-9 work.
- $detailblendmode 10-11 planned. If possible.
- $envmapmask Exists now.
- $selfillummask Exists now.
- $selfillum_envmapmask_alpha Exists now.
- $selfillumfresnel + $normalmapalphaenvmapmask Works now.
With $Phong
- $detailblendmode 8-9 work now.
- $detailblendmode 10-11 planned. If possible.
注意:$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.
注意:Will use entirety of $basetexture, without being masked.
- $phongwarptexture works. ( does not work in
).
- $phongalbedoboost Exists now. Used to be (仅存在于
. 之中)
- $phongalbedoboost + $detail Works. Does not work in
反恐精英:全球攻势.
注意:$phongtint does no longer disable $phongalbedotint. It will do
($baseTexture * Mask) * $PhongTint
注意:When no $phongexponenttexture is specified, Mask will be 1.0f!
- $envmap Can now be not-masked by using a new parameter (
$phongenvmapnomask
) 重要: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
- $basemapalphaphongmask no longer makes $phong ignore the $bumpmap.
注意:This will make materials that previously used this intentionally, look different.
- $selfillumfresnel + $normalmapalphaenvmapmask will no longer multiply the $envmap by
0.0f
- $phongdisablehalflambert Exists now. ( Used to be (仅存在于
+ 之中)
- $phongexponentfactor Exists now for
. ( Used to be (仅存在于
之中)
- $basemapluminancephongmask Exists now. ( Used to be (仅存在于
+ 之中)
- $phongalbedoboost Exists now. ( Used to be (仅存在于
+ 之中)
待完善: Add LUX_WorldVertexTransition and other LUX_ Shaders to this list of comparison and changes.
注意: Probably better as their own pages to document all parameters.