Home Technical Talk

Of Bit Depths, Banding and Normal Maps

13

Replies

  • Linko
    Options
    Offline / Send Message
    Linko polycounter lvl 7
    CGCookie has made a tutorial to explain how to fix the artifacts on the normal map by using Blender Cycles for baking in 32 bit Float and Photoshop for the compression. If you know how to compress a 32 bits into a 8 bits image with (good) dithering with a free and open source software please tell us, that would avoid to pay for Photoshop just to do that. ;)

    https://youtu.be/6D5tBEjS-N0

  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    This is a complicated subject but essentially there isn't any way that you can reduce 32bit float to 8bit without some kind of dithering unfortunately. The best you can probably do is to use hard edges around your UV islands so the normal map is less colourful so it compresses better (vs one smoothing group for everything) and then maybe use a 10/11bit DDS format and have an encoder that is 16bit aware. BC5 is a also  good format to use but it is twice size at 16 bytes per block, rather than 8 bytes in BC1. Another option is to reduce your normal map size by half and use it as uncompressed, which will end up the same size as BC5, but also you will still get banding issues so it's a trade off unfortunately. Fwiw, GPUs have supported 16bit DDS for years, but they are generally too expensive to use in real time.

    With that said 32bit normal maps are great, but are massive overkill for the majority of situations and prohibitive in terms of memory cost to be realistically used for real time applications. For offline rendering such as cycles there is less of a budget so you can often get away with it, but it's probably still overkill for 99% of situations and 16bit will provide ample quality for a much reduced cost, even offline. If you cant use 16bit then dithering is your friend as it's better than banding for the most part. It's worth remembering that DDS compression is destructive 95% of the time so you will never get perfect results and most of the time the texture will either hide the worst offenders or the resolution you will be using is lower than ideal and will jack your textures anyway, so it's really not worth worrying about. :)

    The last thing I wanted to point out is that people should never ever be manually altering/editing their baked normal maps in Photoshop (or any other image editor) as normal maps are an encoding of mathematical data, rather than just pure colour information that you would find in Albedo/Base Colour etc. You cant use the fill tool as seen in the video (or any other destructive editing method) without destroying data encoded within the normal map, so it's super bad practice.
    Imagine opening a video file in notepad and editing the values manually. Delete some random  lines and maybe add some more. What are the chances the video will play? If it does play, would it be play correctly? It's exactly the same thing with Normal maps for the most part as even if you cant see the data you are changing you are still destroying the information that was produced by the baker and as such the bake no longer matches the mesh it was baked from. :)

    Hope that helps!
  • Linko
    Options
    Offline / Send Message
    Linko polycounter lvl 7
    This is a complicated subject but essentially there isn't any way that you can reduce 32bit float to 8bit without some kind of dithering unfortunately.
    I want dithering, Blender directly compresses the image without dithering when reducing the bit depth and I don't want to rent Photoshop just to do that. Blender generates harsh transitions like saving a  very compressed JPEG. I want to use dithering to bake a 32 bit Float OpenEXR texture and save it in 8 bit Float TGA with smooth but noisy transition but that's still much better and for hard surface models it gives a slight roughness effect. I do not wanted to use a 32 bit Float texture directly. The problem I have is that i haven't found a free and open source software that can do dithering, this has been requested for Blender.

    Yes I use hard edges on the high poly (if there is no subdivision surface; i work with the bevel shader instead) and low poly, it's a good thing to remind that, this removes artifacts on flat surfaces (and if a curvature must be extracted from the normal map too).
  • fatihG_
    Options
    Offline / Send Message
    fatihG_ polycounter lvl 14
    IrfanView can convert 16 bit to 8 bit. Just save as .tga. It has a batch converter as well.

    I do not have a texture with obvious banding so it is hard for me to test out with. 

    It also has a tool that can convert 16 to 8 bit with dithering, bu the dithering is absolutely awful. 
  • metalliandy
    Options
    Offline / Send Message
    metalliandy interpolator
    @Linko In addition to Infranview I would maybe try Krita too. It's a pretty decent alternative to PS.
  • nickw
    Options
    Offline / Send Message
    nickw polycounter lvl 6
    @Linko gimp 2.96 supports dithering when converting to 8bit
    under image > precision

    the model isn't great and its worst case lighting so there's still some artifacts
    top: 8bit no dither  bottom: 8bit with dithering

  • grateful_edd
    Options
    Offline / Send Message
    Hi, so I have a question in regards to 32bit colour maps. My current workflow involves baking extremely high poly meshes (1-2 billion polys), and in order to save time loading the mesh into Xnormal, I bake all of my maps out at 32bit EXR. However, this results in a much brighter Colour map than I would get if I baked it at 8 or 16 bit. Is there any knowledge here that may assist me in accurately bringing the luminescence down to its correct value? I'm aware that to do this with a normal map I adjust the gamma to 0.4343, would this method also apply to the colour map? 
13
Sign In or Register to comment.