Saving to Resources, Textures created/modified by Unity ?

Is there a way of saving to disk, a texture that has been entirly genreated by unity ?

For Terrain Shading :
I have a script, that from a heightmap
draws masks based on height ranges (luminance ranges),
draws a Mask for steep_slopes (rock faces),
draws a lightmap for the terrain.

These Mask are passed to a Layered Terrain Shader.

At runtime this is a time consuming process.
So,
in order to eliminate the TerrainLayerMaskDraw process
on further visits to the Terrain/HeightMap,
I would like these Textures to be saved in to
the “Resources”.
Ideas on this would be greatly appreciated.

Right now there’s no builtin way of doing this. However, you can just think up some simple file format, and save/load the pixels yourself using .NET file APIs.

Which would work but the file sizes would be -very- big (full ascii bitmaps with no compression) and unuseable external of Unity without converting to a common format.

There’s been a lot of requests for this lately, I requested something similar to this just last week. Hopefully OTEE will bump this feature to the “front of the line” for the next release…

Well, the size depends on the context. Something like Doom3 ships with textures in uncompressed .tga format, and noone is complaining :slight_smile:

The files do not have to be ascii; you can read/write raw bytes with .NET file APIs just as easily. And .NET has builtin classes to do gzip compression, so that gets you almost to the size of PNG files.

But yes, we see the need for an easy no-hassle way of doing this :slight_smile: