Unity 렌더 파이프라인 가이드

이 문서는 Unity에서 액티브 렌더 파이프라인을 얻고 설정하고 구성하는 방법에 대해 설명합니다. Unity의 렌더링 시스템을 이해하고 다양한 렌더 파이프라인을 활용하는 데 유용한 정보를 제공합니다.

개요

Unity는 콘텐츠를 렌더링하기 위해 스크립터블 렌더 파이프라인(SRP)을 사용합니다. SRP에는 유니버설 렌더 파이프라인(URP)고해상도 렌더 파이프라인(HDRP)이 포함됩니다. Unity가 사용하는 렌더 파이프라인 에셋을 지정하지 않으면 기본적으로 빌트인 렌더 파이프라인이 사용됩니다.

렌더 파이프라인 에셋을 선택적으로 생성하여 다양한 설정을 구성할 수 있으며, 이는 하드웨어 품질 레벨에 따라 달라질 수 있습니다.

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

Unity는 다음 기준에 따라 액티브 렌더 파이프라인을 결정합니다:

단계 설명
1 현재 품질 설정에서 Render Pipeline이 참조하는 에셋 사용
2 그렇지 않으면 그래픽스 설정에서 Scriptable Render Pipeline Setting을 참조
3 둘 다 참조하지 않으면 빌트인 렌더 파이프라인 사용

사용자 인터페이스에서 액티브 렌더 파이프라인 설정 방법

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

  1. Edit > Project Settings > Quality를 선택합니다.
  2. 각 품질 수준에서 Render Pipeline 필드의 할당을 취소합니다.
  3. Edit > Project Settings > Graphics로 이동하여, Scriptable Render Pipeline Setting의 할당을 취소합니다.

SRP를 기반으로 하는 렌더 파이프라인 활성화

  1. 사용하려는 렌더 파이프라인 에셋을 프로젝트 폴더에서 찾습니다.
  2. Edit > Project Settings > Graphics를 선택하고, Scriptable Render Pipeline Setting 필드로 드래그합니다.
  3. 선택적으로 각 품질 수준에 대한 오버라이드를 설정합니다.

C# 스크립트를 통해 액티브 렌더 파이프라인 설정

C# 스크립트를 사용하여 액티브 렌더 파이프라인을 가져오고 설정하는 방법을 보여줍니다. 아래는 샘플 코드입니다:

using UnityEngine;
using UnityEngine.Rendering;

public class ActiveRenderPipelineExample : MonoBehaviour
{
    public RenderPipelineAsset defaultRenderPipelineAsset;
    public RenderPipelineAsset overrideRenderPipelineAsset;

    void Start()
    {
        GraphicsSettings.defaultRenderPipeline = defaultRenderPipelineAsset;
        QualitySettings.renderPipeline = overrideRenderPipelineAsset;

        DisplayCurrentRenderPipeline();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.LeftShift)) {
            SwitchDefaultRenderPipeline();
            DisplayCurrentRenderPipeline();
        }
        else if (Input.GetKeyDown(KeyCode.RightShift)) {
            SwitchOverrideRenderPipeline();
            DisplayCurrentRenderPipeline();
        }
    }

    void SwitchDefaultRenderPipeline()
    {
        if (GraphicsSettings.defaultRenderPipeline == defaultRenderPipelineAsset)
        {
            GraphicsSettings.defaultRenderPipeline = null;
        }
        else
        {
            GraphicsSettings.defaultRenderPipeline = defaultRenderPipelineAsset;
        }
    }

    void SwitchOverrideRenderPipeline()
    {
        if (QualitySettings.renderPipeline == overrideRenderPipelineAsset)
        {
            QualitySettings.renderPipeline = null;
        }
        else
        {
           QualitySettings.renderPipeline = overrideRenderPipelineAsset;
        }
    }

    void DisplayCurrentRenderPipeline()
    {
        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");
        }

        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 (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");
        }

        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");
        }
    }
}

마무리

Unity에서 렌더 파이프라인을 설정하는 방법에 대한 이 가이드를 통해 보다 효과적으로 렌더링 과정을 이해하고 제어할 수 있습니다. 다양한 렌더 파이프라인을 활용하여 프로젝트의 그래픽 품질을 개선하세요.

Read more

Unity 매뉴얼 스크립팅 API 해설

이 문서는 Unity의 매뉴얼 스크립팅 API에 대한 간단한 해설과 활용 예제들을 포함하고 있습니다. Unity는 게임 개발 플랫폼으로, 스크립팅 API를 통해 게임의 다양한 기능을 제어하고 수정할 수 있습니다. 버전 Unity 스크립팅 API는 여러 버전으로 제공됩니다. 주의 깊게 선택하여 사용하는 것이 중요합니다. 버전 설명 2023.2 최신 기능 및 버그 수정이 추가됨

By 이재협/실장/시스템개발실/PHYSIA

Unity 매뉴얼 스크립팅 API 설명서 해설

이 문서는 Unity의 매뉴얼 스크립팅 API에 대한 정보를 제공하며, 버전에 따라 다르게 적용되는 내용들을 설명합니다. 본 문서에서는 주요 내용을 간단히 정리하고 활용 가능 예제를 통해 이해를 돕겠습니다. 기본 개념 Unity에서 스크립팅 API는 게임 오브젝트와 그들의 동작을 제어하기 위한 강력한 도구입니다. 이를 통해 게임의 로직, 물리 엔진, 애니메이션 및 사용자 인터페이스를

By 이재협/실장/시스템개발실/PHYSIA

Unity 스크립팅 API 가이드

이 문서는 Unity의 스크립팅 API에 대해 설명합니다. Unity는 게임 개발을 위한 인기 있는 엔진으로, 강력한 스크립팅 기능을 제공합니다. 이 가이드는 Unity에서 스크립트를 작성하고 사용하는 방법을 이해하는 데 도움을 드립니다. 목차 * Unity 스크립팅 소개 * 기본 스크립트 생성 * 스크립트 사용 예제 * 응용 프로그램 * 참고 자료 Unity 스크립팅 소개 Unity는 C# 프로그래밍 언어를

By 이재협/실장/시스템개발실/PHYSIA