ShaderLab syntax: Fog
Fog parameters are controlled with Fog command.
Fog 命令控制雾化参数
Fogging blends the color of the generated pixels down towards a constant color based on distance from camera. Fogging does not modify a blended pixel's alpha value, only its RGB components.
雾化混合产生像素的颜色是依据于常量颜色(这个常量颜色是基于摄像头的距离的)。雾化不会改变像素的alpha值,仅仅是改变它的rgb分量。
指导:雾化是一种模拟自然界中雾气对场景物体视觉效果产生影响的图形绘制技术。此技术从视点到物体逐渐将物体的绘制颜色淡化,直至背景色。通过雾化处理可较好的表现出物体到视点的距离感。(根据物体距离视点的远近对其进行恰当的模糊处理)
Syntax
- Fog { Fog Commands }
-
Specify fog commands inside curly braces.
在大括号内指定fog命令
Mode Off | Global | Linear | Exp | Exp2
Defines fog mode. Default is global, which translates to Off or Exp2 depending whether fog is turned on in Render Settings.
定义个fog模式,默认的是全局,它转换为关闭或EXP2取决于是否打开渲染设置中的雾。
指导:Linear | Exp | Exp2 对应OpenGL中的GL_LINEAR(线性)、GL_EXP(指数)和GL_EXP2(指数平方)
- Color ColorValue
- Sets fog color.
- 设置雾的颜色
- Density FloatValue
-
Sets density for exponential fog.
设置雾的强度 -
- Range FloatValue , FloatValue
-
Sets near & far range for linear fog.
设置线性雾的最近和最远值
Details详情
Default fog settings are based on Render Settings: fog mode is either Exp2 or Off; density & color taken from settings as well.
默认的雾的设置时基于渲染设置:雾的模式是Exp2或者off;强度和颜色也是从设置中获取
Note that if you use fragment programs, Fog settings of the shader will still be applied. On platforms where there is no fixed function Fog functionality, Unity will patch shaders at runtime to support the requested Fog mode.
请注意,如果您使用片断编程,着色器的雾设置将仍然适用。Unity3d的平台上,那里是没有固定功能雾的功能,Unity3d将在运行时修补着色器请求支持的雾模式。
由www.J2meGame.com原创,转载请说明。