Version: 2023.2
언어: 한국어
밉맵 스트리밍 시스템
Streaming Controller 컴포넌트

밉맵 스트리밍 시스템 API

이 API를 사용하여 밉맵 스트리밍 시스템의 기본 설정을 오버라이드하거나 더 세밀하게 제어할 수 있습니다.

이 페이지는 다음에 관한 정보를 제공합니다.

이 시스템에 대한 일반적인 정보는 밉맵 스트리밍 시스템을 참조하십시오.

개요

API를 사용하여 특정 상황에 대한 동작을 오버라이드할 수 있으며 밉맵 스트리밍 시스템은 기본 설정을 자동으로 관리합니다.

Unity가 특정 텍스처를 완전히 로드해야 하는 경우에 유용합니다. 예를 들어 먼 거리를 빠르게 이동하는 게임 오브젝트와 관련된 경우 또는 즉각적인 카메라 컷을 사용하는 경우가 있습니다.

밉맵 스트리밍 시스템 제어

텍스처에 대해 밉맵 스트리밍을 활성화하고 제어하려면 다음 프로퍼티를 사용하십시오.

Mipmap Streaming automatically reduces the mipmap level of textures until they fit into the Mipmap Streaming Memory Budget. The Texture’s Mip Map Priority number is roughly a mipmap offset for the Memory Budget. For example, with a priority of 2, the Mipmap Streaming system tries to use a mipmap level that is two levels higher than other textures with a priority of 0. Negative values are also valid. If it can’t do this, it uses a lower mipmap level to fit the Memory Budget.

다음 프로퍼티는 런타임 시점에 읽기 전용입니다.

런타임 시점에 발생하는 일을 제어하려면 다음의 정적 프로퍼티를 사용하십시오.

카메라 제어

한 위치에서 다른 위치로 컷할 때 밉맵 스트리밍 시스템은 필요한 텍스처를 Unity에 스트리밍할 시간이 필요합니다. 비활성화된 타겟 카메라 위치에서 사전 로딩을 트리거하려면 타겟 카메라의 Streaming Controller 컴포넌트에 대해 StreamingController.SetPreloading을 호출하십시오. 사전 로딩 단계를 끝낼 타임아웃을 지정할 수도 있습니다. 사전 로딩 단계가 끝날 때 카메라를 자동으로 활성화하려면 스크립트에서 activateCameraOnTimeout 플래그를 true로 설정하십시오. 새로운 위치로 컷한 후 카메라를 비활성화하려면 해당 카메라를 disableCameraCuttingFrom 파라미터로 전달해야 합니다.

void StreamingController.SetPreloading(float timeoutSeconds=0.0f, bool activateCameraOnTimeout=false, Camera disableCameraCuttingFrom=null)

사전 로딩 상태를 취소하거나 쿼리하려면 다음 메서드를 사용하십시오.

밉맵 스트리밍 시스템이 여전히 텍스처를 로드하는지 확인하기 위해 다음 프로퍼티를 쿼리할 수 있습니다.

Note that there is delay between when you enable a Camera and when these properties become a value other than zero. This delay is because the Mipmap Streaming system calculates the required mipmaps using time-sliced processing. For this reason, during a Camera cut you should wait a minimum length of time before the cut. Texture budget and Scene movement can cause continuous Mipmap Streaming, so you also need to set a maximum length of time before the cut.

Loading a specific mipmap level

To override the mipmap level calculation for a specific Texture, use Texture2D.requestedMipmapLevel. This is an exact mipmap level ranging from 0 to the maximum mipmap level of the specific Texture, or the Max Level Reduction value if that is lower. 0 is the highest resolution mipmap.

To check if your requested mipmap level has loaded, use Texture2D.IsRequestedMipmapLevelLoaded.

If you no longer want to override the mipmap level you requested and instead want the system to continue to calculate mipmap levels, use Texture2D.ClearRequestedMipmapLevel to reset the value.

메시에 대한 UV 밀도 근사치를 얻으려면 다음을 사용하십시오.

float Mesh.GetUVDistributionMetric(int uvSetIndex)

UV 배포 지표를 사용하여 카메라의 포지션에 따라 필요한 밉맵 레벨을 계산할 수 있습니다. 예제 코드는 Mesh.GetUVDistributionMetric을 참조하십시오.

To override the system and force all mipmap levels to load, use Texture.streamingTextureForceLoadAll.

디버깅 및 프로파일링

디버그 시각화를 만드는 데 사용할 수 있는 머티리얼 프로퍼티의 텍스처당 스트리밍 정보를 확보하려면 Texture.SetStreamingTextureMaterialDebugProperties를 사용하십시오.

Texture.SetStreamingTextureMaterialDebugProperties]를 사용하여 각 텍스처의 스트리밍 상태 정보를 머티리얼 프로퍼티에 할당할 수 있습니다.그런 다음 셰이더에서 이러한 프로퍼티를 사용하여 디버그 시각화를 생성할 수 있습니다.

이러한 프로퍼티를 사용하여 프로젝트의 밉맵 스트리밍 프로파일링 및 디버깅 툴을 만들 수도 있습니다.

밉맵 스트리밍 시스템이 상호작용하는 렌더러 또는 텍스처 개수에 대한 정보를 확인하려면 다음 프로퍼티를 사용하십시오.

텍스처의 밉맵 레벨에 관한 정보를 확인하려면 다음 프로퍼티를 사용하십시오.

관련 Unity API 메서드

머티리얼에 할당된 텍스처를 가져오거나 설정하려면 다음을 사용하십시오.

머티리얼에 대한 모든 텍스처 프로퍼티를 가져오려면 다음을 사용하십시오.

밉맵 스트리밍 시스템
Streaming Controller 컴포넌트