Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question [URP] - Using a Texture Array for Normal Maps

Discussion in 'Shader Graph' started by FlyingSquirrels, May 16, 2023.

  1. FlyingSquirrels

    FlyingSquirrels

    Joined:
    Sep 18, 2015
    Posts:
    71
    The Sample Texture 2D node supports 2 types - Default or Normal Map.

    This type of node is missing in Unity 2021.3.22f1 in URP mode.

    Is there something similar when using Texture Arrays?
    Thank you!
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,362
    Most devices perform better using a texture atlas (multiple textures next to eachother) compared to texture2Darray.
    Maybe you can simply get the raw data and output it to normals without issue? Not too sure
     
  3. FlyingSquirrels

    FlyingSquirrels

    Joined:
    Sep 18, 2015
    Posts:
    71
    I see - didn't really think of that.

    The reason we went for a texture array is that we hit the 16-texture limit on the shader.

    Do you know what would be the difference between using a texture atlas (getting data with offset) vs. a texture array?

    Thanks.
     
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,362
    Texture arrays get the different textures via an int
    For texture atlas if the UVs are setup correctly you don't have to do anything. Just use the same material on multiple different meshes which have a different UV
     
  5. FlyingSquirrels

    FlyingSquirrels

    Joined:
    Sep 18, 2015
    Posts:
    71
    Cheers!
     
    DevDunk likes this.
  6. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,108
    I think there is no limit for textures or it's high (I think Ben Golus said that), however there is limit for samplers (but it is possible to reuse them). In any case using so many sampling operations is quite heavy and rather not good idea if there is alternative solution.

    I had no occasion to use "proper" texture atlas, but from my observations I think there is limitation if you use it with tiling textures. I guess it's not possible to get rid of seams between chunks caused by mipmaps. Actually I am curious if it is possible to use texture atlas for terrain without problems.