Refract
< Zh
Jump to navigation
Jump to search

一个具有折射效果的func_brush 。
Refract
是一个像素着色器 ,可在所有的 起源 游戏中使用。 它会扭曲其后方的物体。与
水
类似,但没有实时反射,因此不局限于平面表面。可用于创建扭曲的玻璃窗、冰等效果。
折射效果通过先渲染不包含折射表面的视图实现,然后使用法线贴图通过沿法线投影将预渲染视图中的像素坐标替换为新的像素坐标,从而扭曲图像。

澄清: 在哪些引擎中有效?


Refract
着色器应用在同一实体上的多层时,将无法正确渲染。
$mostlyopaque
参数,并为vmt设置$nowritez "1"
和$model "1"
。请注意,排序时折射的渲染开销很高。多层折射会导致严重的重叠绘制。避免使用大量的粒子贴图或彼此重叠渲染的多个折射表面。
语法
Refract { $normalmap ... $dudvmap ... $refracttint "[1 1 1]" $refractamount .2 }
如果指定了第二个法线贴图,它将与第一个法线贴图混合。
动画凸凹贴图的起始帧。
变换凸凹贴图纹理。
- The default position is center .5 .5 scale 1 1 rotate 0 translate 0 0.
- center defines the point of rotation. Only useful if rotate is being used.
- scale fits the texture into the material the given number of times. 2 1 is a 50% scale in the horizontal X axis while the vertical Y axis is still at original scale.
- rotate rotates the texture counter-clockwise in degrees. Accepts any number, including negatives.
- translate shifts the texture by the given numbers. .5 will shift it half-way. 1 will shift it once completely over, which is the same as not moving it at all.
注意:All values must be included!
错误:Scaling the texture may cause odd issues where the Texture Lock tool in Hammer will not actually lock the texture in place. [todo tested in ?]
错误:Rotating textures applied on brushes will rotate around the map origin (confirm: Orangebox engine only?). A fix for this is to change the center position in the VMT to the brush's origin. [todo tested in ?]
为折射着色,既可以均匀着色也可以逐像素着色。可以与$refracttint结合使用。
动画
$refracttinttexture
的起始帧。

$bluramount <整数 >


强制在填充率较低的显卡上使用此着色器。
控制反射的红、绿和蓝通道的强度。可以使用任何正数。默认值为
"[1 1 1]"
,表示100%的强度。
注意:由于值中包含空格字符,必须使用引号。
控制反射的对比度 。0为自然对比度,1为颜色完全平方(即color*color)。
控制反射的颜色饱和度。0为灰度,1为自然饱和度。

在边缘淡化折射效果。
待完善: 使用顶点颜色影响折射颜色。Alpha值会调整折射量。参见$vertexcolor。
使用纹理而不是渲染视图作为扭曲像素的来源。
待完善: 强制材质将alpha写入目标缓冲区
不为当前视口调整UV。
不要在视口外采样。
启用在
$magnifycenter
屏幕位置周围放大折射图像,放大比例为$magnifyscale
。放大此屏幕位置周围的折射图像。
放大折射图像的比例因子。
对基底纹理应用简单的视差效果。
视差效果的深度(单位)。
类似于$flow_noise_texture但也会使材质呈现绿色。在"Particle/warp_pool_01.vmt"中可见。
注意事项
- 目前无法定义整体alpha遮罩以指示折射效果的衰减位置。这只适用于基于刷子和模型的几何体,而不适用于粒子。为了在基于刷子或模型的几何体上实现alpha效果,可以创建一个带有alpha通道的法线贴图,并将其定义为第一个
$normalmap
。然后使用另一个法线贴图作为$normalmap2
,$normalmap2
将继承第一个法线贴图的alpha,并相应地起作用。这对于模拟效果(如表面上的滚动水)非常有用,其中第一个法线贴图提供alpha,第二个法线贴图可以沿该alpha移动。 - 如果在模型的某一部分上使用
Refract
,则必须在模型的qc文件中指定$mostlyopaque
参数,并为vmt设置$nowritez "1"
和$model "1"
。 - 此着色器无法与water 的动态反射和sky_camera 正常工作。仅适用于刷子,如果刷子是world geometry 或func_detail 。此错误不会出现在次级摄像头(func_reflective_glass 、func_monitor 和portals )中。
另见
水
- 关于类似着色器的文章 ```