Search Unity

Understanding 32bit texture workflow and grading

Discussion in 'General Graphics' started by ViralArt, Apr 17, 2015.

  1. ViralArt

    ViralArt

    Joined:
    Apr 17, 2015
    Posts:
    11
    Currently testing what texture workflow to use and gathering as much knowhow on unity handling of bitdepth and color space.

    The question is really simple then yet again so advanced.

    Short version.
    How do i use a 32bit linear texture and grade it out to the final image.


    Small note.. gamma vs linear workflow.
    I would always want to work in linear space as calculations of real light will yeld the expected result this way.

    1. Color profile (not color space)

    When talking about color space i think about sRGB vs lets say ProPhoto. This is not the same as linear space and gamma space. In the real world we see around twice as much green as red and blue so if you save you texture in photoshop in proPhoto you have the extra information in the green channel and you will see a slight change in the hue when blending color in unity aswell. This may or may not behave correct.

    Do i have to use the sRGB color profile?


    2.Bitdepth and linear and gamma color space
    In 8bit everything behaves as is expected when light values is equal to 1 you get the same color as you tetxure. So we will skip talking about 8bit

    In 32bit, I presume you would set the import option to truecolor. I have saved my exr's with wavelet compression which gives me a 16mb texture. if i import with auto truecolor it reads the same size if i choose RGBA i get 21mb. Seems it includes the alpha which is otherwise not importent in this texture. This makes sense, and the compression is likely the same, so far so good.

    Here comes the prelude of the tricky part. The exr is exported from a 3dpaint application as 32bit linear. To double check this is correct i use djv and/or photoshop and apply a gamma of 0.454. This gives me the correct color in gamma space which is what we all see on our screen. (If you copy that result into a 8bit mode document in photoshop, we essentially have our 8bit texture now in gamma space 100% correct)
    From this, we can conclude that the texture is ok and also rdy for possible convertions.

    Since the 32bit texture is in linear space, in unity i tag bypass sRGB sampling (Its already in linear space so no degamma regamma needed) This gives me a blown out texture in the viewport much like i would expect if i open op the texture from the harddrive. If i leave it on the texture works as expected but the description of this button makes no sence to me.
    Unless what i see in the viewport is now the ungraded image thats needs a 0.454 gamma correction which would make alot sense from a composeting standpoint. Also if i play with the RGBM settings (which i dont understand what does at all, something to the with lightmaps as far as i know.) Anyway the texture becomes slighty more or less blown out. and depending on the bypass sRGB yield the correct color or a blown out color.
    If anyone can, please enlighten me on the entended settings workflow.

    3. Color grading
    I use tonemapping and a colorcorrection 3d lookup texture for color grading

    The tonemapping that unity offers does not have gamma control but only offers exposure.
    This contrains blown out lights and speculars into a displayable range somewhat nicely and if the texture works in the veiwport it translates nicely aswell. It does not however seem to work as a gamma correction for linear space to gamma space as in like I mentioned above, you need bring everything back to gamma space when you grade on the cammera

    The last step i do after tonemapping is color correct with a 3d lookup texture which is in 8bit gamma space and adjusted it in photoshop. This works fine with some primative screen shot workflow, and i kinda want to stay in 8bit as it give me many options for color grading in photoshop. Alternative I could be mapping the whole 32bit linear color range and handle it as a complete tonemapper/ color correcter, but this might seems a bit far fetched roundabout way of doing it.

    I have not included all of my observations but hope my points came across.
    Help would be greatly appreciated

    PS.
    Optimization of memory and space usage can be done at a later stage of development, currently I would like to start at 32bit to have the redundancy (You can always go from 32bit to 8bit, but not the other way around)
     
    Last edited: Apr 17, 2015