Get it on Google Play


Wm뮤 :: Wm뮤

블로그 이미지
가끔 그림그리거나 3D모델링하거나
취미로 로봇만드는
퇴직한 전자과 게임프로그래머
2020.3.48f1 , 2022.3.6f1 주로 사용
모카쨩
@Ahzkwid

Recent Comment

Archive


2024. 2. 27. 10:06 Unity

 

 

 

 

-테스트 환경-

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

 

 

 

 

 

 

 

'Unity' 카테고리의 다른 글

유니티 네임스페이스 폴더  (0) 2024.04.16
텍스처 메모리와 성능과의 연관성  (0) 2024.02.27
유니티 모델 임포트 에러  (0) 2024.02.24
posted by 모카쨩
2024. 2. 27. 09:09 Unity

 

 

 

 

 

 

사용된 코드 

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;
    // Start is called before the first frame update
    void Start()
    {

        var wid = (int)Mathf.Sqrt(textures.Length);
        var i = 0;
        foreach (var texture in textures)
        {
            var instance = Instantiate(renderTarget.gameObject);
            if (useTexture)
            {
                instance.GetComponent<Renderer>().material.SetTexture("_MainTex", texture);
            }
            var x = i % wid;
            var y = i / wid;
            instance.transform.position = new Vector3(x * 0.5f, y * 0.5f, i * 0.01f);

            i++;
            if (i>max)
            {
                return;
            }
        }
        renderTarget.gameObject.SetActive(false);

    }

}

 

 

 

-테스트 환경-

CPU : 라이젠 5 1600

메모리 : 32GB 1333Mhz

GPU : RTX 3050 8GB

 

사용된 텍스처 메모리는 14GB

 

있긴 있는데 무시해도 될정도로 작다

밉맵에 걸려서 그런지 드라이버 단에서 로드를 막는건지

텍스처 메모리는 그래픽 카드 메모리를 2배나 됨에도 불구하고

문제가 전혀 발생하지 않는다

처리량이 최소인 언릿에서도 별 차이 없는데

라이트 처리가 들어가는 스탠다드나 툰쉐이더등에서는 차이가 더 적을것이다

오히려 저 많은 텍스처들을 띄우느라 드로우콜이 엄청나게 늘어나는 바람에 

일부러 바보같이 프래그단에서 tex2D함수를 수십번씩 호출하거나 밉맵 다 끄고 쓰거나 하지 않는이상이야

일반적인 상황에서는 버텍스와 드로우콜, 쉐이더만 신경 쓰면 될것이다

 

 

게임개발자는 다들 이론적으로는 알고있어서 아무래도 좋을 이야기지만

vrchat에서 논란이 되길래 테스트 해봄

 

이렇게 복잡하게 생각할 필요없이 그렇게 중요한 요소였으면

유니티측에서 Stats탭에 드로우콜과 함께 텍스처 메모리도 같이 표시해줬을것이다(...)

 

 

 

 

 

 

'Unity' 카테고리의 다른 글

게임개발용 부하테스트 2024  (0) 2024.02.27
유니티 모델 임포트 에러  (0) 2024.02.24
매트캡 생성하기  (0) 2024.01.18
posted by 모카쨩
2024. 2. 26. 17:52 서브스탠스 페인터

 

 

 

 

해당 버튼 눌러서 PSD로 뽑을수 있다

 

 

내보낸건 좋은데 색감이 다 빠지는 거지같은 문제가 생긴다

 

 

 

 

주의할점은 또 이렇게 하면 기존색이 다 개박살 난다

정말 필요하다면 파트별로 한장씩 텍스처를 구워서 내보내는수밖에...

posted by 모카쨩
2024. 2. 25. 07:38 서브스탠스 페인터

 

 

 

노말레이어 기본값은 NMdt인데 Normal로 변경하여 사용하면 된다

 

 

 

 

적용된 모습

posted by 모카쨩

  • total
  • today
  • yesterday

Recent Post

저사양 유저용 블로그 진입