LUX

From Valve Developer Community
< Zh
Jump to: navigation, search
English (en)中文 (zh)Translate (Translate)
Zh/LUX
Development.pngAlpha 开发阶段中
Wiki
类型模组
开发商ShiroDkxtro2
引擎起源 起源
平台(存在于 个人电脑 个人电脑 之中)
基于起源2013 起源2013
 
GitHub
Join Discord server

LUX LUX是一个专门为起源2013 单人分支 起源2013 单人分支起源2013 多人分支 起源2013 多人分支制作和开发的模组,其目的皆在为完全重写所有原版和Mapbase Mapbase的着色器

目标

  • 大修\清理materialsystem\stdshaders\目录
Warning.png警告:除了现有的着色器编译功能外,几乎所有的东西都被“扬了”。
Note.png注意:实现LUX LUX的着色器需要将stdshaders/替换为LUX LUX自己的,这“有效”的扬了所有原版着色器的修改版,LUX应该能够实现所有起源2013Mapbase着色器原有的功能
Note.png注意:SDK着色器会自动回退到对应的LUX LUX版本,这样使用Mapbase Mapbase的模组无需太多改动就可以使用LUX
  • 大幅减少所有着色器的编译时间
Why?: 起源2013 单人分支起源2013 多人分支异形丛生,V社的着色器需要非常长的时间进行编译。尤其是在使用原版编译器的情况下。这限制了着色器的修改
Note.png注意:即便使用高端CPU也至少需要半天或更久的时间进行编译。以LUX LUX为例,在4核@4.1Hz环境下编译整个LUX_Lightmappedgeneric仅需要大约30秒
  • 着色器仅使用SM 3.0
Why?: ps20b及以下有太多限制。缺少可用的常量寄存器会导致极端分支和大量“组合”。使代码变成一坨难以阅读和理解的屎山。这会抑制模组制作者的积极性。
Note.png注意:SM3.0于2004年发布,V社在2008年考虑到了ps2.0及以下的低端硬件。详见幻灯片第8页
Note.png注意:这意味着不支持SM3.0的低端硬件将无法使用新的着色器
Note.png注意:Linux和MacOS暂无官方支持。以上系统用户需要使用togl进行补丁才能使用SM3.0,或使用DXVK
  • 完全重写.h, .cpp, .fxc文件
  • 更多有关着色器、自身参数、如何工作以及任何可能的注意事项的文档
Note.png注意:你可能已经注意到了如$lightwarptexture$detailUnlitTwoTexture$envmapmask得到了由ShiroDkxtro2贡献的重大更新
他为军团要塞2异形丛生起源2013反恐精英:全球攻势添加了新的注意事项和bug记录。这些文档是LUX LUX开发的直接结果,尽管开发的重点集中在起源2013异形丛生上,因为他们是开源项目
Note.png注意:目前缺少有关着色器如何在起源中工作的文档,这导致起源的图形学领域门槛很高,需要有大量的相关经验,阻碍了模组制作者们修改着色器和创作自己的
  • 实现起源2013没有的内容
参见:  计划实现的功能. 这个目标包含了例如$selfillumtexture的旧功能和例如$phongalbedoboost(存在于 csgo 之中)的新功能

  • 修复大多数参数的Bug和警告
参见:  原版着色器与LUX着色器对比

  • 禁用特定功能的简单方法
Note.png注意:已制作一个自定义的预处理程序,可以通过禁用不需要的功能来使着色器编译的更快
  • 对Mapbase的兼容性
Note.png注意:要替换其他mod(如Source 2013社区版,以Mapbase为本体的mod)修改的原版着色器,应该和直接替换stdshaders\目录一样简单
Note.png注意: 以上假定除修改的原版着色器外无其他的自定义着色器,但如果确实有,开发者应该能将它们添加回来,因为这是添加自定义着色器的先决条件

计划实现的功能

这是正在实施的新功能列表,或者将从较新的引擎分支移植/复刻的功能,例如异形丛生求生之路2反恐精英:全球攻势

Note.png注意:该语境下的被移植“对象”通常指异形丛生 异形丛生Mapbase Mapbase,但在多数情况下,其代码会出于简化或大修的目的而进行大量修改
Icon-Important.png重要:LUX LUX不使用任何的泄露代码。像$phongalbedoboost(存在于 csgo 之中)这样的功能不是什么难以实现的东西,它们可以在不使用泄露代码的情况下安全的复现
Warning.png警告:对于更复杂的功能,与V社的实现方法相比可能存在视觉差异。

出于Mapbase Mapbase兼容性而需实现的功能

Note.png注意:就像Mapbase Mapbase一样,视差反射需要自定义的地图编译器
Icon-Important.png重要:LUXMapbase参数是一样的,所以Mapbase的地图编译器也可以使用
待完善: 这真的是移植自异形丛生Mapbase功能吗

New Features

  • In 起源2013 多人分支 Models utilizing Model Lightmapping can use $bumpmap. Additionally all Model shaders will be able to utilize this feature. Except they have $phong.
Icon-Important.png重要:The Lightmap does not do bumped-lighting using the bumpmap. Only named-lights/projected textures will be able to do so.
Note.png注意: 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 起源2013 多人分支 Models can utilize Lightmap UV's.
Warning.png警告: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!
待完善: Investigate 起源2007 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

Note.png注意: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)

Note.png注意: 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.

Icon-Important.png重要:
  • On brushes this will use the Lightmap
  • On models with $bumpmap, this will use bumped lighting.
  • On models without $bumpmap, this will use Vertex Lighting.
  • In 起源2013 多人分支 Models utilizing Model Lightmapping, will use the Lightmap. Regardless of whether or not $bumpmap is used.

Features that are being discarded

  • $envmapsphere and related - These features have been removed since 异形丛生 and are obsolete.
Note.png注意:This is very easy to re-implement. The 7th face of a Cubemap is still being built in 起源2013 and therefore this feature is still operational given that the code has been implemented!

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



Stock Shaders VS LUX

待完善: Move This to their own pages or something like that.

LightMappedGeneric

Stock Shader's

Icon-Bug.png错误:$detailblendmode起源2013军团要塞2 2-9 Don't work.  [todo tested in?]
Icon-Bug.png错误:$detailblendmode异形丛生 6 Doesn't work.  [todo tested in?]
Icon-Bug.png错误:$detailblendmode反恐精英:全球攻势 1-6, 8 Don't work. 9 Does not work with $bumpmap, $envmap or $selfillum  [todo tested in?]


Icon-Bug.png错误:$bumpmap + $envmapmask Doesn't work, except in 反恐精英:全球攻势 反恐精英:全球攻势  [todo tested in?]
Icon-Bug.png错误:$lightwarptexture + $detail军团要塞2异形丛生 Doesn't work  [todo tested in?]
Icon-Bug.png错误:$basealphaenvmapmask + bumpmap Doesn't work  [todo tested in?]


Note.png注意:$selfillummask Missing
Note.png注意:$selfillum_envmapmask_alpha Missing
Note.png注意:$selfillumfresnel Missing
Note.png注意:$blendtintbybasealpha Missing
Note.png注意:$detailtexturetransform Missing
Note.png注意:$lightwarptexture反恐精英:全球攻势 Missing
Note.png注意:$envmapfresnelminmaxexp(存在于 求生之路+ 之中)
Note.png注意:$envmaplightscale(存在于 异形丛生+ 之中)
Note.png注意:$basealphaenvmapmask requires inverted masks

LUX_LightMappedGeneric

Note.png注意:Caveat - Has higher priority than $selfillum/$selfillummask.
Note.png注意:Caveat - $selfillumtexture has higher priority than both.
Icon-Important.png重要:$basealphaenvmapmask does no longer require a flipped mask.
PlacementTip.png解决方案:Materials that previously used have to be adjusted. Use $envmapmask or $normalmapalphaenvmapmask instead!

VertexLitGeneric

Stock Shader's

Always

$envmaplightscale(存在于 反恐精英:全球攻势 之中).

Without $Bumpmap

Icon-Bug.png错误:$detailblendmode起源2013军团要塞2异形丛生反恐精英:全球攻势 10-11 Don't work.  [todo tested in?]
Icon-Bug.png错误:$selfillumfresnel missing.  [todo tested in?]
Icon-Bug.png错误:$lightwarptexture missing.  [todo tested in?]
Note.png注意:$lightwarptexture fores bumpmapping by binding a default one, unless one is manually specified.

With $Bumpmap

Icon-Bug.png错误:$detailblendmode起源2013军团要塞2异形丛生反恐精英:全球攻势 5-11 Don't work.  [todo tested in?]
Icon-Bug.png错误:$detailblendmode反恐精英:全球攻势 5-6 & 8-11 Don't work.  [todo tested in?]
Note.png注意:$envmapmask missing. Except Mapbase.
Note.png注意:$selfillummask missing.
证实:Only in Mapbase?
Note.png注意:$selfillum_envmapmask_alphaMapbase missing.
Icon-Bug.png错误:$selfillumfresnel disables $normalmapalphaenvmapmask.
待完善: Also on other branches than 异形丛生?
  [todo tested in?]

With $Phong

Icon-Bug.png错误:$detailblendmode起源2013军团要塞2异形丛生反恐精英:全球攻势 8-11 Don't work.  [todo tested in?]
Icon-Bug.png错误:$invertphongmask异形丛生起源2013 In the shadercode, only flips the mask used for $envmap.
证实:Also on newer branches?
  [todo tested in?]
Icon-Bug.png错误:$phongalbedotint cannot be used without $phongexponenttexture.  [todo tested in?]
Icon-Bug.png错误:$phongwarptexture求生之路2 does not work.  [todo tested in?]
Icon-Bug.png错误:$phongalbedoboost(存在于 反恐精英:全球攻势 之中) + $detail does not work.  [todo tested in?]
Icon-Bug.png错误:$phongtint disables $phongalbedotint.  [todo tested in?]
Icon-Bug.png错误:$envmap always masked by something.  [todo tested in?]
Icon-Bug.png错误:Only in 求生之路+ $envmap masked by $basetexture luminance when $normalmapalphaenvmapmask and $basemapluminancephongmask is used.  [todo tested in?]
Icon-Bug.png错误:$envmap masked by $basetexture alpha when $normalmapalphaenvmapmask and $basemapalphaphongmask is used.  [todo tested in?]
Icon-Bug.png错误:$basemapalphaphongmask makes $phong ignore the $bumpmap.  [todo tested in?]
Icon-Bug.png错误:$selfillumfresnel + $normalmapalphaenvmapmask will cause the $envmap to be multiplied by 0.0f regardless of whether $invertphongmask is used.  [todo tested in?]
Icon-Bug.png错误:$selfillumfresnel will cause $envmap to be masked using the $basetexture alpha channel  [todo tested in?]
Note.png注意:$phongdisablehalflambert only in 异形丛生+
Note.png注意:$phongexponentfactor only in 军团要塞2起源2013 多人分支
Note.png注意:$basemapluminancephongmask only in 求生之路+
Note.png注意:$phongalbedoboost only in 反恐精英:全球攻势+

LUX_VertexLitGeneric

Without $Bumpmap

待完善: Make a parameter that allows its usage. Right now default behavior is replicated and a default bumpmap is bound.

With $Bumpmap

With $Phong

Note.png注意:Will use entirety of $basetexture, without being masked.
Note.png注意:When no $phongexponenttexture is specified, Mask will be 1.0f!
  • $envmap Can now be not-masked by using a new parameter ($phongenvmapnomask)
  • Icon-Important.png重要: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

Note.png注意:This will make materials that previously used this intentionally, look different.





待完善: Add LUX_WorldVertexTransition and other LUX_ Shaders to this list of comparison and changes.
Note.png注意: Probably better as their own pages to document all parameters.