反射探针有三种基本类型,通过检视面板中的 Type 属性可进行相应选择(有关更多详细信息,请参阅组件参考页面)。
下面将详细说明这三种类型。
烘焙反射探针是在 Unity Editor 中捕获反射立方体贴图并存储以供后续在播放器中使用的探针(有关详细信息,请参阅反射探针简介)。捕获过程完成后,反射将被“冻结”,因此烘焙探针无法响应移动对象在场景中引起的运行时变化。但是,与实时探针(能响应变化)相比,烘焙探针的处理开销要低得多,并且在许多用途中是可接受的。例如,如果只有一个移动的反射对象,那么它只需要反射其静态环境。
应将探针的 Type 属性设置为 Baked 或 Custom 以将其用作烘焙探针(请参阅下面的自定义探针提供的其他功能)。
烘焙探针捕获的反射只能包含标记为 Reflection Probe Static 的场景对象(使用检视面板左上角的 Static 菜单标记所有对象)。可以使用 Culling Mask 和 Clipping Planes 属性进一步优化包含在反射立方体贴图中的对象;具体的工作方式与摄像机的工作方式相同(探针本质上类似于通过旋转观察六个立方体贴图面每一面的摄像机)。
当 Auto 选项启用时(从 Lighting 窗口中设置),烘焙反射将在对象放置到场景中时自动更新。如果不使用自动烘焙,则需要单击 Reflection Probe Inspector 中的 Bake 按钮以更新探针。(Lighting 窗口中的 Build 按钮也将触发探针更新。)
无论使用自动烘焙还是手动烘焙,烘焙过程都将继续在 Editor 中工作时异步进行。但是,如果移动任何静态对象、更改其材质或以其他方式改变其视觉外观,则会重新启动烘焙过程。
默认情况下,自定义探针的工作方式与烘焙探针的工作方式相同,但自定义探针还有其他选项可以更改此行为。
自定义探针检视面板上的 Dynamic Objects 属性允许未标记为 Reflection Probe Static 的对象包含在反射立方体贴图中。但是请注意,这些对象的位置在烘焙时仍然会在反射中“冻结”。
Cubemap 属性允许将自定义的立方体贴图分配给探针,从而使探针完全独立于可从其视点“看到”的对象。可以使用此属性来设置从 3D 建模应用程序生成的天空盒或立方体贴图作为反射源。
烘焙探针可用于许多用途,并具有良好的运行时性能,但它们的缺点是不能在播放器中实时更新。这意味着对象可在场景中移动但不能让它们的反射随之移动。如果这种问题带来了太多限制,可以使用实时探针,它们会在运行时更新反射立方体贴图。这种效果会带来更高的处理开销,但可提供更强的真实感。
要使探针在运行时更新,应在反射探针检视面板中将其 Type 属性设置为 Realtime。不需要将对象标记为 Reflection Probe Static 来捕获它们的反射(就像使用烘焙探针一样)。但是,可以使用 Culling Mask 和 Clipping Planes 属性在反射立方体贴图中选择性地排除对象;具体的工作方式与摄像机的工作方式相同(探针本质上类似于通过旋转观察六个立方体贴图面每一面的摄像机)。
In the editor, realtime probes have much the same workflow as baked probes, although they tend to render more quickly.
注意:目前,实时探针仅在 Reflection Probe Static 对象移动或改变其外观时才会更新在 Scene 视图中的反射。这意味着,即使移动的动态对象出现在反射中,这些对象也不会触发更新。应该从 Lighting 窗口的 Build 按钮弹出窗口中选择 Bake Reflection Probes 选项,从而在动态对象改变时更新反射。
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.