为了生成天空盒,全景着色器 (Panoramic Shader) 将单个纹理以球形包裹住场景。
内置渲染管线和通用渲染管线 (URP) 都支持此着色器。
高清渲染管线 (HDRP) 不支持此着色器。
要创建全景天空盒,需要一个使用纬度/经度(圆柱形)贴图的 2D 纹理,如下所示:
要确保纹理为 2D 纹理,请执行以下操作:
为生成最佳的环境光照,纹理应使用高动态范围 (HDR)。
属性 | 描述 |
---|---|
Tint Color | 要将天空盒着色成的颜色。Unity 将这种颜色添加到纹理以更改纹理外观,而无需更改基础纹理文件。 |
Exposure | 调整天空盒的曝光。因此可以校正天空盒纹理中的色调值。较大的值会产生曝光更强、看起来更亮的天空盒。较小的值会产生曝光更弱、看起来更暗的天空盒。 |
Rotation | 天空盒围绕正 y 轴旋转。这会更改天空盒的方向,如果希望天空盒的特定部分位于场景的特定部分后方,则此设置很有用。 |
Spherical (HDR) | 该材质用来以圆形包裹场景以表示天空的纹理。有关如何从输入纹理创建立方体贴图资源的信息,请参阅立方体贴图资源。 |
Mapping | 指定此材质用于投影纹理以创建天空盒的方法。选项包括 6 sided:使用一种网状格式将纹理映射到天空盒。Latitude Longitude Layout:使用圆柱体包裹方法将纹理映射到天空盒。 |
Image Type | 指定此材质将天空盒投影到的角度(围绕 y 轴)。选项包括:180:将球形纹理绘制为半球,尖端沿正 z 轴方向。要更改此材质将纹理绘制到场景的哪一侧,请修改 Rotation 属性。默认情况下,天空盒的背面为黑色,但此材质可以在背面绘制球形纹理的副本。为此,请启用 Mirror on Back。360:将纹理绘制为包裹整个场景的完整球体表示形式。 |
Mirror on Back | 指定材质是否应复制天空盒背面的球形纹理,而不是绘制为黑色。仅当 Image Type 设置为 180 时,此选项才会出现。 |
Render Queue | 确定 Unity 绘制游戏对象的顺序。有关 Render Queue 的更多信息,请参阅 SL-SubShaderTags。 |
Double Sided Global Illumination | 指定光照贴图是否在计算全局光照时考虑几何体的两面。设置为 true 时,如果使用渐进光照贴图,则背面将使用与正面相同的发射和反照率来反射光。 |
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.