Ray tracing and post-processing effects for PC and console games

This is the fifth in a series of articles that explains how developers and technical artists can set up and use the High Definition Render Pipeline (HDRP) in Unity to achieve high-end graphical realism. HDRP represents a technological leap in Unity’s real-time rendering so you can work with light just as it behaves in the real world.

Be sure to read the other articles in our how-to series for high-end lighting:

포스트 프로세싱 오버라이드 인터페이스

포스트 프로세싱 오버라이드

Post-processing

Modern high-end graphics would be incomplete without post-processing. While we can’t always “fix it in post,” it’s difficult to imagine our rendered images without the filters and fullscreen image effects that make them more cinematic. That’s why HDRP comes bundled with its own built-in post-processing effects.

HDRP Post-processing uses the Volume system to apply the image effects to the Camera. Once you know how to add overrides, the process of applying more post-effects should be familiar.

Post-processing Overrides for controlling color and contrast sometimes overlap in functionality. Finding the right combinations might require some trial and error. You won’t need every effect available; just add the necessary overrides to create your desired look and ignore the rest. Refer to Volumes in the Sample Scene for example usage.

ACES와 중립 톤 매핑 비교

ACES와 중립 톤 매핑 비교

Tonemapping

Tonemapping is a technique for mapping high-dynamic-range colors to the more limited dynamic range of your screen. It can enhance the contrast and detail in your renders.

If you want a cinematic look, set the Tonemapping Mode to the industry standard ACES (Academy Color Encoding System). For something less saturated and contrasted, select Neutral. Experienced users also have the option of choosing Custom to define the tonemapping curve for themselves.

그림자, 중간 톤, 하이라이트 컬러 피커

그림자, 중간 톤, 하이라이트

Shadows, Midtones, Highlights

The Shadows, Midtones, Highlights Override controls the tonal and color range for each of the shadows, midtones, and highlights of the render. Activate each trackball to affect the respective part of the image. Then, use the Shadow and Highlight Limits to prevent clipping or pushing the color correction too far.

블룸 오버라이드 인터페이스

블룸 오버라이드

Bloom

Bloom creates the effect of light bleeding around the light source. This conveys the impression that the light source is intensely bright, as though overwhelming the Camera.

Adjust the Intensity and Scatter to alter Bloom size and brightness. Use Threshold to maintain sharpness on dull or non-bright pixels.

Lens Dirt, meanwhile, applies a texture of smudges or dust to diffract the Bloom effect.

뎁스오브필드 오버라이드 인터페이스

뎁스오브필드 오버라이드

Depth of Field

Depth of Field simulates the focus properties of a real camera lens.

Objects close to or further from the Camera’s Focus Distance appear to blur. You can set Focus Distance from:

  • The Volume Override with the Manual Ranges Focus Mode: Here, the Volume itself controls the focus distance. For instance, you can use this to make the Camera intentionally blurry based on location (e.g., underwater scenes).
  • A Cinemachine Camera with the Volume Settings extension: Use this to follow and autofocus on a target.
  • The Physical Camera properties in Physical Camera Focus Mode: Use this to animate the Focus Distance parameter from the Camera component.

When Depth of Field is active, an out-of-focus blur effect called a bokeh can appear around any bright area of the image. Modify the Camera aperture’s shape to change the appearance of the bokeh. See the section on additional Physical Camera parameters from this how-to page on anti-aliasing, volume, and exposure.

For cinematics or offline rendering, you can choose a more expensive but Physically Based Depth of Field to enable additional settings and Custom Quality.

화이트 밸런스 인터페이스

화이트 밸런스

White Balance

The White Balance Override adjusts a scene’s color so that the color white is correctly rendered in the final image. You can push the Temperature to shift between yellow (warmer) and blue (cooler), and the Tint to adjust the color cast between green and magenta.

In the HDRP Sample Scene, the Local Volumes include White Balance Overrides for each room.

컬러 커브 인터페이스

컬러 커브

Color Curves

Use Color Curves to adjust specific ranges in Hue, Saturation, or Luminosity. Select one of the eight available graphs to remap your color and contrast.

색상 조정 슬라이더

색상 조정

Color Adjustments

Use the Color Adjustments options to tweak the overall tone, Hue, Saturation, and Contrast of the final rendered image.

채널 믹서 슬라이더

채널 믹서

Channel Mixer

The Channel Mixer lets one color channel impact the “mix” of another. Select an RGB Output, then adjust its influence. For example, dialing up the Green influence in the Red Output Channel will tint all green areas of the image with a reddish hue.

렌즈 왜곡 데모

렌즈 왜곡 효과는 이미지를 방사상 패턴으로 뒤틉니다.

Lens Distortion

Lens Distortion simulates radial patterns that arise from imperfections in the manufacture of real-world lenses. This results in straight lines appearing slightly bowed or bent, especially with zoom or wide-angle lenses.

비네트(Vignette) 데모

비네트 효과는 프레임의 가장자리를 어둡게 합니다.

Vignette

Vignette imitates an effect from practical photography, where the corners of the image darken and/or desaturate. This effect can occur with wide-angle lenses or result from an appliance (like a lens hood or stacked filter rings) blocking the light. It can also be used to draw the attention of the viewer to the center of the screen.

Motion Blur

Real-world objects appear to streak or blur in a resulting image when they move faster than the Camera exposure time.

Use the Motion Blur Override to simulate that effect. To minimize performance cost, reduce the Sample Count, increase the Minimum Velocity, and decrease the Maximum Velocity. You can also reduce the Camera Clamp Mode parameters under the Additional Properties.

렌즈 플레어 샘플

렌즈 플레어 샘플에는 사실적인 렌즈 효과에서 보다 가상적인 효과까지 다양한 프리셋이 포함됩니다.

Lens Flare

Generally, a lens flare appears when bright light shines onto the lens of a camera. It can take the form of a single bright glare or multiple colored polygonal flares matching the aperture of the camera. In real life, flares have an unwanted effect but can be used for a narrative or artistic purpose. For example, a strong lens flare can grab the attention of the player or change the mood of a setting or scene.

In HDRP, use Lens Flare as a post-processing effect in the later stages of the rendering process.

렌즈 플레어 에셋

해당 요소와 사용 가능한 파라미터가 나와 있는 위 플레어 에셋을 참조하세요. 자신만의 커스텀 플레어 효과 라이브러리를 만들어 게임에 어울리는 분위기를 조성할 수 있습니다.

Lens Flare Asset

The appearance of the flare is indicated in the Flare Asset, but in order to render the effect, you need to add the component Lens Flare (SRP) to an object in Scene view, such as a light source or other object that will generate the flare.

The component controls the general intensity, scale, and occlusion parameters of the effect. It also provides the option to run off-screen when the flare is outside the Camera view (though it should still project some flare effects in the scene, especially if the flare comes from a static source).

To become more familiar with Lens Flares, install the Samples from the Package Manager. This will add a set of predefined Flare Assets and modify the HDRP Sample Scene to include Lens Flare effects. You’ll also find a test scene where you can browse Lens Flares and build your own.

If you select Directional Light Sun in the project, for example, you’ll find the component Lens Flare (SRP) attached to the light, as well as a data asset. Change the asset to observe different flare effects.

Lens Flares are made out of Lens Flare Elements. Each element represents a different artifact that a flare can produce. The shape of the element can be a polygon, circle, or other custom Image. Element parameters enable you to tweak the Color, Transform Position, and Scale.

When attached to a light source, the Flare Elements can leverage Tint to reuse the same Flare Asset with many different light sources.

Watch this presentation to learn more about how Lens Flares work.

렌더링 디버거 인터페이스

렌더링 디버거

Rendering Debugger

The Rendering Debugger window (Window > Analysis > Rendering Debugger) contains debugging and visualization tools specific to the Scriptable Render Pipeline (SRP). The left side is organized by category. Each panel allows you to isolate any issues Lighting, Materials, Volumes, Cameras, and so on.

The Rendering Debugger is also available at runtime under Game view in Play Mode, or in a Player build under Development build. You can open its menu by using Ctrl+Backspace or pressing the two sticks of a game controller.

조명 샘플

조명 디버그 모드나 전체 화면 디버그 모드를 사용하면 씬 내 조명원을 파악할 수 있습니다.

Fullscreen Debug Mode

The Debugger can help you troubleshoot a specific rendering pass. On the Lighting panel, you can enter Fullscreen Debug Mode and choose features to debug.

This mode lets you play “pixel detective” and identify the source of a specific lighting or shading issue. The panels on the left show you how vital statistics from Cameras, Materials, Volumes, and so on, can optimize your render.

With the Fullscreen Debug Mode active, the Scene and Game views switch to a temporary visualization of a specific feature. This can serve as a useful diagnostic.

You can also debug several common Material properties in Material screen > Common Material Properties, including Albedo, Normal, Smoothness, and Specular.

To debug performance, go to the Rendering Debugger window when in Play Mode. There you can access a statistics panel.

See the Debugger documentation for complete details.

렌더 파이프라인 마법사의 레이트레이싱

렌더 파이프라인 마법사에서 레이트레이싱을 활성화합니다.

Ray tracing (Preview)

Ray tracing is a technique that can produce more convincing renders than traditional rasterization. While it has historically been expensive to compute, recent developments in hardware-accelerated ray intersection (or tracing) have now made ray tracing possible for real-time applications.

Ray tracing in HDRP is a hybrid system that still relies on rasterized rendering as a fallback and includes Preview support for ray tracing with a subset of select GPU hardware and the DirectX 12 API. See Getting started with ray tracing for a specific list of system requirements.

To enable ray tracing (in Preview), you need to change the Default graphics API of your HDRP project to DirectX 12. Open the Render Pipeline Wizard (Window > Render Pipeline > HD Render Pipeline Wizard).¹ Click Fix All in the HDRP + DXR tab, then restart the Editor. Follow the Pipeline Wizard prompts to activate any disabled features.

You can also set up ray tracing manually.

Once you enable ray tracing for your project, check that HDRP Global and Camera Frame Settings also have ray tracing activated. Make sure you are using a compatible 64-bit architecture in your Build Settings and validate your scene objects from Edit > Rendering > Check Scene Content for HDRP Ray Tracing.

_____________

¹ In Unity 2021, locate the HDRP Wizard under Window > Rendering > HDRP Wizard.

Screen Space Ambient Occlusion과 레이트레이싱 기반 앰비언트 오클루전 비교

Screen Space Ambient Occlusion과 레이트레이싱 기반 앰비언트 오클루전 비교

Overrides: Ray-Traced Ambient Occlusion

Ray tracing adds some new Volume Overrides and enhances many of the existing ones in HDRP. The following sections detail each override.

Ambient Occlusion

Ray-Traced Ambient Occlusion replaces its screen space counterpart. Unlike Screen Space Ambient Occlusion (SSAO), Ray-Traced Ambient Occlusion allows you to use off-screen geometry to generate the occlusion. This way, the effect does not disappear or become inaccurate toward the edge of the frame.

디버그 모드의 레이트레이싱 광원 클러스터

디버그 모드의 레이트레이싱 광원 클러스터

Light Clusters

HDRP divides your scene into an axis-aligned grid, centered around the Camera. It uses this structure to determine the set of local lights that might contribute to the lighting whenever a ray hits a surface. It can then compute light bounces for certain effects, such as Ray-Traced Reflections and Ray-Traced Global Illumination.

Use the Camera Cluster Range Volume Override to alter the range of this structure and ensure that it encompasses the GameObjects and lights that need to be considered.

You can use an HDRP Debug Mode available via Windows > Analysis > Rendering Debugger > Lighting > Fullscreen Debug Mode. This helps visualize the Light Cluster Cells (highlighted in red), indicating where the light count has reached Maximum Lights per Cell in the HDRP Asset. Adjust this setting to reduce unwanted light leaking and other such artifacts.

레이트레이싱 기반 실시간 전역 조명

레이트레이싱 기반 전역 조명 기능은 실시간으로 반사광을 나타냅니다.

Ray-Traced Global Illumination

Ray-Traced Global Illumination is an alternative to Screen Space Global Illumination (SSGI) and Light Probes used for simulating bounced, indirect lighting. It calculates in real-time, and allows you to avoid the lengthy offline process of baking lightmaps while yielding comparable results.

Use Quality Settings for complex interior environments that benefit from multiple bounces and samples. Performance Mode (limited to one sample and one bounce) works well for exteriors, where the lighting mostly comes from the primary Directional light.

레이트레이싱 기반 반사

레이트레이싱 기반 반사는 매끄러우며 거울과도 같은 표면 내에서 렌더링합니다.

Ray-Traced Reflections

Leverage Ray-Traced Reflections to achieve higher quality reflections compared to reflection probes or Screen Space Reflections. Off-screen meshes appear correctly in the resulting reflections.

Adjust the Minimum Smoothness and Smoothness Fade Start values to modify the threshold at which smooth surfaces start to receive Ray-Traced Reflections. Increase the bounces if necessary (e.g., two mirrors reflecting each other), but keep the performance cost in mind.

레이트레이싱 기반 그림자

레이트레이싱 기반 그림자 기능은 캐스터로부터 점점 확장해 나가면서 부드럽게 처리해 그림자 매핑에 따른 다양한 효과를 구현합니다.

Ray-Traced Shadows

Use Ray-Traced Shadows for Directional, Point, Spot, and Rectangle Area lights. They can replace Shadow Maps from any opaque GameObject. Directional lights can also cast Ray-Traced Shadows from transparent or translucent GameObjects.

Ray tracing produces natural-looking shadows that soften as their distance from the caster increases, like in real life. Directional, Point, and Spot lights can similarly generate semi-transparent shadows.

Additionally, HDRP’s Directional lights generate semi-transparent, colored shadows. In the example, a glass surface casts a precisely tinted shadow on the floor.

More resources

Watch Activate ray tracing with HDRP for a walkthrough of the High Definition Render Pipeline’s ray tracing features in Preview. See the Ray tracing documentation for more information.

Was this content helpful?

Unity에서는 최적의 웹사이트 경험을 제공하기 위해 쿠키를 사용합니다. 자세한 내용은 쿠키 정책 페이지를 참조하세요.

확인