Search Unity

Question How to configure cameras as exceptions to Mipmap streaming?

Discussion in 'General Graphics' started by chrismarch, Dec 3, 2022.

  1. chrismarch

    chrismarch

    Joined:
    Jul 24, 2013
    Posts:
    472
    Hello,
    We're using Texture streaming for mipmaps, and I am attempting to disable it in one of our scenes ("Scene A"), where we only display a small set of models, and in which we have noticed that a higher mip than desired is displaying, resulting in pixelated appearance to the model. So far I haven't had any luck with "disabling mipmap streaming" for the camera in this exception scene, and the wrong mip always displays, unless I completely disable Mipmap streaming in the quality settings, or disable it on the texture importer for the the texture that displays the pixelated appearance (neither of these workarounds is acceptable).

    Here are the approaches I have attempted, following my understanding of https://docs.unity3d.com/2020.3/Documentation/Manual/TextureStreaming.html#cameras
    (We are testing on a Samsung Galaxy S8, with our player built from Unity 2020.3.36f1 and URP 10.9.0).
    None of these work, what am I doing wrong?
    1. Disable "Add All Cameras" for Texture Streaming in all Quality levels in Quality Settings, and then add a Streaming Controller (to the GameObject of the 3D rendering Camera) in the other scene ("Scene B"), where we do not have this bug, and we want mipmap (and lightmap) streaming active
    2. Enable "Add All Cameras" for Texture Streaming in all Quality levels in Quality Settings, and then add a disabled Streaming Controller to "Scene A" (where we have the bug)
    3. Enable "Add All Cameras" for Texture Streaming in all Quality levels in Quality Settings, and then add an enabled Streaming Controller to "Scene A" (where we have the bug), with mipmap bias set to -100
     
  2. lyndon_unity

    lyndon_unity

    Unity Technologies

    Joined:
    Nov 2, 2017
    Posts:
    66
    If you have mip streaming set and no camera(s) at all then the mip level selected for a texture will remain at the "max level reduction" (which defaults to 2). This would be the case for options 1 & 2.

    Option 3 seems like it should work.
    You could debug the texture in question by using the following API's and outputting the metrics to screen or debug log

    One thing to check is the UV distribution metric on the mesh.
    If it is a generated mesh its possible this metric has not been setup correctly.
    You can call Mesh.RecalcculateUVDistributionMetrics to recalculate this value.
    see other limitations at the end of this documentation page.

    Another option you could try (with the cameras disabled on the problematic level) is to force the mip level for the texture with Texture2D.requestedMipmapLevel or force all textures to be loaded by setting Texture.streamingTextureForceLoadAll as you enter the level. Reset this to false as you exit the level
     
    chrismarch likes this.