Search Unity

Creating mipmap streamable textures *at runtime*

Discussion in 'General Graphics' started by ferretnt, Sep 14, 2021.

  1. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    370
    Is there any way to save a texture to disk *at runtime* (i.e. assume it's a massive amount of user generated content) so that it can work with Unity's texture mipmap streaming?
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    795
    This probably depends on exactly which platform you're building/running. Writing files depends on the security of the platform. Reading files into memory which you can use with texturing is a separate consideration which may depend on the platform.
     
  3. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    370
    I'm well aware of how to write files. Assume this is for PC desktop. Assume this isn't my first time reading or writing binary data on many platforms. The question is "given some runtime generated textures, can we write them in a manner that then makes it possible to bind the texture mipmap streaming API to them.

    Assume also that I think the current answer is no, so I'm probably asking Unity, unless I'm wrong.
     
  4. Unity_Joseph

    Unity_Joseph

    Unity Technologies

    Joined:
    Nov 3, 2016
    Posts:
    13
    Hi,

    The texture data has to be in a specific format for texture streaming (serialized files written for game release). That format isn't possible to create at runtime since the build APIs aren't available. Your best bet would be to store the texture data in your own format and then upload it using the Texture APIs.
     
  5. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    370
    thanks for confirming. We will handle this ourselves for now outside of unity with native texture handles.
     
    Unity_Joseph likes this.
unityunity