在 Unity 中,天空盒是使用天空盒着色器的一种材质。有关可用的天空盒着色器的信息,请参阅天空盒着色器。
功能 | 内置渲染管线 | 通用渲染管线 (URP) | 高清渲染管线 (HDRP) |
---|---|---|---|
天空盒 | 是 (1) | 是 (1) | 否 (2) |
注意:
要创建新的天空盒材质,请执行以下操作:
注意:每个天空盒着色器都有自己的一组必备纹理,这些纹理的数量和格式有所不同。有关特定天空盒着色器所需的纹理的信息,请参阅该天空盒着色器的文档。在天空盒着色器页面上可以找到天空盒着色器及其文档的列表。
创建天空盒材质后,可以在场景中渲染该材质。为此需要执行以下操作:
这样会在场景内每个摄像机的背景中绘制天空盒。如果只想为特定摄像机绘制天空盒,请参阅为特定摄像机绘制天空盒。
创建天空盒材质后,Unity 可将其用于在场景中产生环境光照。为了让 Unity 这样做,请执行此操作:
还可以指定 Unity 更新环境光照的时间。为此,请更改 Ambient Mode。两个值如下:
如果只想在特定摄像机的背景中绘制天空盒,请使用 Skybox 组件。将此组件附加到带有摄像机的游戏对象时,它会覆盖摄像机绘制的天空盒。要附加并设置 Skybox 组件,请执行以下操作:
如果天空盒中包含太阳、月亮或其他光源,请设置一个方向光来指向该光源的相同方向。这就好像天空盒中的光源在场景中产生阴影一样。如果场景中有多个方向光,可以选择天空盒使用的方向光。为此需要执行以下操作:
如果希望场景中有雾,请让雾的颜色与天空盒颜色匹配。这样可以使雾与场景天空的颜色混合。为此需要执行以下操作:
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.