LUX
LUX是一个专门为
起源2013 单人分支和
起源2013 多人分支制作和开发的模组,其目的皆在为完全重写所有原版和
Mapbase的着色器
Contents
目标
- 大修\清理
materialsystem\stdshaders\
目录
警告:除了现有的着色器编译功能外,几乎所有的东西都被“扬了”。
-
- 大幅减少所有着色器的编译时间
- Notice: 即便使用高端CPU也至少需要半天或更久的时间进行编译。以
LUX为例,在4核@4.1Hz环境下编译整个LUX_Lightmappedgeneric仅需要大约30秒
- 着色器仅使用SM 3.0
- Why?: ps20b及以下有太多限制。缺少可用的常量寄存器会导致极端分支和大量“组合”。使代码变成一坨难以阅读和理解的屎山。这会抑制模组制作者的积极性。
注意:SM3.0于2004年发布,V社在2008年考虑到了ps2.0及以下的低端硬件。详见幻灯片第8页
注意:这意味着不支持SM3.0的低端硬件将无法使用新的着色器
- Notice: Linux和MacOS暂无官方支持。以上系统用户需要使用
togl
进行补丁才能使用SM3.0,或使用DXVK
- 完全重写.h, .cpp, .fxc文件
- 更多有关着色器、自身参数、如何工作以及任何可能的注意事项的文档
- Notice: 你可能已经注意到了如
$lightwarptexture
、$detail
、UnlitTwoTexture
、$envmapmask
得到了由ShiroDkxtro2贡献的重大更新 - 他为
添加了新的注意事项和bug记录。这些文档是
LUX开发的直接结果,尽管开发的重点集中在
上,因为他们是开源项目
注意:目前缺少有关着色器如何在起源中工作的文档,这导致起源的图形学领域门槛很高,需要有大量的相关经验,阻碍了模组制作者们修改着色器和创作自己的
- 参见:
计划实现的功能
. 这个目标包含了例如$selfillumtexture的旧功能和例如$phongalbedoboost(仅存在于 csgo 之中)的新功能
- 修复大多数参数的Bug和警告
- 参见:
原版着色器与LUX着色器对比
- 禁用特定功能的简单方法
注意:已制作一个自定义的预处理程序,可以通过禁用不需要的功能来使着色器编译的更快
- 对Mapbase的兼容性
- Notice: 要替换其他mod(如Source 2013社区版,以Mapbase为本体的mod)修改的原版着色器,应该和直接替换
stdshaders\
目录一样简单 注意: 以上假定除修改的原版着色器外无其他的自定义着色器,但如果确实有,开发者应该能将它们添加回来,因为这是添加自定义着色器的先决条件
计划实现的功能
这是正在实施的新功能列表,或者将从较新的引擎分支移植/复刻的功能,例如
![Icon-Important.png](/w/images/thumb/5/5c/Icon-Important.png/10px-Icon-Important.png)
![LUX](/w/images/8/87/Lux-16px.png)
警告:对于更复杂的功能,与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
Fromfor brushes
+ AND models (仅存在于
之中)+
重要:
Features that are being discarded
$envmapsphere
and related - These features have been removed sinceand 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
![Blank image.png](/w/images/b/ba/Blank_image.png)
LightMappedGeneric
Stock Shader's
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![起源2013](/w/images/thumb/1/11/Src13-16px.png/32px-Src13-16px.png)
![军团要塞2](/w/images/thumb/8/84/Tf2-16px.png/16px-Tf2-16px.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![异形丛生](/w/images/thumb/d/d9/As_icon.png/16px-As_icon.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![反恐精英:全球攻势](/w/images/thumb/8/85/Csgo_icon.png/16px-Csgo_icon.png)
$bumpmap
, $envmap
or $selfillum
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
$bumpmap
+ $envmapmask
Doesn't work, except in ![反恐精英:全球攻势](/w/images/thumb/8/85/Csgo_icon.png/16px-Csgo_icon.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
$lightwarptexture
+ $detail
![军团要塞2](/w/images/thumb/8/84/Tf2-16px.png/16px-Tf2-16px.png)
![异形丛生](/w/images/thumb/d/d9/As_icon.png/16px-As_icon.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
$basealphaenvmapmask
+ bumpmap
Doesn't work
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
$selfillum_envmapmask_alpha
Missing![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
$blendtintbybasealpha
Missing![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
$lightwarptexture
![反恐精英:全球攻势](/w/images/thumb/8/85/Csgo_icon.png/16px-Csgo_icon.png)
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
$envmapfresnelminmaxexp
(仅存在于 ![求生之路](/w/images/thumb/a/ad/Icon-L4D.png/16px-Icon-L4D.png)
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
$envmaplightscale
(仅存在于 ![异形丛生](/w/images/thumb/d/d9/As_icon.png/16px-As_icon.png)
Notice:
$basealphaenvmapmask
requires inverted masksLUX_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.
- Notice: Caveat - Has higher priority than $selfillum/$selfillummask.
- Notice: 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
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![起源2013](/w/images/thumb/1/11/Src13-16px.png/32px-Src13-16px.png)
![军团要塞2](/w/images/thumb/8/84/Tf2-16px.png/16px-Tf2-16px.png)
![异形丛生](/w/images/thumb/d/d9/As_icon.png/16px-As_icon.png)
![反恐精英:全球攻势](/w/images/thumb/8/85/Csgo_icon.png/16px-Csgo_icon.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
$lightwarptexture
missing.注意:$lightwarptexture fores bumpmapping by binding a default one, unless one is manually specified.
With $Bumpmap
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![起源2013](/w/images/thumb/1/11/Src13-16px.png/32px-Src13-16px.png)
![军团要塞2](/w/images/thumb/8/84/Tf2-16px.png/16px-Tf2-16px.png)
![异形丛生](/w/images/thumb/d/d9/As_icon.png/16px-As_icon.png)
![反恐精英:全球攻势](/w/images/thumb/8/85/Csgo_icon.png/16px-Csgo_icon.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![反恐精英:全球攻势](/w/images/thumb/8/85/Csgo_icon.png/16px-Csgo_icon.png)
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
$envmapmask
missing. Except ![Mapbase](/w/images/thumb/5/5b/Mapbase-16px.png/16px-Mapbase-16px.png)
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
$selfillum_envmapmask_alpha
![Mapbase](/w/images/thumb/5/5b/Mapbase-16px.png/16px-Mapbase-16px.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
$normalmapalphaenvmapmask
. With $Phong
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![起源2013](/w/images/thumb/1/11/Src13-16px.png/32px-Src13-16px.png)
![军团要塞2](/w/images/thumb/8/84/Tf2-16px.png/16px-Tf2-16px.png)
![异形丛生](/w/images/thumb/d/d9/As_icon.png/16px-As_icon.png)
![反恐精英:全球攻势](/w/images/thumb/8/85/Csgo_icon.png/16px-Csgo_icon.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![异形丛生](/w/images/thumb/d/d9/As_icon.png/16px-As_icon.png)
![起源2013](/w/images/thumb/1/11/Src13-16px.png/32px-Src13-16px.png)
$envmap
. ![](/w/images/thumb/2/2e/Confirm.png/10px-Confirm.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
$phongwarptexture
![求生之路2](/w/images/thumb/8/8b/Icon-L4D2.png/16px-Icon-L4D2.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![反恐精英:全球攻势](/w/images/thumb/8/85/Csgo_icon.png/16px-Csgo_icon.png)
$detail
does not work.![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
$envmap
always masked by something.![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
![求生之路](/w/images/thumb/a/ad/Icon-L4D.png/16px-Icon-L4D.png)
$envmap
masked by $basetexture
luminance when $normalmapalphaenvmapmask
and $basemapluminancephongmask is used.![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
$envmap
masked by $basetexture
alpha when $normalmapalphaenvmapmask
and $basemapalphaphongmask is used.![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
$phong
ignore the $bumpmap
.![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
$normalmapalphaenvmapmask
will cause the $envmap
to be multiplied by 0.0f
regardless of whether $invertphongmask is used.![Icon-Bug.png](/w/images/thumb/b/b4/Icon-Bug.png/10px-Icon-Bug.png)
$envmap
to be masked using the $basetexture
alpha channel![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
![异形丛生](/w/images/thumb/d/d9/As_icon.png/16px-As_icon.png)
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
![军团要塞2](/w/images/thumb/8/84/Tf2-16px.png/16px-Tf2-16px.png)
![起源2013 多人分支](/w/images/thumb/1/11/Src13mp-16px.png/48px-Src13mp-16px.png)
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
![求生之路](/w/images/thumb/a/ad/Icon-L4D.png/16px-Icon-L4D.png)
![Note.png](/w/images/thumb/c/cc/Note.png/10px-Note.png)
![反恐精英:全球攻势](/w/images/thumb/8/85/Csgo_icon.png/16px-Csgo_icon.png)
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.
- Notice: 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
- Notice: 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
.
- Notice: This will make materials that previously used this intentionally, look different.
- $selfillumfresnel +
$normalmapalphaenvmapmask
will no longer multiply the$envmap
by0.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 (仅存在于
+ 之中)
![Blank image.png](/w/images/b/ba/Blank_image.png)
注意: Probably better as their own pages to document all parameters.