Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

About optimisation for better performance

Discussion in 'Game Design' started by jdidoana4, May 4, 2024.

?

Which one is better for performance

This poll will close on Aug 11, 2024 at 12:35 AM.
  1. First

    100.0%
  2. Second

    0 vote(s)
    0.0%
Multiple votes are allowed.
  1. jdidoana4

    jdidoana4

    Joined:
    Apr 20, 2021
    Posts:
    2
    Can i make a atlas texture for bushes, grass with a shader and use them as detail mesh on the terrain

    OR

    use multipe textures and use them as grass texture
     
  2. POOKSHANK

    POOKSHANK

    Joined:
    Feb 8, 2022
    Posts:
    362
    i would say the first option would likely be better as it would reduce the number of drawcalls, but that's only in cases where you can batch the meshes together or use gpu instancing. if you have a lot of lights, it would be less performant as different lights increase draw calls and can't be batched with other meshes that aren't affected by the exact same lights. now i assume since this is grass/foliage, so most of it will be lit only by the directional light in the scene and this will be a non-issue. note that batching is more likely to occur and is less finicky on the srps.

    i advise you to try out both and see how they perform with your case. if there are a lot of different lights, the atlas can actually be worse in some areas as the shader would have to load in a bigger texture, which would be an unnecessary raise in resolution if it can't be batched.
     
    jdidoana4 and Ryiah like this.
  3. jdidoana4

    jdidoana4

    Joined:
    Apr 20, 2021
    Posts:
    2
    Thank you so much for the reply
    Actually i am making a mobile forest game (no lights , just directional)
    One thing that am worried about is the shader for those bushes/grass !
    I will use a simple bending shader
     
    POOKSHANK likes this.
  4. POOKSHANK

    POOKSHANK

    Joined:
    Feb 8, 2022
    Posts:
    362
    luckily, moving vertices in vertex shader is pretty cheap so with atlas you should have fairly cheap foliage.
     
    jdidoana4 likes this.
  5. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,772
    Its never a good idea to use multiple textures vs an atlas...
     
    jdidoana4 likes this.