Search Unity

How to fix the seam in Skybox?

Discussion in 'General Graphics' started by chena_cpp, Mar 16, 2018.

  1. chena_cpp

    chena_cpp

    Joined:
    Oct 27, 2014
    Posts:
    24
    My unity version is 2017.3.0f3.
    I use the build-in shader "Skybox/Panoramic".

    skybox.png

    It's a seam in the center, set the texture's wrap mode to clamp don't work.
    Is i set something wrong?
    Thanks.
     
  2. chena_cpp

    chena_cpp

    Joined:
    Oct 27, 2014
    Posts:
    24
    Has any method to custom the skybox render?
    I want add a pass and use different mesh, unity default mesh is very sparse at zenith.
    I know this is a optimization, but sometimes i need dense mesh at zenith.
     
    Last edited: Mar 19, 2018
  3. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    1,243
    How about bigger textures?
     
  4. chena_cpp

    chena_cpp

    Joined:
    Oct 27, 2014
    Posts:
    24
    don't work, 2048*1024:

    big sky.png

    i check the texture in photoshop, it's seamless.
     
  5. chena_cpp

    chena_cpp

    Joined:
    Oct 27, 2014
    Posts:
    24
    I found the problem, don't generate mipmap works.
    Thanks.
     
  6. DerrickMoore

    DerrickMoore

    Joined:
    Feb 4, 2018
    Posts:
    246
    mipmaps, nice...
    I hadn't even thought about using .dds files in Unity...

    but makes sence that a skybox wouldn't need mipmaps
     
  7. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Wrap mode - Clamp also helps!
     
  8. Ninjars

    Ninjars

    Joined:
    Feb 13, 2013
    Posts:
    7
    Wrap mode -> clamp and toggling off "generate mipmap" fixed my seam issues too, thanks @ROBYER1 and @chena_cpp !
     
  9. seejayjames

    seejayjames

    Joined:
    Jan 28, 2013
    Posts:
    691
    Thanks! Looks like the "clamp" setting is what actually fixes it (at least on mine), the mip map setting doesn't affect the seams. However, as mentioned earlier, no need to generate any mip maps for a skybox anyways.
     
  10. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    Thanks, these answers helped me out today as well :)
     
  11. sicklepickle

    sicklepickle

    Joined:
    Apr 8, 2012
    Posts:
    44
    Edit: clamp fixed it, thanks
     
    Last edited: Jan 5, 2021
  12. Tony_D7

    Tony_D7

    Joined:
    Oct 28, 2020
    Posts:
    4
    This is 2021 and you saved my day, Thanks a lot my dude !!
     
    EmpirisoftNathan likes this.
  13. Armegalo

    Armegalo

    Joined:
    May 14, 2018
    Posts:
    30
    Neither clamp nor turning off mip-maps worked for me - the only solution was to lower the max resolution down from 8192 to 512 :oops::(
     
  14. salmanhayat16

    salmanhayat16

    Joined:
    Nov 19, 2018
    Posts:
    10
    It worked ,Thanks bro
     
  15. salmanhayat16

    salmanhayat16

    Joined:
    Nov 19, 2018
    Posts:
    10
    We can also use Skybox/Cubmap shader
     
  16. Cranium-Software-Limited

    Cranium-Software-Limited

    Joined:
    Apr 12, 2017
    Posts:
    5
    I've hit this problem in the past. none of these things mentioned are exactly fixes - but compromises. the underlying problem is that the uv derivatives (or you can think of this as texel density) are used to select from the mip chain. if suddenly from one pixel to the next, u or v goes from 1 to 0 then you get a horrible seam. wrapping texture mode doesn't fix this since you aren't going from 1 to 1.01 or something like this... this can be /properly/ fixed by setting the derivatives (newer shader models) or using better mip selection in the shader (older shader models)

    mip selection by texel density is a relatively good, near catch all solution (which selection by distance is not, for example) - but it does hurt us sometimes.

    for a skybox its not so bad. but if you want to e.g. raytrace a sphere in a shader (which is really fast and useful) then apply a cylindrical texture map, or use something like stereographic projection, you will get the same class of problem.
     
    lilacsky824 likes this.
  17. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
    This is still broken in 2021 LTS!!
    You can turn off mip-maps to fix it seems, but it's possible you might need them for material effects
    You can change the image type and the material type to cubemap, possibly degrading the image in the process...
     
  18. unity_ED1C63F76E6456F2F68C

    unity_ED1C63F76E6456F2F68C

    Joined:
    Jun 14, 2023
    Posts:
    1
    thanks, bro................
     
  19. knall_frosch

    knall_frosch

    Joined:
    Feb 24, 2018
    Posts:
    6
    After switching to Unity 22.3 LTS I found issues with loading skybox Textures at runtime through UnityWebRequest, the seams came back.
    Here is the solution mybe this is useful for somebody:
    Code (CSharp):
    1.  IEnumerator LoadTextureAsync(string url, Action<Texture2D> callback)
    2.     {
    3.      
    4.         using (UnityWebRequest uwr = UnityWebRequestTexture.GetTexture("file://" + url))
    5.         {
    6.            
    7.             yield return uwr.SendWebRequest();
    8.  
    9.  
    10.             print("file://" + url);
    11.  
    12.             if (uwr.result == UnityWebRequest.Result.ConnectionError || uwr.result == UnityWebRequest.Result.ProtocolError)
    13.             {
    14.                 Debug.Log("Get File Error: " + uwr.error);
    15.             }
    16.             else
    17.             {
    18.              
    19.            
    20.                 Texture2D resulttemp= DownloadHandlerTexture.GetContent(uwr);
    21.                 Texture2D result = new Texture2D(resulttemp.width,resulttemp.height, resulttemp.format, false);
    22.                 result.SetPixelData(resulttemp.GetRawTextureData<byte>(),0);
    23.                 result.Apply(false);
    24.                 result.filterMode = FilterMode.Bilinear;
    25.                 result.minimumMipmapLevel = 0;
    26.                 result.wrapMode = TextureWrapMode.Clamp;
    27.                 resulttemp = null;
    28.                 callback(result);
    29.  
    30.             }
    31.             uwr.Dispose();
    32.             yield return null;
    33.         }
    34.     }
     
    Inxentas likes this.