Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question in one game the video card is loaded by 60%, in mine by 100%

Discussion in 'High Definition Render Pipeline' started by y_meny_IJJu3a, Jul 26, 2023.

  1. y_meny_IJJu3a

    y_meny_IJJu3a

    Joined:
    May 14, 2022
    Posts:
    10
    Why do I have an almost empty HDRP project. When I compile and run, the video card is loaded at 100%, and the processor at 50% (ill2cpp).
    In another game that also uses Unity HDRP (eg SCP SL).
    On ultra settings, my video card works up to 60% and the processor up to 20%.
    (I use google translate, don't be surprised if the english is very bad)
     
  2. mgeorgedeveloper

    mgeorgedeveloper

    Joined:
    Jul 10, 2012
    Posts:
    242
    In your first example you are GPU bound, with the CPU idle half the time. You are probably running without v-sync, so of course Unity will attempt to pump out as many frames as possible per second, keeping your GPU busy to the fullest extent.

    In the second example, I guess the game is with v-sync on, so both the GPU and the CPU have some idle time.
     
  3. y_meny_IJJu3a

    y_meny_IJJu3a

    Joined:
    May 14, 2022
    Posts:
    10

    in the first and second examples, v-sync is disabled
     
  4. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,082
    CPUs work differently than GPUs. You have to deliberately write code to work across multiple cores and threads for a CPU. If a game never passes 20% for the CPU while hitting very high (varies depending on the game but usually 90%+) GPU usage it means that the game can only take advantage of 20% of that CPU's cores and threads.

    For CPUs where each core can run more than one thread the core typically takes priority over the thread.
     
    Last edited: Jul 26, 2023
  5. y_meny_IJJu3a

    y_meny_IJJu3a

    Joined:
    May 14, 2022
    Posts:
    10


    I have only two scripts per player and camera rotation in the game

    also on the stage there is a floor from probuilder and a small computer model (it does not have many vertices)
     
  6. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,082
    If you want to know precisely what's happening you need to look at the profiler. Just be aware that the editor adds significant overhead and the numbers won't be as accurate as a build.

    https://docs.unity3d.com/Manual/Profiler.html
     
  7. y_meny_IJJu3a

    y_meny_IJJu3a

    Joined:
    May 14, 2022
    Posts:
    10
    my camera consumes the most, but I turned everything off, turned everything on, etc. nothing changes, the processor and video card are still consumed a lot.

    As I mentioned earlier, I made a build and ran it.
     
  8. Skiriki

    Skiriki

    Joined:
    Aug 30, 2013
    Posts:
    66
    The game that runs at less then 100% on both is likely main/render thread bound. I.e. 1-2 cores run all through the frame and thereby define how often a frame is send for rendering to the GPU (i.e. low frequency enough for it not to be 100% loaded) and how much of the CPU is used (i.e. there are cores that are under utilized, therefore the CPU uses less than 100%.

    Your project on the other hand has next to no CPU work, so it constantly asks the GPU to render the next frame, which takes longer than the CPU does for each frame. This means the GPU is constantly busy and the CPU has to wait for the last GPU frame to finish, further reducing the percentage of CPU usage.

    Comparing different applications by chip usage percentage as surface level performance metrics is a faulty approach for any meaningful comparison. Your app probably pushes out waaaaaay more FPS than the other app, given that it doesn't do anything.

    Use the FrameTimingManager API to get the CPU and GPU timings per frame and you'll likely see that you're GPU bound. Your CPU might be "busy" with the camera but do that at a very high interval that is not realistic for a final game.
     
    Ryiah likes this.