Search Unity

NPOT vs POT nowadays, performance?

Discussion in 'General Graphics' started by levelappstudios, Jan 27, 2020.

  1. levelappstudios

    levelappstudios

    Joined:
    Nov 7, 2017
    Posts:
    104
    Hello guys,

    First of all, sorry for my English.

    We are using some postpro effects in our game, so we need to draw some Render Textures. The pipeline is:

    • Draw Color to a full screen RT (same size as screen)
    • Draw Depth to a full screen RT (same size as screen)
    • Draw 2 passes Blur to a pair of 1/4 screen RT
    • Draw the final result to the frame buffer using the Color RT, the Depth RT and the Blur RT as input
    My doubts are about performance. Actually we are creating the RTs using the Screen Size ratio, so RTs are not NPOT. Is there any penalty on performance nowadays? Do you recommend using POT instead?

    I'm aware of NPOT problems with compression storage, but they are Render Textures so there is no penalty on this.

    We are targeting mid to high mobile devices.

    Thanks in advance.
     
  2. lloydv

    lloydv

    Joined:
    Sep 15, 2015
    Posts:
    55
    Hi, timely to find your post, since I have a mobile project that uses render textures extensively and I'm working on performance tuning because I'm getting awful framerates on my Huawei test device. (Performance on iOS is perfect at this point)

    In fact, even a single render texture that fills about half the screen has a huge performance hit. The biggest bottleneck seems to be not the rendering itself but loading the texture onto the gpu, in other words texture (byte) size.

    I got a pretty good performance boost switching to ARGB32 from ARGBHalf, which doesn't seem to affect the visual quality on my Android test device. (iOS on the other hand does require more precision for clean rendering so I've got a switch in my code now to use different formats per platform)

    Also, when you create a render texture you can specify the number of bits to use for depth. Setting that to 0 or as low as possible got me another performance boost.

    I plan to test POT vs NPOT tomorrow and will let you know what result I get. If you have any tips for optimizing render textures please let me know too!
     
    levelappstudios likes this.
  3. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,411
    levelappstudios likes this.
  4. levelappstudios

    levelappstudios

    Joined:
    Nov 7, 2017
    Posts:
    104
    Nice tips, thanks for sharing! I will try that half precision RT, looks a good boost performance. Please let me know about NPOT vs POT experiment, thanks a lot!!
     
  5. levelappstudios

    levelappstudios

    Joined:
    Nov 7, 2017
    Posts:
    104
  6. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,014
    @levelappstudios You shouldn't have any performance hits from using NPOT render textures.
    The easies way to boost performance on mobile devices is to reduce memory traffic - going with a lower resolution RTs and/or smaller pixel formats, like @lloydv said.
     
    met5678 and levelappstudios like this.
  7. levelappstudios

    levelappstudios

    Joined:
    Nov 7, 2017
    Posts:
    104
    Thank you! I will be using NPOT then :)