07/12/2010

Linear Workflow and Gamma Correction within Vray and 3ds Max

*Please note, this tutorial applies to 3ds Max versions prior to 2014 and Vray versions prior to 3.0.

Many of you will have heard the terms “linear workflow” and “gamma correction”. It is a must for 3d rendering, especially interior visualisation because it fixes so many problems with render samples, light falloff and cuts post processing tasks in half. To put it simply, this workflow will increase the fall off of your lights so that light travels further throughout your scene by working in gamma 2.2 but save out a linear image for compositing.

Up until now, you are used to adding in extra lights and hitting a high multiplier value in order to get light to flood through your scene and eliminate dark areas. However, this can lead to incorrect burnt out areas. Gamma correction fixes this problem and allows you to reduce the amount of lights in your scene, which in turn reduces rendering times. Here are the settings you would need to change in order to set it up correctly, along with a small explanation of each step.

Set gamma to 2.2

By default, both Autodesk 3ds Max and Vray work in gamma 1.0 (linear space). In Autodesk 3ds Max preferences under enable gamma/lut correction, change the gamma to 2.2. Autodesk 3ds Max will now have an input gamma of 1.0 and an output gamma of 2.2 for viewing everything in the viewport.

Tick both affect colour selectors and affect material editor

This will drastically change the way you see your material editor and materials within the scene, this is how it should be at gamma 2.2. It will take a while to get used to but it is a necessary step for a linear workflow.

Leave input and output gamma at 1.0

Changing this to anything else but 1.0 will just confuse matters. Keeping this at 1.0 means that your textures will always come in at 1.0 and go out at 1.0. The actual Gamma change to 2.2 will happen elsewhere. A simple explanation straight from the Autodesk 3ds Max help file explains why.

“If you use bitmaps from multiple applications, and these different applications have different ideal Input Gamma values, then turn on gamma correction, but leave Input Gamma set to 1.0. Instead, for each bitmap you read, use the individual Select Bitmap Image File dialog to set the gamma value appropriate to the program that created the bitmap.”

Enable Vray frame buffer

In the Vray render Setup go to Vray frame buffer and tick enable built-in frame buffer. This is a much more advanced render window than the standard 3ds Max version. You can toggle between linear and gamma 2.2 correction and apply basic colour correcting which can be burned in when the image is saved.

Vray linear colour mapping

In Vray colour mapping, set it to linear multiply and set gamma to 2.2. It is recommended to work in pure linear space and complete your gamma correcting in post production. Tick don’t affect colours (adaptation only). This will render out a darker version of your image. To see the actual result in gamma 2.2 space, click the sRGB button in the Vray frame buffer during or after rendering.

Do not tick linear workflow, it may seem like a magical linear workflow button but it is not. Instead it is a quick and brutal way of correcting Vray materials to match a linear workflow and the result can be less than desired.

Specify gamma 2.2 for textures

When adding a texture map to the material editor, in the bitmap loader, manually change the gamma to 2.2. Although they work in gamma 1.0 (linear space), digital cameras apply a total curve which adjusts the gamma to 2.2 to make the image appear more pleasing to the eye. Unless you have advanced photography skills and you are working with RAW images, this is a helpful process for the average happy snapper. It means that, as you may have guessed, the texture map JPEG you took with your digital camera is already at gamma 2.2.

You need to specify the texture map to be 2.2 gamma on entry otherwise the image will be at gamma 4.4 and over bright because you have already told Autodesk 3ds Max to be at gamma 2.2 for both colour selectors and the material editor in step 2. Please note HDRI maps, bump maps, displacement maps and normal maps do not need to be changed to gamma 2.2.

Render output format

When working with linear images, the output is mathematically correct as opposed to just looking correct. In post processing, any adjustments will give predictable results and are much easier to manage. It is best to save out as a TIF file which is at least 16 bit colour. Saving out an 8bit file format may result in some colour banding because there is not enough tonal range. Never render out JPEGs because this file format is not designed for linear images and you will lose a lot of data when saving in this format initially.

Once you have completed your composit, you will need to manually apply a gamma correction curve for correct viewing on a monitor or if you choose to render as EXR, Adobe apply this gamma correction for you automatically.

81 Comments

  1. thanks a lot…i have 1 question…everytime i render my scene it suddenly crashes and shuts down the program.. even if the files size is very small.. hope you could help me with this matter thanks..i already have a 2 gig graphics card with corei 7 and 8 gig ram..

  2. jpcutler85 on said:

    Hi Theo,

    Does this happen with a range of different files or one in particular? I wouldn’t think it was a direct issue with the settings in this post.

    It is more likely to be a corrupt file or 3ds Max may be corrupted and in need of a reinstall.

    Hope that helps!

    • almost every scene that i create results in this problem…ill try to re- install my max and vray hope this solves the problem..

      thanks for the reply… bye the way… good tuts…

      • andry on said:

        are you using 32bit windows? I had same problem too, but it’s fixed since I use 64bit windows

    • Hi,

      You wouldn’t use this any other colour mapping with this work flow. The purpose of using linear colour mapping and the above work flow is so that everything is kept at 1 (linear).

      If you were to use say exponential, the output would no longer be linear.

      • If you decide not to burn in the gamma change as mentioned above, you will need to adjust the rendered image in Photoshop to bring it up to gamma 2.2 (standard viewing)

        You can do this by adjusting the middle slider of the levels adjuster to 2.2 (default is 1)

        The whole point in rendering in linear space is so that it is easier to calculate adjustments and tweaks to your render in post.

  3. siavash on said:

    It really gives a difference , i was using 2.2 with hsv exponential before but with a low quality test you will see some thing different , it seems photons spread in more ordered manner

  4. Thanks, you are a good writer and knows exactly what to point out and what to leave. Keep it up

    Regards from a new hang-around

  5. darkirender on said:

    if you open an evermotion model, a tree for instance, and then check their render settings majority of them are not in linear color mapping. is it recommended to just simply merge these models without modifying their maps or colors into your scene which is set in a linear workflow?

    • If you are working in pure linear, you can leave materials and colours at their defaults. Then do your gamma correction in post.

      You would only need to adjust the materials and colours of the model if you have gamma 2.2 correction within 3ds Max.

  6. marwan on said:

    james your tutorials are great…
    to be honest i did work with the gamma 2.2 alot before but never understood it until i read this tutorial…..
    but i have a question…
    when the render finishes and saving tiff
    1.should it be 8bit 16bit or 32bit
    2.should i modify the gamma correction while saving the tiff or leave it…..
    thanks alot for your time…

    • Hi,

      If you are burning the gamma in save it as 8bit .tif or .jpg otherwise you will end up with double gamma

      If you are saving out in linear, and then adding gamma correction in Photoshop. Save it out as 32bit tif and the gamma correction will automatically be applied.

      32bit .tif will allow for more control over the image but the file size will be huge.

      You don’t need to touch the gamma correction when saving the file.

  7. marwan on said:

    hi,

    thanks allot James….i think i will go with saving 16bit tiff and adjusting the gamma in Photoshop..

    i’m currently working on a cafe interior with very small areas, i’m having a hard time putting cameras cause no matter what i do a allot of distortion comes in the frame

    please consider making a tutorial to reduce this issue

    thanks for your time

    • If you are using a Vray Physical Camera, you can control the horizontal and vertical shirt in the camera settings. Try to keep your film gate and focal length the same and around 30mm – 40mm. If you find you hit a wall then use camera clipping planes or simply hide the wall.

      If you are using a 3ds Max standard camera you can right click the camera and choose “Apply Camera Correction Modifier”. Try to keep your lens and FOV the same and around 30mm – 40mm.

      Thats all there is to it.

      • marwan on said:

        thanks…i think i got some good shots after clipping.
        but i forgot to tell you about a small problem..

        when taking the tiff to Photoshop and adjusting gamma to 2.2 it gets to bright or pale so i put some extra contrast and adjust brightness to get the same result showing in VFB in 3ds max….is this normal or there is something wrong in my settings ?

      • Are you saving the .tif file that is at least 16bit? If so there is no need to adjust the gamma, it will be done automatically by Photoshop. If you then add a gamma correction on top you will have double gamma.

        You only need to add a gamma adjustment layer if you render out using 8bit file formats such as jpg. Not recommended as you will loose a lot of information about the image this way, and therefore the image may not look exactly as the image in the VFB.

      • marwan on said:

        i’m saving the image .tif 16bit default gamma
        but when opening it in photoshop it comes dark (exactly the same output in VFB without selecting sRGB ) so i adjust the gamma to end up with the bright image..

  8. am doing all but the final rendered image is dark if i clicked display colors in sRGB its looks nice. when i save the image it is dark and not the sRGB corrected image. wat should i do pls tell the way to my email

  9. El Hankash on said:

    Good day,
    There must be something I am missing about the linear workflow, The colors look washed out, as if the contrast between different materials is too low, wish i can upload some samples to explain more my point.

    Can you please help?
    Regards

    • Tick clamp output and sub-pixel mapping to remove areas that are beyond white (255). Saving as EXR will allow you to store these values beyond white that’s why they look OK in Photoshop. Or use an exponential filter or reduce the burn value of the reinhard filter. 1.0 is linear 0.0 is exponential, anything in between is a mix of the two.

  10. And one more thing.

    HDRI (VRayLight – Dome) is loaded with its own gamma. What gamma to use in color mapping?

    2,2 as on the picture above or set it to 1,0?

    • Set the colour mapping gamma to 2.2 and tick don’t affect colours. This will allow you to see the render in gamma 2.2 space but it will save it out as linear. Then save the file as an EXR which will auto apply a gamma correction curve in Photoshop to bring it back to 2.2. The whole point of rendering linear is so that every value is physically correct for compositing purposes. This may not suit your own workflow, some users prefer to burn the gamma into the image instead.

      • Thank You for help and shareing knowledge and experience!

        Great place here, many useful information and so well expaliend.

        Wish You all the best in new year.

  11. swarthykhan on said:

    I follow this site regularly and I learnt a lot but about this gamma issue sometimes I get unexpected results and I need to make sure the problem isn’t about the gamma. I did everything as you described. Somehow the materials don’t match the rendered result. Could the lights be the culprit? When I lower the intensity of the lights the luminosity of the scene decreases so I increase the exposure and the result is the same. I am stuck at this level and I am going to lose my mind over this. What other causes could there be?

      • swarthykhan on said:

        Man! You are fast. I am grateful for that.
        I ticked adaptation only and used vray frame buffer with show srgb on. The result didn’t match so I didn’t even save it. I must be doing something wrong but I couldn’t figure it out. The last thing I thought that it could be a light balance issue. Nothing complies with material editor. It seems like gamma issue at first so I thought but I couldn’t find any mistakes in my workflow and double checked it here again.

  12. Hi James ur blog saved me literally! though i have a question. i did the gamma thing 2.2 in max , render n materials..But i think first; the result is too dark and another thing one of the materials is grey but its actually goin purplish… i will send u the rendered image on ur email if thats okay so u wud knw wat im talking about…
    THanks in advance

  13. Fouzi Mohammed on said:

    Hi James,I just saw this tutorial today only. I have been following L.W.F for past few months n am pretty much happy with results comparing to non L.W.F method.i started using L.W.F with the help of another tutorial which i came through.
    (so far, i too follow almost all steps as per your tutorial,except i use Reinhard in color mapping,leaving gamma as 1 n rendering it in max default render frame window and saving out put as .exr file which will be converted later into 8 bits image in Photoshop for post render editing)still i have few more doubts about L.W.F…hope u can clarify

    1.am concerned about color mapping of vray settings while we follow L.W.F..Is it mandatory that we should select Linear Multiply only,not Reinhard or other options..?
    2.is it compulsory to go for V.F.B (not max default render frame window}?

    • Hi,

      In order for a file to be absolute linear, you must use linear multiply. Other filters clamp the colours and therefore are no longer linear. You can render linear images without the V-Ray frame buffer however it has useful features such as the ability to toggle between linear and sRGB (gamma 2.2).

  14. Fouzi Mohammed on said:

    Hi James.
    thanks a lot for such a quick reply.i shall try it out in my next project.but one last thing.what about saving the final out put as .exr file.does it go along with such settings u have mentioned here?
    of course i understand u r suggesting to go for 16 bit tiff,then does it have to convert in Photoshop to 8 bit images in order to get final image in JPEG format?

  15. Cant paste link here. Go to Youtube and use Youtube browser, and look for: Gamma Correction and Linear Workflow

    James canal is: jpcutler85

  16. If im not using any hrdi or exr files can the bitmap files input gamma and output gamma be set to 2.2.

    and if im using hdris or exr can the overide button be set to 1.0 in the bitmap map solve the gamma correction

    • James Cutler on said:

      If you are using V-Ray, the output gamma should be set to 1, otherwise double gamma will be applied. Gamma correction on output is applied through colour mapping instead. HDR and EXR images should be kept linear.

  17. Mursil Butt on said:

    Dear sir,
    so nice of you for the great tutorial, i followed exactly what was mentioned in the tutorial but when time comes to apply a gamma of 2.2 in photoshop the image gets too bright, specially when i am rendering a night room scene with 2 table lamps beside the bed, even when using sRGB in V-ray VFB the image washes out, colours loose there saturation, however it looks great in render but the only problem with this is that dark areas look too dark…. please help

    • It is possible that you are saving out the image with gamma already applied. Then you are applying gamma again in Photoshop. You will have to adjust your lights to accommodate the gamma changes as you may find that parts of your scene are not bright enough.

  18. “affect background”

    What is the background?
    1. Rendering>Environment&Effects>Environment>background?
    2. If i use VRayLight Dome and HDR image to light the scene my HDRI is the background in this case?

  19. bianca on said:

    man, thanks a million. as usually, complex and extremly annoying problems have simple solutions. it fixed my problem.

  20. imran khan on said:

    thanks for great tutorial,

    i have one problem i follow the same thing as you mention but when render finished and i save the output in 16 bit n when open it than image look very dark as we see in vfb mode…so i save it again in max with 2.2 gama in overwide saving option than image look same as i see in SRGB mode….so is it ok….pls help….

    • When I saving in 16 bit you have to manually add a gamma correction in post but it will never match the image in the V-Ray Frame Buffer exactly. To do this add a levels adjustment and change the middle slider to 2.2. 16 bit image formats are not considered as floating point, so no gamma correction will be applied by Photoshop automatically.

  21. shamer on said:

    hi
    thnx in advance

    and if i change the input gamma as 2.2 in preference gamma/lut correction,do i have to use gamma override 2.2 in bitmaploader?

  22. Ilija on said:

    Hi James,

    When I use LWF (everything same as you explained) it ends up with very good contrast and materials but extremly bright areas around the light source like windows and overexposed walls . Until now I always used exponential or reinhard and had pretty good results. However I would like to start with linear color mapping since, as you said, it is the most mathematically correct.
    Do you have any advice for me regarding the overexposure?

    Thank you in advace,
    Ilija

    • These extremely bright areas are not incorrect and would typically be glares or blooms when taken using a real life camera. Try using colour clamping at 4 or 5 and sub pixel mapping. This will reduce the dynamic range of colours therefor lowering the brightness of these areas.

  23. imran khan on said:

    This is great tutorial…and thanks for that….i got every thing perfect in render accept the color which i use in any object….color value looks not appropriate in render as the color looks in color materials…pls help

  24. imran khan on said:

    i checked in sRGB mode in v-ray frame buffer every texture looks perfect only simple color of v ray material look whitish so what should i do….pls help

  25. Ilija on said:

    Thanky you very much for your answer, I really aprreciate it.
    I will try with color clampout and subpixel mapping, but I thought that those things should be unticked, since we are saving the image as 32-bit exr with full float, and that means that we are saving the full color range. Does this mean that the image is going to lose some of its quality?

    • Colour clamping will reduce the dynamic range but it will more often than not cut off dynamic range you wouldn’t even use. By setting clamp output to 4 or 5 you will still get ample of dynamic range within the 32-bit EXR.

  26. imran khan on said:

    ok….thanks…i got it…:):) but still one query if i select any color than it chagnes little bit…like if i change the color to pure yellow than i correct Reassigning the RGB value than it change little bit…so what should i do for getting perfect color…

  27. NOUFAL on said:

    Thanks a lot.
    But their is a problem , Am an interior designer when i render an image in max some time some colors that affect on some areas would u please send the manual configuration

  28. Hansel on said:

    There seems to be some error somewhere in saving 16 bit seperate renderelements. I save these out as 16bit on the renderfarm but when i open it in photoshop it shows as 8 bit. So i tried rendering them on a single machine, it renders out fine and saves as 16 bit. I do not know where the problem is lying. Is it a ram issue? Can you please help me out here? The renderfarm nodes are 16 gb ram and quadcore systems. Some files when rendered on the renderfarm render perfectly with 16 bit tiff.

    • Is this your own Render Farm or a commercial one? It could be that it is trying to save via the 3ds Max frame Buffer in a different format instead of V-Ray’s own VFB.

  29. praveen on said:

    hi james when ever i use gamma 2.2 my render out put have more whitish tint with less saturation textures are comming improper but wen i change colour mappping only no gamma its comming much bettetr

    • For any previous scene you can just adopt the gamma settings. For new scenes it is all set up automatically for you in 3ds Max, just make sure it is enabled and set to 2.2. Bitmap files should be set to automatic when loading them into the material editor. The V-Ray settings remain the same.

Leave a Reply

Back to top