Search Unity

Huge Texture

Discussion in 'Assets and Asset Store' started by Alex-Vertax, Mar 3, 2020.

  1. Alex-Vertax

    Alex-Vertax

    Joined:
    Sep 16, 2013
    Posts:
    205


    News | Asset Store | Web | Video | Docs | API | Forum | Support

    Huge Texture
    allows you to import and use textures larger than 8192x8192px.

    How it works:
    When importing a texture, Huge Texture splits the texture into pages and saves it as a Texture Array.
    Texture Array is combined on the shader side, which does not create extra draw calls and has almost no effect on performance.




    Features:
    • The maximum size of the texture: PNG and JPEG up to 16384x16384px, RAW up to 2GB (0.715 gigapixels, 26624x26624px for square textures without transparency);
    • Built-in Render Pipeline, Universal Render Pipeline, High Definition Render Pipeline, Custom Render Pipeline;
    • Compressed and uncompressed formats;
    • Does not produce extra draw calls. You will have as many draw calls as you would with a regular texture;
    • Supports mip-maps and normal maps;
    • API for working with huge textures, as with regular Texture2D;
    • Integration with Mesh to Terrain, Real World Terrain;
    • Built-in update system.

    Requirements:
    • Not all platforms support Texture Arrays.
    The list of supported platforms is here:
    https://docs.unity3d.com/Manual/SL-TextureArrays.html
    • The field must accept Texture (not Texture2D), and the component must accept custom material or shader.
    For example, Huge Texture can be used in Mesh Renderer, Raw Image, etc.
     

    Attached Files:

    Last edited: Feb 22, 2023
  2. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Hey,
    it looks very promising!

    Some questions:
    - can only be used for diffuse texture or can also be used for other pbr textures (Normal, AO Metal...)?
    - Do you provvide something like a Custom Standard Shader for PBR in Standard Render Pipeline?
    Thanks!
     
  3. Alex-Vertax

    Alex-Vertax

    Joined:
    Sep 16, 2013
    Posts:
    205
    Hello.

    1. In the current version, Huge Texture is imported as the equivalent of a regular texture with Texture Type - Default, and can be used in fields that use this type of import.
    Thanks for your question. I will consider importing textures as a Normal Map.
    2. We provide ShaderGraph, which implements the basic functionality for mapping Huge Texture to PBR, which you can use as an example or basis for your own shader.
     
    sjm-tech likes this.
  4. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Great ... I would like to use it for large photoscanned areas where the limitation of the current size of the textures is the big bottleneck.
    Edit:
    I haven't tried Shader Graph yet ... I'll try.
    However providing a custom basic standard shader would be a huge advantage for non-shaders experts to have immediatly a benefit using Huge texture.
     
    Last edited: Apr 22, 2020
  5. Alex-Vertax

    Alex-Vertax

    Joined:
    Sep 16, 2013
    Posts:
    205
    This is a shader that you can use for PBR out of the box.
    But, if you want, you can modify it using the visual Shader Graph editor.
     
  6. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    I don't see the link/shader.
     
  7. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    First test with Unlit Array shader compared to Unity Unlit texture shader.
    Amazing result but the colors are washed out (Linear).

    HTTestZ.jpg
    HTTest.jpg
     
  8. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    The huge boost in resolution is clearly visible!
    Less visible but a bit washed out also switching to Gamma
    Unity Legacy Diffuse shader left / Huge Texture Diffuse-Array shader right

    HTTestZ2.jpg
    HTTest_Gamma.jpg
     
  9. Alex-Vertax

    Alex-Vertax

    Joined:
    Sep 16, 2013
    Posts:
    205
    PBR shader is located in “ShaderGraphs / HugeTexturePBR” (see screenshot),
    or “Assets / Plugins / Infinity Code / Huge Texture / Shaders / HugeTexturePBR.shadergraph”.


    Adjust the light in your scene or use Huge Texture / Unlit Array shader.
     
  10. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    My mistake... I forgot to tell you that i'm using the standard pipeline (no shader graph support).
    However I edited your "Diffuse-array" shader adding support for normal and occlusion (non array for now) and the support for linear color (to fix the washed out effect).
    I found an issue using "import huge texture" in a project with linear color space: the array texture become very dark.
    Temporarily fix: import texture on gamma and then switch to linear.
     
    Alex-Vertax likes this.
  11. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    18 Ha area 8k single Texture (Standard unity shader) vs 16k Array Hugh Texture (custom Diffuse-array + Normal + Occlusion)
    Incredible visual quality enhancement!
    No noticeable performance regression ... awesome!

    HT_N_AO_Crop.jpg
    HT_N_AO.jpg
     
    Last edited: Apr 23, 2020
    Freznosis and Alex-Vertax like this.
  12. Alex-Vertax

    Alex-Vertax

    Joined:
    Sep 16, 2013
    Posts:
    205
    Thanks for reporting a problem with linear color.
    I will check it.

    Thank you for sharing your screenshots.
    Your result looks really amazing.
    I am always pleased to see how our assets work in real projects.

    Most likely, next week will be released Huge Texture v1.1, which can have textures more than 16k.
    Theoretically, up to 360k, of course, if the target device has so much video memory.
    Edit: Texture2DArray has a 2GB limit, so the maximum texture size will be 26624x26624 (for a square texture).
     
    Last edited: Apr 29, 2020
    sjm-tech likes this.
  13. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    I was going to ask you if the 16k limitation was extensible...great news.

    A few features which could be nice to have in a future:
    - Texture streming
    - Texture LOD by camera distance
    - Normal array support
    - Linear/Gamma support
     
    Last edited: Apr 23, 2020
  14. Alex-Vertax

    Alex-Vertax

    Joined:
    Sep 16, 2013
    Posts:
    205
    Texture streaming - I will check, but most likely it is impossible to implement in the current concept of the asset.
    Texture LOD by camera distance - Texture2D Array supports mip-mapping, but this creates visual artifacts at the borders of the pages. If I ever find a way around this, this feature will be added.
    Normal array support - has a very high chance of being added in version 1.1.
    Linear / Gamma support - I will check this.
     
    sjm-tech likes this.
  15. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    I found the issue related to gamma/linear color spaces.
    Huge texture importer creates the texture array related to the active color space but if you change afterwards to linear the array is not updated.
     
  16. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    Hey Alex-Vertax,
    it would be great if you also provided Amplify Shader Editor graph conversion of your Shader Graphs example to be used by those who use the standard default pipeline.
     
    Last edited: Apr 25, 2020
  17. Alex-Vertax

    Alex-Vertax

    Joined:
    Sep 16, 2013
    Posts:
    205
    Unfortunately, I do not have Amplify Shader Editor, and I see no reason (at least for me) to buy it when there is Unity Shader Graphs package.

    Here is a screenshot of Huge Texture PBR shader in Shader Graph:

    I looked in the manual for Amplify Shader Editor and it has all the nodes used, so you can easily reproduce this shader using Amplify Shader Editor.
     
  18. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    No problem.
    I did the conversion exactly as you said and i found the right nodes for Amplify Shader Editor.
    Thanks
    Max

    Huge Texture - Amplify Shader Editor Node Graph
    ScreenshotASE.png
     
    Last edited: Apr 25, 2020
    Alex-Vertax likes this.
  19. sjm-tech

    sjm-tech

    Joined:
    Sep 23, 2010
    Posts:
    734
    I did a little optimization for Amplify Shader Editor users.
    FX node which include the more complex nodes.

    ASE Shader
    HT-ASE.jpg
    ASE FX node
    HT-ASE-SFx.png
     

    Attached Files:

    Alex-Vertax likes this.
  20. SympaK

    SympaK

    Joined:
    Apr 14, 2010
    Posts:
    134
    Hi, could your asset work also for characters having several textures (say ten, each per material of the single mesh) of many sizes (from 512 to 2048)?
     
  21. Alex-Vertax

    Alex-Vertax

    Joined:
    Sep 16, 2013
    Posts:
    205
    Hi.
    Yes, it can. But honestly I don't understand why you need Huge Texture for this.
    If you have textures with sides less than or equal to 8192px, you can use a regular texture.
     
  22. SympaK

    SympaK

    Joined:
    Apr 14, 2010
    Posts:
    134
    It was just a scrubble of mine, thinking that an amount of 10 textures ranging 512-2048 on just one character could have bogged its actions (so far I'm in test mode and the scene is void: just the character is on it, but it stutters whilst walking: though I don't know whether it is due to the textures or else, so I asked in case).