본문 바로가기
개발/Unity

Unity) Camera Layer Cull Distance

by 테샤르 2023. 7. 12.

Camera Layer Cull Distance

 

간단하게 말하면 카메라의 거리에 따라 특정 요소를 그리거나 안그리게 처리하는 최적화 기법이다.

Unity 에서는 Layer 단위로 처리를 한다.

 

기본적으로 디테일 한 표현을 하는 중요하지 않는 오브젝트에 사용한다.(장식이나 배경같은 지형물)

 

반응형

< 예시 코드>

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour
{
    void Start()
    {
        Camera camera = GetComponent<Camera>();
        float[] distances = new float[32];
        distances[10] = 15;
        camera.layerCullDistances = distances;
    }
}

 

Unity : Camera Layer Cull Distances : [링크]

 

Unity - Scripting API: Camera.layerCullDistances

Normally Camera skips rendering of objects that are further away than farClipPlane. You can set up some Layers to use smaller culling distances using layerCullDistances. This is very useful to cull small objects early on, if you put them into appropriate l

docs.unity3d.com

화면에 모든것을 그리게되면  다 메모리와 연산이 포함될 수 밖에 없기 때문에

렌더링 과정에 포함되지 않는 방식으로 처리하는게 최적화의 기본이다.

 

 

★☆☆☆☆

 

반응형

댓글