Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Custom URP shader optimization

Discussion in 'Shaders' started by STUDIOCRAFTapps, Feb 26, 2021.

  1. STUDIOCRAFTapps

    STUDIOCRAFTapps

    Joined:
    Feb 4, 2015
    Posts:
    122
    I've managed to clean up my shader graph shaders that were converted to code a few months back, but now I'm struggling with optimizing them. My goal is to make sure my game run at >60fps/16ms, and right now It's currently GPU bound, with a 40fps/25ms total time.

    My terrain is composed of multiple marching cube meshes with all the same material/shader: A triplanar shader with normal textues.
    The terrain also has on it grass that sway to the wind and that are rendered with Graphics.DrawMeshInstancedIndirect.

    Image


    The current graphics time is: 27ms
    With the terrain+grass is disabled: 15ms

    The shader code for the terrain
    The shader code for the grass

    Now, what should I change to keep the same shadow quality and reach my optimization goal? I'm not quite sure where to start...
     
    Last edited: Feb 26, 2021
unityunity