Home Unity

Texture Array Performance Issues (Unity)

interpolator
Offline / Send Message
jStins interpolator
I'm working on a scene for the Oculus Go (basically android / mobile specs) and am texturing an interior. I thought I'd try a texture array to save draw calls. I have 3 separate arrays (albedo, normals, MRA) containing 8 textures each. I made a shader that uses a channel mask to separate the materials. It all works fine in the editor (looks as expected, draw call savings as expected), but performance drops from 60 fps to about 30 fps and the GPU is crying on the Oculus Go. I'm guessing the shader used to mask / lerp everything together is too expensive? I checked this against a traditional atlas which works fine, but I'm hoping to save myself from chopping geo / UVs to support tiling. Am I being dumb and missing something in how the array should be used to be more perf friendly?

Replies

  • Noors
    Offline / Send Message
    Noors greentooth
    You should monitor the perf with the Profiler. Never used texture array so i cant say if it the array or your shader or probably both. Try with a mobile shader instead of standard.  I work with the vive and as soon as i'm under 90fps, unity waits for the device and drops to 45fps. So a little extra calculation may divide your fps by 2. Our dev would say to cut the geometry to avoid texture array and complex shader i'm sure.
  • jStins
    Offline / Send Message
    jStins interpolator
    Cool, thanks for the reply @Noors. I will dig in a little more with Unity's profiler, but I'm guessing the cut geometry will ultimately be the most efficient. Shame though as the array is much easier to use with tiling textures. 
  • LTS3D
    Offline / Send Message
    LTS3D polycounter lvl 5
    My hunch is it's probably not the array that's causing the issue itself. I would try gutting shader features before going through the time consuming task of editing your model/geometry. You could always go straight unlit textures, and then see if you're at framerate. If you're good just slowly build up from there. If you're using unlit shaders, and still not at framerate, then you know you have more work to do with the geo. Good luck!
  • jStins
    Offline / Send Message
    jStins interpolator
    Yeah, I'm fairly certain it was the shader complexity. I had 15 lerp nodes to mask albedo, MRA and normals.  :# Just too much for a mobile GPU to handle. I'm hitting frame rate now just using separate materials, but will probably need to use a traditional atlas / cut UVs in the future. 
  • LTS3D
    Offline / Send Message
    LTS3D polycounter lvl 5
    Ya, that'll do it haha. PBR on mobile VR is still pretty expensive. We've done mostly unlit shaders and just baked everything to a single texture. At one point we took a 4k screencap of the Substance Viewport and put that as our unlit diffuse texture. Looks like PBR-shaded but is crazy cheap. Works great if you only have one or a few vantage points. Obviously breaks down and looks flat if you're moving around a lot. Luckily for us, most of our mobile VR experience tend to be from a single or small set of vantage points.
  • jStins
    Offline / Send Message
    jStins interpolator
    Cool, thanks for the Substance tip. And yeah, thankfully our project is from a fixed vantage point so we're able to cheat a fair amount. 
  • LTS3D
    Offline / Send Message
    LTS3D polycounter lvl 5
    Awesome. If you have any other questions lemme know, I've shipped a few mobile VR experiences as an artist, so know quite a bit when it comes to optimization + Unity.
  • Mehran Khan
    Offline / Send Message
    Mehran Khan polycounter lvl 10
    Yup Lerps are generally a big no , specially on the mobile-vr platforms (oculus go/gear).  I personally don't use any blend modes except for add and multiply either, specifically overlay which (and correct me if I am wrong) runs an IF-like check on each fragment.
    There is also little to no point in using the PBR workflow as linear-color-space is not supported on mobile vr platforms.
    So bake everything and use techniques like matcaps,World-position-based gradients and Fresnel .
    Mobile vr is literally like ps2 era shading-tech with more geo and far more pixels :D

  • LTS3D
    Offline / Send Message
    LTS3D polycounter lvl 5
    @Mehran Khan We've done some VR/AR apps internally using Unity, and Linear color space support seems sort of dependent on _which_ mobile platform you're developing for. When porting CocoVR from the Rift to GearVR, Linear color was supported, but the final render target wasn't color corrected to "view-space" Worst case scenario, we had a post process script that converted the render target to look correct to the user. That was about a year ago, unsure if this is fixed now though.
  • jStins
    Offline / Send Message
    jStins interpolator
    @LTS3D I'm pretty sure this is still a problem that depends on which snapdragon processor the device uses as some of the drivers don't support linear color space. 

    https://forums.oculusvr.com/developer/discussion/comment/513403#Comment_513403
  • Mehran Khan
    Offline / Send Message
    Mehran Khan polycounter lvl 10
    I have only worked on Oculus mobile platforms (GO/gear) and both of them have had this issue. I wonder if there is a fix for linear space on the go, is there? we tried once and it did not seem to work so we skipped.
  • LTS3D
    Offline / Send Message
    LTS3D polycounter lvl 5
    https://unity3d.com/unity/beta/2018.3

    Unity 2018.3.0b7 release notes:
    - XR: Linear color space now works on Oculus Go and Quest. For Gear VR, driver issues may prevent linear from working with S7 Adreno phones on Android 7.0.

    :D

  • Mehran Khan
    Offline / Send Message
    Mehran Khan polycounter lvl 10
    wowza! well that's a win because the oculus go has a very nice adoption rate right now.

Sign In or Register to comment.