关键词::#post-process
查阅Unity官方文档Post Processing Stack v2 overview可知如下解释:
Post-processing is a generic term for a full-screen image processing effect that occurs after the camera draws the scene but before the scene is rendered on the screen. Post-processing can drastically improve the visuals of your product with little setup time.
后处理是全屏图像处理效果的总称,发生在相机绘制场景之后,场景渲染到屏幕之前。后处理可以在很短的设置时间内显着改善产品的视觉效果。
看完之后,感觉没有看一样。完全没有通俗地说明,因此,请我们的GPT4老师解析一下:
Unity Post Process refers to the application of post-processing effects, which are used to improve the appearance of your game by simulating physical camera and film properties or creating stylized visuals Source 0. These effects can be added using the Post Process Layer component and managed with the help of a Volume framework Source 1.
To enable post-processing in your scene, first add the
Post Process Layercomponent to the Main Camera GameObject. Then, create a dedicated GameObject for each volume and add thePost-process Volumecomponent to it Source 1. You can add post-processing effects to the stack by clicking the "Add effect" button at the bottom of thePost Process Volumecomponent and selecting the desired effect from the drop-down list Source 1.For example, to add a Bloom effect:
- Create a new GameObject and add the
Post-process Volumecomponent to it.- In the
Post-process Volumecomponent, click "Add effect" and select "Unity > Bloom" from the drop-down list.- Configure the Bloom effect properties as desired.
You can also combine multiple effects, such as Bloom and Chromatic Aberration, within the same
Post-process Volumecomponent Source 4.
根据GPT4老师上述的解释,可知后处理就跟影视后期处理差不多,对已渲染的画面进行后期视觉的加强或特效的增添润饰。
因此,在日常的使用后处理中,其主要是为了配合游戏需要,添加适当的特效或色彩调整,从而增添画面的课观赏性。
后处理可分为局部后处理和全局后处理。其主要流程:
- 从Packages Manager 加载 Post Processing依赖包
- 自定义设置Post Processing Layer
- 添加Post-process Layer组件至Camera
- 添加Post-peocess Volumn组件至GameObject
在游戏动漫里,经常会有这样的情节,主人公会碰触了某个特定的机关而进入了一个特定的环境。譬如:《加速世界》中,呼叫**”Burst Link“就会进入蓝色的特定世界;又如《灼眼的夏娜》中,每次紅世之徒**出现,主人公都会被带进 红世领域的特定红色空间。
局部后处理,一般都是为了满足上述说的一些故事设定情节,让主人公触发了某个条件进入了特定领域空间的画面后期处理方法。
关键步骤:
- 下载Post-processing依赖包
为GameObject对象设置Collider的大小,Collider的空间范围即为局部Post-processing生效范围。
关键步骤:
- 为GameObject挂载Collider组件,并勾选为Trigger模式
- 设置Collider的大小
为产生局部Post-processing效果的GameObject对象挂载Post-process Volume组件,并配置Post-processing Profile配置文件。
Post-processing Profile文件 用于存储用户设置的后处理效果及其设置集合的资产。它充当这些效果的容器,可以轻松地在不同的场景和相机中应用、修改和重用它们。
Post-process Volume组件 对于Post-processing Profile文件,是一个控制器开关,通过Post-process Volume 组件用于控制每个本地和全局Post-process Volume组件的优先级和混合。它允许您创建一组效果覆盖以在场景中自动混合后处理设置。对于场景Scene,Post-process Volume组件将其持有的Post-processing Profile文件,按需要实例化效果至场景中。
关键步骤:
- 添加Post-process Volume组件
- 挂载Post-processing Profile文件至Post-process Volume组件中
- Add effect
- 设置自定义的Layer:PostProcessing
当在Post-process Volume组件 上点击New按钮生成Post-processing Profile文件并附加后,便可添加Unity内置的后处理特效。
这里我选择添加Color Grading屏幕效果
后处理(Post-processing)阶段的流程发生在Camera绘制场景之后,场景渲染到屏幕之前应用图像处理效果。
Unity Layer的作用跟Photoshop中的图层的功能一致,将操作对象分配至不同的图层层级:
- 方便实现局部渲染处理
- 便于通过代码,对不同层级对象做物理检测的碰撞
- Layer的顺序,决定了层级对象的顺序,序号越小的越早被渲染
而Post-process Layer组件 的职责就是负责在将后处理(Post-processing)阶段所应用的图像处理效果传递给Camera,告诉Camera如何去图像处理。
关键步骤:
- 将Post-process Layer组件挂载至Camera上
- 设置Layer为自定义的PostProcessing Layer
当将Post-process Volume挂载特定的GameObject上作为局部后处理(Post-Processing)时,此时可以通过设置Post-process Volume上的Is Global为True,将局部触发更改为默认全局效果,不需要Player触碰就能显示后处理效果(Post-Processing)。最后的效果如下:
因为一旦设置Post-process Volume上的Is Global为Ture时,后处理效果就不需要触发Collider就可以全局显示了。因此,在不需要基于触发而显示的后处理效果,可以直接将相关的组件都挂载在Camera上。相关设置如下图所示,
Using Post-Processing to improve visuals in Unity unity_post_processing_example














