Search Unity

DDS textures

Discussion in 'Editor & General Support' started by Olegf, Mar 12, 2011.

  1. Olegf

    Olegf

    Joined:
    Jan 17, 2011
    Posts:
    12
    A couple of questions regarding .dds textures.

    First of all, as I got there is no importing for .dds files and so Unity won't create meta file for them. I want to change filtering to trilinear, but when I change it, it drops back to bilinear. If there is no way to save this settings, maybe I can change default .dds filtering somewhere (current default is bilinear)?

    Second problem is with normal maps. When I try to use .dds normalmap texture, wich looks good in another engine, in Unity in looks wrong. If I convert the first mip level of that .dds texture to .png, all looks fine.

    Any thoughts about these two questions? I'm using 3.2 Pro version.
     
  2. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    For your second problem, Unity converts imported images for normal maps to DXT5nm. Since you're importing a .dds, it assumes it's already in the correct format and doesn't convert it. When you import the .png file, it does convert it properly.
     
  3. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    My suggestion is to convert every your texture to TGA (in example) so that then Unity will work well.
     
  4. Olegf

    Olegf

    Joined:
    Jan 17, 2011
    Posts:
    12
    Well it is in correct format, but still it looks wrong in Unity. And different from how it looks in another rendering engines. And i wonder why is it so.

    The problem is our artist need to create each mip level manually (in photoshop), so it's not an option. But if there is no way to make Unity use trilinear filtering with .dds, than yes, we'll have to use .tga or .png.
     
  5. Frank Oz

    Frank Oz

    Joined:
    Oct 13, 2010
    Posts:
    1,560
    Is there a reason why he has to? Are they unique and different looking images per mip? Cause otherwise Unity does them just fine and there's no reason not to let Unity handle them (will save your guys a lot of time too).
     
  6. Olegf

    Olegf

    Joined:
    Jan 17, 2011
    Posts:
    12
    Yes, he tries to change several smallest mips with the different images, with less details etc. But without trilinear filtering it won't help that much.
     
  7. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    DDS are not remaining like this in unity its not like it takes the DDS and stores it. It just provides unity a different type of data to store in its own format ...
    Unsure if the documentation contains the information on what kind of data actually is left intact
     
  8. pedroluchini

    pedroluchini

    Joined:
    Jun 12, 2011
    Posts:
    9
    Any news regarding the "trilinear filtering" option? I too would like to use a DDS file with some hand-tweaked mipmaps, but Unity doesn't save its filter mode...
     
  9. pedroluchini

    pedroluchini

    Joined:
    Jun 12, 2011
    Posts:
    9
    A-ha, got it! Here's a quick hack to force trilinear filtering on DDS textures:

    Code (csharp):
    1. using UnityEditor;
    2. using UnityEngine;
    3.  
    4. class DDSForceTrilinear : AssetPostprocessor
    5. {
    6.     void OnPostprocessTexture(Texture2D texture)
    7.     {
    8.         if (!assetPath.ToLower().EndsWith(".dds"))
    9.             return;
    10.        
    11.         texture.filterMode = FilterMode.Trilinear;
    12.     }
    13. }
    Just place this script in Assets/Editor.