Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Texture Size Limit?

Discussion in 'Scripting' started by npsf3000, Nov 7, 2010.

  1. npsf3000

    npsf3000

    Joined:
    Sep 19, 2010
    Posts:
    3,830
    Was mucking around with textures and discovered that I get a error message when I try to make a texture with the dimensions of 2^14 by 2^14. Was wondering if anyone knew why this is the case, and of any easy ways around it?

    Standalone windows. modern hardware.

    Documentation claims that the values are int32 which is why I'm confused.

    2^13 works fine.
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    The maximum depends on the hardware.

    normally you wouldn't target anything larger than 2048x2048, just due to the size of larger textures in the build, ram and vram, in rare cases you go to 4096 (thats GeForce 7300+ / HD 2300+) or even 8192 (requires DX10+ class hardware from ATI / NVIDIA)

    there is no hardware today that allows anything larger than 8192 and already that is unreasonable in size, as that requires more than many graphic cards can even hold unless you DXT compress them, as 8192 is over 320MB RAM / VRAM to even store it!

    If you enable "GetPixels" ie mark them as editable, DXT will not be possible.
     
  3. npsf3000

    npsf3000

    Joined:
    Sep 19, 2010
    Posts:
    3,830
    HD5770 so I've got DX11 and 1GB. (Actually I might be running into a mem prob... does math...
    800MB is a lot...)

    Okay then - It's time to figure out how to do some png stitching (this is fractal art Screen Shots).
     
    Last edited: Nov 7, 2010
  4. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Well even if you had 10GB, current hardware does not support textures larger than 8192 anyway :)

    and png stitching won't solve the memory problem but at least the size problem.
    Question is in what form you need the data (ie if you need such a larger texture at all), because otherwise you can work with a 2D array for the whole calcs and generate a texture which you feed with the required data on request through SetPixel(s)
     
    Xephi likes this.
  5. npsf3000

    npsf3000

    Joined:
    Sep 19, 2010
    Posts:
    3,830
    Yeah, I could work through an Array, but 800MB is still excessive in size...

    I'll figure out a way to stitch together a .png - then I can not only reduce the size of needed memory I will be able to Multi-thread easily. 3 Threads working on 1MB chunks will be a lot lighter on my (quad core) machine than a single thread working on 800MB simply because that removes the continual destroying of my super-fetch.

    Thanks for the heads up - with .png's only 8MB in size I forgot that to check the in-memory size of my data.
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    multithreading will become a major problem if you go with textures as you can not access Unity engine objects (ie also not Texture2D through GetPixels / SetPixels) from an external thread only the main thread.

    Unless you talk about using 2d arrays and writting an own png writer to temporally store it to disk etc for transfer
     
  7. npsf3000

    npsf3000

    Joined:
    Sep 19, 2010
    Posts:
    3,830
    Yeah, whatever works. Array of RGB to my 'rendering' code is but a line or two change away from working properly.