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

Resolved Limit Mip Map Levels AND Mip Maps Preserve Coverage for a texture asset?

Discussion in 'General Graphics' started by Kintermaj, Jun 1, 2022.

  1. Kintermaj

    Kintermaj

    Joined:
    May 14, 2022
    Posts:
    1
    I am using a texture atlas that contains textures with transparency that will vanish at certain mip map levels without Mip Maps Preserve Coverage. It would also suffer from texture bleeding if I cannot limit the number of mip map levels.

    I can limit the number of mip map levels to 5 if I do

    Code (CSharp):
    1. atlas = new Texture2D(atlasSize, atlasSize, TextureFormat.ARGB32, 5, true);
    but I can't seem to get that Texture2D to use the import setting "Mip Maps Preserve Coverage."
    When I try:

    Code (CSharp):
    1. TextureImporter importer = (TextureImporter) AssetImporter.GetAtPath("Assets/Textures/Atlas.asset");
    even after I have saved the Asset to that location, I get a "specified cast is not valid" error.
    (My atlas packing script is already in Assets/Editor)

    I would really prefer to be able to generate this texture atlas at runtime eventually, but at this point I would welcome any solution that works.
    I am also using Unity's "Legacy Shaders/Transparent/Cutout/Diffuse" shader to get a number of specific desired effects, so if the solution is shader related I would probably have some follow-up questions.

    Edit: Never mind. Texture2DArrays exist.
     
    Last edited: Jun 1, 2022