Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: DXT5n

  1. #1
    Member Newbie
    Join Date
    Nov 2008
    Posts
    44

    DXT5n

    I've read that regular DXT compression is not suitable for normal maps, and that's why DXT5n was invented. But when I look in OpenGL documentation, I only see GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, nothing for normal maps. So how do I load compressed normal maps??

  2. #2
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: DXT5n

    dxt5n? Never heard about it and I can't find any valuable information. I know that swizzled dxt5 or 3dc compression are commonly used to for normal maps compression, though 3dc is only supported on ATI hardwares.

  3. #3
    Member Newbie
    Join Date
    Nov 2008
    Posts
    44

    Re: DXT5n

    I read on some NVIDIA page that 3Dc can be loaded as RGTC in OpenGL.

    Edit: http://developer.nvidia.com/object/r...mpression.html

  4. #4
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: DXT5n

    Yes that gives you one more chance to be able to load 3dc compressed texture if your hardware supports the GL_EXT_texture_compression_latc extension. But I do not not if it is widely supported.

    IMO 3dc is worth to try since all quite recent ati hardware should support the GL_ATI_texture_compression_3dc extension and nvidia ones should support the GL_EXT_texture_compression_latc one which has a reason to live only on non-ati hardwares.

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: DXT5n

    DXT5n is DXT5. The only difference is, that you swizzle the x,y,z channels differently for better quality. Maybe you even discard one of them and recalculate it in the shader, don't know the details anymore.

    You don't need additional hardware support for it, it only means, that you use DXT5 in a way that gives best results for normalmaps.

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  6. #6
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,661

    Re: DXT5n

    Quote Originally Posted by Jan
    DXT5n is DXT5. The only difference is, that you swizzle the x,y,z channels differently for better quality. Maybe you even discard one of them and recalculate it in the shader, don't know the details anymore.
    Chicken scratches from the past on that:

    "Also, if you're using tangent-space normal maps, you only need to store two components: X and Y (z = sqrt( 1-x*x-y*y )). Store them in alpha and green for best accuracy. Often referred to as DXT5N or DXT5NM (normal map) format, where specifically A=X, G=Y, sometimes setting R & B to Y."

    Yeah, you can do object-space normal maps too, but the quality of course isn't as good.

    See the "Normal Map Compression" chapter in <u>ShaderX2: Section 2 Rendering Techniques</u>, which you can download using this link. Also see this Normal Map Compression whitepaper from ATI. Also search for DXT5 in Engel's An HLSL Primer for Developers.

    Nowadays you'd prefer LATC2 for tangent-space normal map compression (essentially ATI's old 3Dc) as you get 2 8-bit exemplars and 3-bit per-texel interpolants per block, vs. DXT5 where you only get this for alpha but have to deal with at most 6-bit exemplars (green) and 2-bit per-texel interpolants.

  7. #7
    Member Newbie
    Join Date
    Nov 2008
    Posts
    44

    Re: DXT5n

    How do I detect if a dds file is 3Dc/LATC/RGTC? NVIDIA's texture tools documentation says they support these formats, but I don't have Photoshop to try creating a file and see what it puts in the header if they are specified...

  8. #8
    Senior Member OpenGL Pro dletozeun's Avatar
    Join Date
    Jan 2006
    Location
    FRANCE
    Posts
    1,367

    Re: DXT5n

    Same as your last post about sRGB, check out the dds headers:
    http://msdn.microsoft.com/en-us/libr...76(VS.85).aspx

    Good luck then if you have to supports simultaneously DX10 and DX9. Look at the fourcc value when reading DX9 dds files.

  9. #9
    Member Newbie
    Join Date
    Nov 2008
    Posts
    44

    Re: DXT5n

    Sticking to non-DX10,
    I see in an NVIDIA dds loader that 3Dc uses a four-CC value of ATI2
    Can I assume then if the four-CC is that that I can straight-load it as GL_COMPRESSED_RG_RGTC2? i.e. glCompressedTextureImage2DEXT(_id, GL_TEXTURE_2D, mipLevel, GL_COMPRESSED_RG_RGTC2, mipW, mipH, 0, sz, image->GetData() + mipOffset);
    where the data has been fread in the same way as with DXT formats?
    And is there any file format that stores GL_COMPRESSED_RED_RGTC1? There is a four-CC of ATI1, but I haven't found any definition of this format, I just see in code that the block size is half of ATI2. Could it be what I'm looking for?

  10. #10
    Member Newbie
    Join Date
    Nov 2008
    Posts
    44

    Re: DXT5n

    By the way, dwMipMapCount is defined at MS' site as "Number of mipmap levels, otherwise unused." That doesn't explain if the base layer is counted!

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean