유니티 렌더링 패스(rendering paths) - 포워드 렌더링 패스, 디퍼드 렌더링 패스

유니티 렌더링 패스(rendering paths) - 포워드 렌더링 패스, 디퍼드 렌더링 패스

렌더링 패스는 오브젝트의 라이팅과 쉐이딩에 관련한 일련의 작업을 수행하는 방법입니다. 서로 다른 종류의 렌더링 패스는 각각 기능과 성능에서 다른 특성을 가지며 장점과 단점이 있습니다. 유니티의 렌더 파이프라인은 포워드 렌더링 패스(Forward Rendering) , 디퍼드 렌더링 패스(Deferred shading)를 지원합니다. 개발자는 프로젝트 및 플랫폼에 적합한 렌더링 패스를 선택할수있습니다. 

 

렌더링 패스는 기본적으로 프로젝트 설정(project settings)의 그래픽(graphics)에서 설정하며 camera에서 오버라이드할수있습니다. 그래픽카드가 해당 렌더링패스를 지원하지않는다면 유니티는 자동으로 하위 렌더링 패스를 선택합니다.

docs.unity3d.com/Manual/RenderingPaths.html

learn.unity.com/tutorial/understanding-rendering-paths-2019-3#5fab0333edbc2a001f145279

 

Understanding Rendering Paths - Unity Learn

Realtime lights can be expensive to performance due the calculations that have to be done to determine the valid pixel color when there is a light in range. So, when you have a scene with varying amounts of light that need to be rendered, there are two ren

learn.unity.com

 

포워드 렌더링 패스(Forward Rendering)

유니티 렌더 파이프라인은 기본적으로 포워드 렌더링 패스를 사용하도록 설정되어있습니다.  포워드 렌더링은 오브젝트에 영향을 미치는 라이트에 따라 하나 이상의 패스에서 각 오브젝트를 렌더링합니다. 
일반적인 목적 또는 씬에 적은수의 실시간 라이트를 사용하는 경우에 적합한 렌더링 패스로 노멀맵, 넓은 범위의 커스텀 쉐이딩 모델, 투명도, MSAA(multi-sample anti-aliasing)를 지원합니다. 포워드 렌더링에서는 실시간 렌더링의 높은 비용을 상쇄하기 위해 유니티가 렌더링하는 per-pixel 라이트의 개수를 선택할수있습니다. 씬의 나머지 라이트는 낮은 충실도의 per-vertex 또는 per object(SH) 렌더링합니다.



픽셀당 조명(유니티 에디터, 렌더파이프라인 버전에 따라서 상이할수있습니다)

기본적으로 각 오브젝트에 영향을 미치는 몇개의 가장 밝은 라이트가 per-pixel lit 모드로 렌더링됩니다. 그런 다음 최대 4 개의 포인트 라이트가 per-vertex 모드로 렌더링됩니다. 그외의 라이트들은 훨씬 빠르지만 근사치인 SH (Spherical Harmonics)로 계산됩니다. 라이트가 per-pixel, per-vertex, SH이 될수있는 조건은 아래와 같습니다.

렌더모드(render mode)가 important로 설정된 라이트들은 항상 per-pixel이다.
가장 밝은 디렉셔널 라이트(directional light)는 항상 per-pixel이다.
렌더 모드가 not important로 설정된 라이트들은 항상 per-vertex 또는 SH이다.

위의 결과 라이트의 개수가 현재 quality settings에서 설정한 pixel light count의 수치보다 작으면 더 많은 라이트가 per-pixel로 렌더링됩니다.

기본 패스(Base pass)는 1개의 per-pixel 디렉셔널라이트와 모든 per-vertex, SH 라이트를 적용합니다. 그외의 per-vertex 라이트는 각 조명에 대해 하나씩 추가적인 패스로 렌더링됩니다.

docs.unity3d.com/Manual/RenderTech-ForwardRendering.html

https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@17.0/manual/rendering/forward-plus-rendering-path.html

 

디퍼드 렌더링 패스(Deferred shading)

조명과 그림자에 대하여 높은 충실도를 가진 렌더링 패스로 다수의 실시간 라이트를 사용하는 경우에 적합합니다. 디퍼드 렌더링을 사용하면 게임오브젝트에 영향을 미칠 수 있는 조명의 개수에 제한이 없습니다. 모든 조명은 per-pixel로 사용되며 노말맵, 그림자, 쿠키를 가질수있습니다. 디퍼드 셰이딩에서 실시간 조명의 렌더링 오버헤드는 조명에 의해 조명되는 픽셀 수에 비례하며 장면 복잡성에 의존하지 않습니다.


디퍼드 렌더링 패스는 하드웨어가 GPU 및 디퍼드 셰이딩을 지원해야하며 다음과 같은 몇가지 한계를 가지고있습니다.

semi-transparent 오브젝트를 지원하지않으며 해당 오브젝트는 포워드 렌더링 패스로 렌더링됩니다.
orthographic projection를 지원하지않으며 해당 카메라에 대해 포워드 렌더링패스를사용합니다
하드웨어 안트알리어싱을 지원하지않습니다. 
컬링마스크에 대해 일부 지원합니다.

en.wikipedia.org/wiki/Deferred_shading

docs.unity3d.com/Manual/RenderTech-DeferredShading.html

https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@17.0/manual/rendering/deferred-rendering-path.html

 

 

두가지 렌더링 패스

gamedevelopment.tutsplus.com/articles/forward-rendering-vs-deferred-rendering--gamedev-12342

 

Forward Rendering vs. Deferred Rendering | Envato Tuts+

If you're a developer of 3D games, then you've probably come across the terms forward rendering and deferred rendering in your research of modern graphics engines. And, often, you'll have to...

gamedevelopment.tutsplus.com

 

렌더링 패스의 특징과 성능 비교

docs.unity3d.com/Manual/RenderingPaths.html

 

Unity - Manual: Rendering paths in the Built-in Render Pipeline

Rendering paths in the Built-in Render Pipeline Unity’s Built-In Render PipelineA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More infoSe

docs.unity3d.com

 

HDRP와 렌더링 패스
https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@14.0/manual/Forward-And-Deferred-Rendering.html

 

Forward and Deferred rendering | High Definition RP | 14.0.8

Forward and Deferred rendering The High Definition Render Pipeline (HDRP) allows you to render Lit Materials using either Forward or Deferred rendering. You can configure your Unity Project to only use one of these modes, or allow it to use both and switch

docs.unity3d.com

 

댓글

Designed by JB FACTORY