Version: 2021.3
언어: 한국어
렌더 파이프라인 기능 비교
렌더 파이프라인 및 조명 솔루션의 선택과 설정
  • 액티브 렌더 파이프라인을 얻고 설정하고 구성하는 방법

이 페이지에는 Unity가 현재 사용하고 있는 렌더 파이프라인을 얻고, 설정하고, 구성하는 방법에 대한 정보가 포함되어 있습니다. Unity가 현재 사용 중인 렌더 파이프라인은 액티브 렌더 파이프라인이라고 부릅니다.

개요

콘텐츠를 렌더링하기 위해 Unity는 스크립터블 렌더 파이프라인 (SRP)를 기반으로 빌트인 렌더 파이프라인이나 렌더 파이프라인을 사용할 수 있으며 스크립터블 렌더 파이프라인에는 유니버설 렌더 파이프라인(URP)과 고해상도 렌더 파이프라인(HDRP)이 포함되어 있습니다.

Unity가 사용하는 스크립터블 렌더 파이프라인을 지정하려면 렌더 파이프라인 에셋을 사용합니다. 렌더 파이프라인 에셋은 사용할 SRP와 이를 설정하는 방법을 Unity에 알려줍니다. 렌더 파이프라인 에셋을 지정하지 않으면 Unity는 빌트인 렌더 파이프라인을 사용합니다.

설정은 다르지만 동일한 렌더 파이프라인을 사용하는 여러 렌더 파이프라인 에셋을 만들 수 있습니다. 예를 들어 여러 하드웨어 품질 수준에 대해 서로 다른 렌더 파이프라인 에셋을 사용할 수 있습니다. 렌더 파이프라인 에셋에 대한 일반적인 소개는 스크립터블 렌더 파이프라인 소개 를 참조하십시오. URP의 렌더 파이프라인 에셋에 대한 자세한 내용은 유니버설 렌더 파이프라인 에셋을 참조하고 HDRP의 렌더 파이프라인 에셋에 대한 자세한 내용은 고해상도 렌더 파이프라인 에셋을 참조하십시오.

Unity 에디터에서나 런타임 시 액티브 렌더 파이프라인을 변경하자마자 Unity는 새로운 액티브 렌더 파이프라인을 사용하여 콘텐츠를 렌더링합니다. Unity 에디터를 열었다면 여기에는 프로젝트 창과 인스펙터에 머티리얼에 대한 게임 뷰, 씬 뷰, 프리뷰가 포함됩니다.

액티브 렌더 파이프라인을 변경하면 반드시 프로젝트의 에셋과 코드가 새로운 렌더 파이프라인과 호환될 수 있어야 합니다. 그렇지 않으면 오류나 의도치 않은 시각 효과가 발생할 수 있습니다.

액티브 렌더 파이프라인 결정

그래픽스 설정품질 설정 모두에서의 설정은 액티브 렌더 파이프라인을 결정합니다. 그래픽스 설정에서 Unity가 사용하는 렌더 파이프라인을 기본값으로 설정합니다. 품질 설정에서는 특정 품질 수준에 대한 기본 렌더 파이프라인을 오버라이드할 수 있습니다.

기본 렌더 파이프라인을 가져오거나 설정하려면 Graphics Settings > Scriptable Render Pipeline Setting (또는 동등한 API인 GraphicsSettings.defaultRenderPipeline)을 사용합니다. 특정 품질 수준에 대해 기본값을 오버라이드하는 렌더 파이프라인을 가져오거나 설정하려면 Quality Settings > Render Pipeline (또는 동등한 API인 QualitySettings.renderPipeline)을 사용합니다.

Unity는 다음과 같이 액티브 렌더 파이프라인을 결정합니다.

  • 현재 Quality Settings level > Render Pipeline가 렌더 파이프라인 에셋을 참조하는 경우 Unity는 해당 값을 사용합니다.
  • 그 외의 경우:
    • Graphics Settings > Scriptable Render Pipeline Setting이 렌더 파이프라인 에셋을 참조하는 경우 Unity는 해당 값을 사용합니다.
    • 그렇지 않으면 Unity는 빌트인 렌더 파이프라인을 사용합니다.

에디터 UI에서 액티브 렌더 파이프라인을 가져오고 설정하는 방법

액티브 렌더 파이프라인 가져오기

에디터 UI에 액티브 렌더 파이프라인을 가져오려면 반드시 그래픽스 설정과 품질 설정을 모두 확인해야 합니다. 이러한 값을 사용하여 액티브 렌더 파이프라인을 결정하는 방법에 대한 자세한 내용은 액티브 렌더 파이프라인 결정을 참조하십시오.

빌트인 렌더 파이프라인 활성화

액티브 렌더 파이프라인을 빌트인 렌더 파이프라인으로 설정하려면 그래픽스 설정과 품질 설정에서 렌더 파이프라인 에셋을 제거합니다.

이 작업을 수행하는 방법은 다음과 같습니다.

  1. Edit > Project Settings > Quality를 선택합니다.
  2. 각 품질 수준의 경우 렌더 파이프라인 에셋이 Render Pipeline 필드로 할당되어 있으면 할당을 취소합니다.
  3. Edit > Project Settings > Graphics를 선택합니다.
  4. 렌더 파이프라인 에셋이 스크립터블 렌더 파이프라인 설정으로 할당되어 있으면 할당을 취소합니다.

SRP를 기반으로 URP, HDRP, 커스텀 렌더 파이프라인 활성화

SRP를 기반으로 하는 파이프라인으로 액티브 렌더 파이프라인을 설정하려면 기본 액티브 렌더 파이프라인으로 사용할 렌더 파이프라인 에셋을 Unity에 알리고 선택적으로 각 품질 수준에 사용할 렌더 파이프라인 에셋도 Unity에 알립니다.

이 작업을 수행하는 방법은 다음과 같습니다.

  1. 프로젝트 폴더에서 사용하려는 렌더 파이프라인 에셋을 찾을 수 있습니다.
  2. 특정 품질 수준에 대한 오버라이드가 없을 때 Unity가 사용하는 기본 렌더 파이프라인을 설정합니다. 이를 설정하지 않으면 Unity는 오버라이드가 적용되지 않는 경우 빌트인 렌더 파이프라인을 사용합니다.
    1. Edit > Project Settings > Graphics를 선택합니다.
    2. 렌더 파이프라인 에셋을 Scriptable Render Pipeline Setting 필드로 드래그합니다.
  3. 선택 사항: 오버라이드 렌더 파이프라인 에셋을 서로 다른 품질 수준으로 설정합니다.
    1. Edit > Project Settings > Quality를 선택합니다.
    2. 렌더 파이프라인 에셋을 Render Pipeline 필드로 드래그합니다.

액티브 렌더 파이프라인을 가져와서 C# 스크립트로 설정하는 방법

C# 스크립트에서 액티브 렌더 파이프라인을 가져와서 설정하고 액티브 렌더 파이프라인이 변경되면 콜백을 수신할 수 있습니다. Unity 에디터에서 편집 모드나 플레이 모드로 또는 애플리케이션에서 런타임 시 이 작업을 수행할 수 있습니다.

그렇게 하려면 다음 API를 사용하십시오.

다음 예시에서는 이러한 API를 사용하는 방법을 보여줍니다.

using UnityEngine;
using UnityEngine.Rendering;
 
public class ActiveRenderPipelineExample : MonoBehaviour
{
    // In the Inspector, assign a Render Pipeline Asset to each of these fields
    public RenderPipelineAsset defaultRenderPipelineAsset;
    public RenderPipelineAsset overrideRenderPipelineAsset;
 
    void Start()
    {
        GraphicsSettings.defaultRenderPipeline = defaultRenderPipelineAsset;
        QualitySettings.renderPipeline = overrideRenderPipelineAsset;

        DisplayCurrentRenderPipeline();
    }

    void Update()
    {
        // When the user presses the left shift key, switch the default render pipeline
        if (Input.GetKeyDown(KeyCode.LeftShift)) {
            SwitchDefaultRenderPipeline();
            DisplayCurrentRenderPipeline();
        }
        // When the user presses the right shift key, switch the override render pipeline
        else if (Input.GetKeyDown(KeyCode.RightShift)) {
            SwitchOverrideRenderPipeline();
            DisplayCurrentRenderPipeline();
        }
    }

    // Switch the default render pipeline between null,
    // and the render pipeline defined in defaultRenderPipelineAsset
    void SwitchDefaultRenderPipeline()
    {
        if (GraphicsSettings.defaultRenderPipeline == defaultRenderPipelineAsset)
        {
            GraphicsSettings.defaultRenderPipeline = null;
        }
        else
        {
            GraphicsSettings.defaultRenderPipeline = defaultRenderPipelineAsset;
        }
    }

    // Switch the override render pipeline between null,
    // and the render pipeline defined in overrideRenderPipelineAsset
    void SwitchOverrideRenderPipeline()
    {
        if (QualitySettings.renderPipeline == overrideRenderPipelineAsset)
        {
            QualitySettings.renderPipeline = null;
        }
        else
        {
           QualitySettings.renderPipeline = overrideRenderPipelineAsset;
        }
    }

    // Print the current render pipeline information to the console
    void DisplayCurrentRenderPipeline()
    {
        // GraphicsSettings.defaultRenderPipeline determines the default render pipeline
        // If it is null, the default is the Built-in Render Pipeline
        if (GraphicsSettings.defaultRenderPipeline != null)
        {
            Debug.Log("The default render pipeline is defined by " + GraphicsSettings.defaultRenderPipeline.name);
        }
        else
        {
            Debug.Log("The default render pipeline is the Built-in Render Pipeline");
        }

        // QualitySettings.renderPipeline determines the override render pipeline for the current quality level
        // If it is null, no override exists for the current quality level
        if (QualitySettings.renderPipeline != null)
        {
            Debug.Log("The override render pipeline for the current quality level is defined by " + QualitySettings.renderPipeline.name);
        }
        else
        {
            Debug.Log("No override render pipeline exists for the current quality level");
        }

        // If an override render pipeline is defined, Unity uses that
        // Otherwise, it falls back to the default value
        if (QualitySettings.renderPipeline != null)
        {
            Debug.Log("The active render pipeline is the override render pipeline");
        }
        else
        {
            Debug.Log("The active render pipeline is the default render pipeline");
        }

        // To get a reference to the Render Pipeline Asset that defines the active render pipeline,
        // without knowing if it is the default or an override, use GraphicsSettings.currentRenderPipeline
        if (GraphicsSettings.currentRenderPipeline != null)
        {
            Debug.Log("The active render pipeline is defined by " +GraphicsSettings.currentRenderPipeline.name);
        }
        else
        {
            Debug.Log("The active render pipeline is the Built-in Render Pipeline");
        }
    }
}
렌더 파이프라인 기능 비교
렌더 파이프라인 및 조명 솔루션의 선택과 설정
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961