通过 Fog 命令控制 Fog 参数。
雾化效果根据与摄像机的距离将所生成像素的颜色向下混合为恒定颜色。雾化不会修改混合后像素的 Alpha 值,而只是修改其 RGB 分量。
Fog {Fog 命令}
在花括号中指定 Fog 命令。
Mode Off | Global | Linear | Exp | Exp2
定义雾模式。默认值是 Global,可转换为 Off 或 Exp2,具体取决于是否在渲染设置 (Render Settings) 中开启了雾效。
Color ColorValue
设置雾效颜色。
Density FloatValue
设置指数雾效的强度。
Range FloatValue, FloatValue
设置线性雾效的远近范围。
默认雾效设置基于 Lighting 窗口中的设置:雾模式为 Exp2 还是 __Off__;强度和颜色也是获取自这些设置。
请注意,如果使用片元程序,则仍将应用着色器的雾效设置。如果平台上不存在固定函数雾效功能,Unity 将在运行时修补着色器,以支持请求的雾模式。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.