Unity

게임개발용 부하테스트 2024

모카쨩 2024. 2. 27. 10:06

 

 

 

 

-테스트 환경-

CPU : 라이젠 5 1600

메모리 : 32GB 1333Mhz

GPU : RTX 3050 8GB

 

 

 

-사용 코드-

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DrawCallTest : MonoBehaviour
{

    int stopCount = 100;
    public int wantFPS = 60;
    List<GameObject> gameObjects = new List<GameObject>();
    public Renderer renderTarget;
    // Start is called before the first frame update
    void Start()
    {
        renderTarget.gameObject.SetActive(false);
    }
    float preTime = 0;
    // Update is called once per frame
    void Update()
    {
        if (Time.time>3)
        {
            if (stopCount<=0)
            {
                return;
            }
            if (Time.deltaTime > 1f / wantFPS)
            {
                stopCount--;
            }
            else
            {
            }
            stopCount=Mathf.Clamp(stopCount, 0, 10);
            var wid = (int)Mathf.Sqrt(gameObjects.Count+1);
            for (int i = 0; i < 10; i++)
            {
                var instance = Instantiate(renderTarget.gameObject);

                instance.SetActive(true);
                gameObjects.Add(instance);
            }
        }
    }
}

 

 

-사용된 fbx 파일 -

98306.fbx
0.02MB
393218.fbx
0.04MB
1572866.fbx
0.10MB
6291458.fbx
0.35MB

 

언릿쉐이더로 진행

 

 

 

드로우콜 테스트

목표치 60fps일경우 6152

 

 

 

 

목표치 144fps일경우 1112

 

 

 

 

 

 

 

 

 

 

 

 

목표치 60fps일경우 38.3M Tris

 

 

 

 

목표치 144fps일경우 12.3M Tris

 

 

 

2020에 970으로 쟀을때보다 성능이 많이 좋아졌다

 

그리고 3050은 최약체라서 목표치를 60으로 잡으면 충분할것 같다

 

주의점은 위에서 테스트된건 스킨드메쉬가 아니라 메쉬렌더러라서 버텍스 영향을 좀 덜 받으니

버텍스같은 경우에는 5M 초과하지 않도록 여유분을 주자

드로우 콜의 경우에는 내부 CPU 로직이 많으면 떨어지는 경향이 있으니

로직이 복잡한 게임이라면 여유분을 더 크게주고, 결국 어떤 게임을 만드느냐에 따라서도 영향이 있으니까 알아서 판단

 

 

 

 

-그외

텍스처 메모리와 성능과의 연관성

https://wmmu.tistory.com/entry/%ED%85%8D%EC%8A%A4%EC%B2%98-%EB%A9%94%EB%AA%A8%EB%A6%AC%EC%99%80-%EC%84%B1%EB%8A%A5%EA%B3%BC%EC%9D%98-%EC%97%B0%EA%B4%80%EC%84%B1

 

텍스처 메모리와 성능과의 연관성

사용된 코드 using System.Collections; using System.Collections.Generic; using UnityEngine; public class TextureMemoryTest : MonoBehaviour { public Renderer renderTarget; public Texture[] textures; public int max = 800; public bool useTexture = false;

wmmu.tistory.com