天天看点

Post-processing overview 后期处理概述 后期处理系列1Post-processing overview 后期处理概述

Post-processing overview 后期处理概述

本文档主要是对Unity官方手册的个人理解与总结(其实以翻译记录为主:>)

仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。

文章中涉及到的操作都是基于Unity2018.3版本

参考链接:https://docs.unity3d.com/Manual/PostProcessingOverview.html

Post-processing is the process of applying full-screen filters and effects to a camera’s image buffer before it is displayed to screen. It can drastically improve the visuals of your product with little setup time.

后期处理(后处理)是将全屏滤镜和效果应用到相机的图像缓冲区,然后再显示到屏幕上的过程。它可以大大改善视觉效果,只要很少的设置时间。

You can use post-processing effects to simulate physical camera and film properties; for example; Bloom, Depth of Field, Chromatic Aberration or Color Grading.

您可以使用后处理效果来模拟物理相机和胶片的属性;例如;辉光(Bloom)、景深(Depth of Field)、色差(Chromatic Aberration)或颜色分级(Color Grading)。

Using post-processing

To use post-processing in your project you can import Unity’s post-processing stack. You can also write your own post-processing effects. See Writing post-processing effects for details.

要在你的项目中使用后处理,你可以导入Unity的后处理栈。您还可以编写自己的后处理效果。详见后处理效果。

The images below demonstrate a Scene with and without post-processing.

下面的图片展示了一个有和没有后处理的场景。

Post-processing overview 后期处理概述 后期处理系列1Post-processing overview 后期处理概述

Scene with post-processing

Post-processing overview 后期处理概述 后期处理系列1Post-processing overview 后期处理概述

Scene with no post-processing

Post-processing stack 后期处理栈

The post-processing stack is an über effect that combines a complete set of effects into a single post-processing pipeline. This has a few advantages:

后处理堆栈是一种超级效果,它将一组完整的效果组合到单个后处理管线中。这有几个优点:

  • Effects are always configured in the correct order 效果总是按照正确的顺序配置
  • It allows a combination of many effects into a single pass 它允许多个效果组合成一个pass
  • All effects are grouped together in the UI for a better user experience 为了更好的用户体验,所有效果都在一个UI界面中

The post-processing stack also includes a collection of monitors and debug views to help you set up your effects correctly and debug problems in the output.

后处理堆栈还包括一组监视器和调试视图,以帮助您正确设置效果并调试输出中的问题。

To use post-processing, download the post-processing stack from the Asset Store.

要使用后处理,请从资产存储中下载后处理堆栈。

Post-processing overview 后期处理概述 后期处理系列1Post-processing overview 后期处理概述

Post-processing stack

Setting up the post-processing stack 设置后处理堆栈

For optimal post-processing results it is recommended that you work in the Linear color-space with HDR enabled. Using the deferred rendering path is also recommended (as required for some effects, such as Screen Space Reflection).

为了获得最佳的后处理结果,建议您在启用HDR和线性颜色空间中工作。还建议使用延迟渲染路径(根据某些效果的需要,如屏幕空间反射)。

First you need to add the Post Processing Behaviour script to your camera. You can do that by selecting your camera and use one of the following ways:

首先,您需要将后处理行为脚本添加到相机中。你可以选择你的相机,并使用以下方法之一:

  • Drag the PostProcessingBehaviour.cs script from the project window to the camera.
  • Use the menu Component > Effects > Post Processing Behaviour.
  • Use the Add Component button in the Inspector.
    Post-processing overview 后期处理概述 后期处理系列1Post-processing overview 后期处理概述
    Adding a Post-Processing Behaviour script

You will now have a behaviour configured with an empty profile. The next step is to create a custom profile using one of the following ways:

现在您将拥有一个配置为空配置文件的组件脚本。下一步是使用以下方法之一创建自定义配置文件:

  • Right-click in your project window and select Create >Post-Processing Profile.
  • Use the menu Assets > Create > Post-Processing Profile.

This will create a new asset in your project.

这将在您的项目中创建一个新的资产。

Post-Processing Profiles are project assets and can be shared easily between scenes / cameras, as well as between different projects or on the Asset Store. This makes creating presets easier (ie. high quality preset for desktop or lower settings for mobile).

后处理配置文件是项目资产,可以在场景/摄像机之间、不同项目之间或资产存储上轻松共享。这使得创建预设更容易(高质量的预设为桌面或较低的设置为移动)。

Selecting a profile will show the inspector window for editing the profile settings.

选择文件将显示在用于编辑文件设置的inspector窗口。

Post-processing overview 后期处理概述 后期处理系列1Post-processing overview 后期处理概述

Newly created post-processing profile

To assign the profile to the behaviour you can drag it from the project panel to the component or use the object selector in the inspector.

要将概要文件赋值给组件,您可以将其从项目面板拖到组件,或者使用检查器中的对象选择器。

Post-processing overview 后期处理概述 后期处理系列1Post-processing overview 后期处理概述

Post-processing profile assigned to the Behaviour script

With the profile selected, you can use the checkbox on each effect in the inspector to enable or disable individual effects. You’ll find more information about each effect in their individual documentation pages.

选中概要文件后,可以在检查器中的每个效果上使用复选框来启用或禁用各个效果。您将在它们各自的文档页面中找到关于每种效果的更多信息。

Post-processing overview 后期处理概述 后期处理系列1Post-processing overview 后期处理概述

Bloom effect enabled

继续阅读