Search Unity

Performance problem with catlikecoding's compute-shader tutorial

Discussion in 'Community Learning & Teaching' started by TigerLeep, Feb 27, 2022.

  1. TigerLeep

    TigerLeep

    Joined:
    Apr 2, 2013
    Posts:
    2
    I've been running through catlikecoding.com's Basic tutorials. I've been doing fine up until the 5th tutorial on Compute Shaders. I've gotten about half way down the page where it says "When entering play mode we'll now see a single colored unit cube sitting at the origin ... Performance is a lot better than before ..." I'm getting WORSE performance. With the resolution set to 200 (40,000 "point" (cubes) I was getting around 15 FPS with the CPU calculating the Wave function. Now that I've offloaded the points and the Wave function to the GPU, I've dropped down to 6 FPS. GPU is a GeForce GTX 1070 Ti. Not the latest bleed edge video card, but not so old it should be having problems. I'm new to this, so I'm not sure where to look. I double and triple checked my code against catlikecoding's code, and I can't find any mistakes... I'm using Unity 2021.2.13f1, and the tutorial is using 2020.3.6f1; not sure if that could be causing some issues....
     
  2. seireep

    seireep

    Joined:
    Oct 1, 2021
    Posts:
    1
    I've run into the same issue, after restarting my PC the performance runs smooth, however, I can't go further than this in the tutorial. When I set the material to the new GPU one the single cube remain, but this time the shader doesn't even seem to compute and the cube is the infamous pink. I've scrapped my code and restarted once already in case I missed some bit of code, but it doesn't seem like so. Has anyone managed to finish this tutorial series recently?

    Edit : alright, for anyone running into the same issue,, be sure to use the right render pipeline
     
    Last edited: Jun 14, 2022
  3. HIME_HINA

    HIME_HINA

    Joined:
    Aug 9, 2022
    Posts:
    1
    I have the same issue before. But I tried to switch SRP Settings in Graphics to URP, then back onto None. It seems that it solved the problem.
    Edit: I found that the SRP Settings have no effect on performance if the scene has been rendered correctly. You should remove the Graph component instead of disabling it, or set the resolution to a smaller value. Because the Awake function still executes even if you disable the component, then another 40000 cubes still be rendered at the origin, it is hard to find these extra cubes.
     
    Last edited: Aug 10, 2022
  4. unity_141F8636C3AC78763BB5

    unity_141F8636C3AC78763BB5

    Joined:
    Mar 11, 2022
    Posts:
    1
    I had this issue and was trying to find an answer here yesterday, but nothing here worked so sharing my solution for whomever in the future might have the same problem.

    The issue seemed to be in the material shader. You can test it yourself if this is indeed the issue, by simply removing the material from the Point prefab, or by swapping to the URP shader while using BRP or vice versa.
    If this indeed is the problem, then all you have to do is just continue on with the tutorial where you make a new "Point Surface GPU" shader. It should now be all smooth even with a resolution of 200+ (depending on your hardware)