TECHARTNOMAD | TECHARTFLOWIO.COM

UNITY3D

GetDefaultDepthBufferBits() 메서드

jplee 2025. 6. 4. 22:47
desc.depthBufferBits = (int)CoreUtils.GetDefaultDepthBufferBits();

6.1 에서 이 부분이 추가 되었다.

RenderTextureDescriptor desc;

if (camera.targetTexture == null)
{
    desc = new RenderTextureDescriptor(cameraData.scaledWidth, cameraData.scaledHeight);
    desc.graphicsFormat = MakeRenderTextureGraphicsFormat(isHdrEnabled, requestHDRColorBufferPrecision, needsAlpha);
    desc.depthStencilFormat = SystemInfo.GetGraphicsFormat(DefaultFormat.DepthStencil);
    desc.msaaSamples = msaaSamples;
    desc.sRGB = (QualitySettings.activeColorSpace == ColorSpace.Linear);
}

6.0 까지는 이렇게...

RenderTextureDescriptor desc;

if (camera.targetTexture == null)
{
    desc = new RenderTextureDescriptor(cameraData.scaledWidth, cameraData.scaledHeight);
    desc.graphicsFormat = MakeRenderTextureGraphicsFormat(isHdrEnabled, requestHDRColorBufferPrecision, needsAlpha);
    desc.depthBufferBits = (int)CoreUtils.GetDefaultDepthBufferBits();
    desc.depthStencilFormat = SystemInfo.GetGraphicsFormat(DefaultFormat.DepthStencil);
    desc.msaaSamples = msaaSamples;
    desc.sRGB = (QualitySettings.activeColorSpace == ColorSpace.Linear);
}

6.1 부터는 이렇게...

desc.depthBufferBits = (int)CoreUtils.GetDefaultDepthBufferBits();

 

이렇게 메서드가 추가 되었다.

뭐하는 건가 하니...

대부분의 플랫폼에서 기본값으로 정하고 있는 32비트 int 를 반환 하지만 커스텀 렌더 패스나 렌더 텍스처를 생성할 때, 플랫폼에 관계 없이 적절한 깊이 버퍼 정밀도를 자동으로 설정해서 24비트 int 를 리턴하는 기능을 수행한다.

요롷게 생겼다.

        public static DepthBits GetDefaultDepthBufferBits()
        {
#if UNITY_SWITCH || UNITY_EMBEDDED_LINUX || UNITY_QNX || UNITY_ANDROID
            return DepthBits.Depth24;
#else
            return DepthBits.Depth32;
#endif
        }

 

'UNITY3D' 카테고리의 다른 글

DirectBRDF_DualLobeSpecular  (1) 2025.06.20
유니티 6.1 인스턴싱 로컬 키워드 추가 리스트.  (0) 2025.06.04
ReflectionProbeAtlas 와 LIGHTMAP_BICUBIC_SAMPLING  (0) 2025.06.04
Sony agx 추가  (0) 2025.06.02
MazeLine ToneMapper Preview  (2) 2025.06.02