Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

How expensive is UNITY_SAMPLE_TEX2DARRAY?

Discussion in 'Shaders' started by hungrybelome, Jun 14, 2018.

  1. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    105
    I'm working on a mobile game where all 3d models use the same shader but have different albedo and AO maps. I'm currently experimenting with using a single shader with 2 Texture2DArrays, for both my albedo and AO maps.

    Before I take the time to fully implement this, is UNITY_SAMPLE_TEX2DARRAY and
    UNITY_ACCESS_INSTANCED_PROP fairly expensive? Since I have to do this in the fragment shader, I'll have 2 UNITY_SAMPLE_TEX2DARRAY and 2 UNITY_ACCESS_INSTANCED_PROP per fragment. Since I am working on an AR mobile game, I am only dealing with 2016 and newer higher end mobile devices, but I still run into heating issues, so I was hoping to know how expensive these features are. I wonder if the cost of the instanced properties and sampling is negligible, or if it is something to be concerned about.

    Thanks!
     
    Last edited: Jun 14, 2018
  2. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,740
    In theory it's the same as a regular texture sample..
     
  3. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    105
    How about the usage of UNITY_ACCESS_INSTANCED_PROP? I'm wondering whether to parameterize specularity and other shader params while I'm at it. Basically have close to 6 UNITY_ACCESS_INSTANCED_PROP calls in my shader.
     
    Last edited: Jun 14, 2018
  4. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    2,740
    No idea, there's only one way to find out though..