스크린에 지오메트리를 드로우하기 위해 Unity는 그래픽스 API에 드로우 콜을 실행합니다. 드로우 콜은 그래픽스 API가 그릴 내용과 그릴 방법을 알려줍니다. 각 드로우 콜에는 텍스처, 셰이더, 버퍼에 대한 정보와 같이 그래픽스 API가 스크린에 그려야할 모든 정보가 포함되어 있습니다. 드로우 콜은 리소스를 많이 소모하지만 간혹 드로우 콜 자체보다 드로우 콜에 대한 준비가 더 많은 리소스를 소모하기도 합니다.
드로우 콜을 준비하려면 CPU는 리소스를 설정하고 GPU에 대한 내부 설정을 변경합니다. 이러한 설정을 전체적으로 렌더 상태라고 부릅니다. 다른 머티리얼로 전환하는 것과 같이 렌더 상태를 변경하는 것은 그래픽스 API가 수행하는 작업 중 리소스 소모가 가장 큰 작업입니다.
렌더 상태 변경에 리소스가 많이 소모되기 때문에 이를 최적화하는 것이 중요합니다. 렌더 상태 변경을 최적화하는 주요 방법은 수를 줄이는 것입니다. 다음의 두 가지 방법으로 렌더 상태 변경 수를 줄일 수 있습니다.
드로우 콜과 렌더 상태 변경을 최적화하면 애플리케이션에 많은 이점이 생깁니다. 주로 프레임 횟수를 향상시키지만 또한 다음의 이점도 발생합니다.
드로우 콜과 렌더 상태 변경을 최적화하기 위해 Unity에서 사용할 수 있는 몇 가지 메서드가 있습니다. 일부 메서드는 다른 메서드보다 특정 씬에 더욱 적합합니다. 다음은 Unity에서 사용할 수 있는 메서드입니다.
position
과 normal
이 있습니다.동일한 씬에서 여러 드로우 콜 최적화 메서드를 사용할 수 있지만 Unity는 특정 순서로 드로우 콜 최적화 메서드의 우선 순위를 지정합니다. 두 개 이상의 드로우 콜 최적화 메서드를 사용하도록 게임 오브젝트를 표시하면 Unity는 가장 높은 우선 순위 메서드를 사용합니다. 이에 대한 유일한 예외는 SRP 배처입니다. SRP 배처를 사용할 때 Unity는 SRP 배처와 호환되는 게임 오브젝트에 대한 정적 배칭도 지원합니다. Unity는 다음 순서로 드로우 콜 최적화의 우선 순위를 지정합니다.
정적 배칭을 위해 게임 오브젝트를 표시하고 Unity가 성공적으로 배치하면 렌더러가 인스턴싱 셰이더를 사용하더라도 해당 게임 오브젝트에 대해 GPU 인스턴스싱을 비활성화합니다. 이 경우 인스펙터 창에 정적 배칭을 비활성화하라는 경고 메시지가 표시됩니다. 마찬가지로 Unity가 메시에 GPU 인스턴싱을 사용할 수 있는 경우 해당 메시에 대한 동적 배칭을 비활성화합니다.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.