Unity パフォーマンスの最適化 - 消費電力、発熱、消費電力を削減する OnDemandRendering

同社のゲーム プロジェクトでは、携帯電話が非常に熱くなっており、電力消費が速いです。当面の間、他の芸術的および技術的な最適化を行うことができない状況下で、この社内文書を作成して実験を行いました. 本日公開します. 皆様のお役に立てば幸いです.

--公式文書:

Unity - スクリプト API: OnDemandRendering

--Youtube解説:

https://www.youtube.com/watch?v=RYgWn6jbteY

YouTube での極端な実験結果:

 

では、レンダリング フレーム レートを 60 から約 12 に動的に下げることで、携帯電話の消費電力がどれだけ削減されるか、温度を下げることができるかどうかを実験してみましょう。

最初のテスト:

次のコードをシーン内の任意のゲーム本体にぶら下げ、レンダリング フレーム レートを 60 に設定します。

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


public class Change_Frame : MonoBehaviour
{

    // 目标帧率
    public int FrameRate = 60;


    // Start is called before the first frame update
    void Start()
    {
        //QualitySettings.vSyncCount = 0;
        Application.targetFrameRate = FrameRate;
        // 降低帧率
        // If there isn't any input then we can go back to 12 FPS (every 5 frames).
        // OnDemandRendering.renderFrameInterval = 5;
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

テストを開始します。携帯電話の電力は 78% で、テスト開始時間の 8:27 は次のとおりです。

 テストを終了します。電話の電力は 72% で、テスト終了時刻の 8:42 は次のとおりです。

 最初のテストの結論:

テスト時間: 15 分、消費電力 6%、電話は明らかに熱く、わずかに熱く、40 度以上でなければなりません。

2 番目のテスト:

実際、コードを変更して、OnDemandRendering.renderFrameInterval = 5; のコメントを外し、レンダリング フレーム レートを 12 に設定します。

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


public class Change_Frame : MonoBehaviour
{

    // 目标帧率
    public int FrameRate = 60;


    // Start is called before the first frame update
    void Start()
    {
        //QualitySettings.vSyncCount = 0;
        Application.targetFrameRate = FrameRate;
        // 降低帧率
        // If there isn't any input then we can go back to 12 FPS (every 5 frames).
        OnDemandRendering.renderFrameInterval = 5;
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

テストを開始し、携帯電話のバッテリー残量は 71% で、テスト開始時刻の 9:00 は次のとおりです。

テストを終了します。電話の電力は 72% で、テスト終了時刻の 8:42 は次のとおりです。

 2 番目のテストの結論:

テスト時間: 15 分、消費電力 3%、電話機はあまり熱くならず、室温程度に感じます。要するに、36 度未満である必要があります。

 

 結論は:

OnDemandRendering を使用して、レンダリング フレーム レートを動的に調整します。レンダリング フレーム レートの低下は、消費電力、消費電力、および発熱に間違いなくプラスの影響を与えます。

もう 1 つ、実際には、アダプティブ パフォーマンス ソリューションは、私の個人的な理解では、温度や消費電力などのハードウェアの状態を感知し、レンダリング フレーム レートと LOD レベルを調整してダイナミック バランスを達成することでもあります。機能と消費電力の間。非常に印象的なパフォーマンスと低消費電力を実現するのは、Samsung プロジェクトです。

おすすめ

転載: blog.csdn.net/chenggong2dm/article/details/125106939