Color managment and Linear color space work flow in Kray
From Kraytracing Wiki
About color management in general
Color management is quite a broad topic but in general the problem of colors and light lies in the process of how each device interprets color values. This is because each device you use, be it scanner, monitor, photo camera etc. "sees" colors differently. The problem is further complicated by the fact that each device sees only part of a color space (also called gamut). That's why some clever heads at International Color Consortium (ICC) developed a way how to convert colors correctly from one device to another. They developed special files with .icc/.icm extension, which contains information about device gamut and with this software can convert colors from one device to another.
Now to take advantage of all that first of all your devices must be calibrated correctly. Most importantly your monitor. There are several websites with information about how you should calibrate your monitor and therefore I won't go into details here. Here are some links to get you started:
The second very important rule is that you use color managed image editing software in your workflow (which must be correctly setup obviously). Since not all software supports color management make sure you use software that does. Check the above links for some guidelines.
What is linear color space workflow and why would you want to use it?
First of all I recommend reading HDRI mag #18 & #19 . The author Gerardo Estrada explains in depth what Linear color space (LCS) workfolow is all about and what tools you can use inside LightWave to take advantage of it. Even though this tutorial may overlap with some things written in those articles I will not go in depth about all the things.
In short: LCS workflow will help you in two important areas:
- more realistic lighting, shading and optical effects
- color consistency (keep the original intended colors in the output media as much as is posible)
This is because with LCS workflow you follow color management rules like you are supposed to and not just eyeballing the color values. This way you will insure consistent colors across your workflow.
Linear color space workflow in LightWave and Kray
So far I've been talking about software in general, but what about our beloved LightWave and Kray? Unfortunately LightWave has no settings for color management built in. This means that your textures or colors will look quite a bit different (darker, more contrasty) than they are supposed to. This is because LightWave doesn't know anything about gamma or let alone color profiles. Here is an extreme example of what can happen to your images if you view them in a non-color managed software (like LW) http://www.color.org/version4html.xalter In a color managed software the four images will have very similar colors, but in a non-color managed software they will look completely different.
What about Kray? Well kray is a little bit better in this field because at least it supports gamma adjustment. Note though that gamma is only one part of the color managment process. Gamma will not give you any help with converting colors from one color gamut to another though. Only icc profiles can help you with that.
Fortunately though there was recently a free plugin released that allows correct color management in LightWave:
"The Color Correction Tools by Sebastian Goetsch (SG_CCTools) is the first color management system that has been developed ever within any 3D commercial software. Sebastian Goetsch has solved brilliantly a system that not only implements color management facilities within LightWave 3D, but also facilitates a lot the Classic Linear Workflow." quote from http://www.lightwiki.com/SG_CCTools_-_For_Color_Management_and_Linear_Workflows
With this tools we can finally work in a color managed workspace and get consistent colors as well as correct light diffusion in our renders. It's not as comfortable as it would be with built in color management but it's currently the only way to maintain correct color management in LW.
Basically what we will be doing is: taking input colors and images and converting them to linear color space which LW understands and after finished rendering convert them back to log(gamma corrected) space to view them on our monitor. (More information: HDRI 3D Issue #18, page 73).
Color management put into practice
First of all I assume you have your monitor (and any other relevant devices) calibrated and your image creation/editing software uses color management. Why? Because you will need to know what in what color space your images are so you can assign them correct profile later in LightWave.
Then you will need to get free SG_CCTools plugin for LW from Sebastian Goetsch: http://www2.informatik.hu-berlin.de/~goetsch/CCTools/ You will also need color profiles you use in your process. The best way is to search your system for files ending with *.icc and *.icm. You will probably find quite a lot of files. The ones you will moste often need are probably sRGB, AdobeRGB, ProPhotoRGB your monitor profile and possibly some others. It's best to copy them to a separate folder because you need to tell SG_CCTools where your color profiles are otherwise it won't find them by itself. I have created a folder inside my SG_CCTools plugin folder called "profiles" and copied all profiles i need there. You also need to create colorprofiles.txt file with path to your profiles as described in the [download page].
The important thing on which you must decide before starting working in LCS workflow is what your working color space will be. Don't worry, it's not a rocket science. Basically you need to know what your final output will be. If it is print then AdobeRGB (or even ProPhotoRGB) is probably best. If you work for web then sRGB is most suitable. Working color space is important because it defines the color gamut of your images. Read [page] for more information.
Because LightWave doesn't understand .icc profiles, or have gamma adjustments internally, we must do this manualy. And when render is finished we can convert result back to correct color space. This is why you will need a linearized version of your working color space profile. Follow the guidelines on how to create one on [pages] where Gerardo writes about using ProfileInspector to do this.
Also make sure you installed SG_CCPicker which should be your default color picker when working in LCS workflow. It's the only color picker that can convert your colors accurately into linear space.
When all is set you can start working:
- First of all you should add a SG_CCFilter to all your images in Image Editor. On the processing tab in image editor you will find it among the filters list. This will present you with a option to select your input and output profile as well as input intent.
- Input profile should be the profile embedded in your image. If you don't know what profile is embedded in your image you can open Photoshop and it will show you what profile is embedded in your image.
- Output profile should be set to the LINEAR version profile of your chosen working color space. In our example we will use AdobeRGB Linear.icc that we created earlier using ProfileInspector.
- Input intent is a way how colors will be mapped from one color space to another. The choice depends on the colors in image and in relationships between source's and destination's color gamuts and white/black points. Most common choices are perceptual and relative colometric. You can read more about this here: http://www.cambridgeincolour.com/tutorials/color-space-conversion.htm and here http://www.normankoren.com/color_management.html#Rendering_intent
- Output intent is not important in this case (since we're not adding more SG_CCFilter shaders) and will not influence your image. You will see how image immediately turned darker. This means image is now in a linear space and ready to render in LightWave.
- Next thing you should do is pick your colors with SG_CCpicker. On the config tab of the SG_CCPicker panel "Screen" should be set to log or sRGB and "Output" to linear. You will see how colors in LW turn darker than those you have picked. This is correct since now colors have been linearized.
- For Kray I recommend to turn render output to HDR. This will render with gamma 2.2 by default and give you a good approximation of image (which is ok for previewing purposes).
- When image has finished rendering load it back to Image editor and add SG_CCFilter shader to it. This time you should set input color profile to the LINEAR version profile of your working color space you used in previous steps. This will tell SG_CCFilter that image has been created in that space. Output profile should be set to the regular version of the same profile you used for the working space. So for example if your working color space was AdobeRGB Linear.icc then your output profile should be AdobeRGB.icc.
- Now your image is in a correct color space and you can save it to disk. When opening this image in photoshop it will tell you that no profile was found. This is because SG_CCFilter doesn't actually write profile to image, it only allows changes color based on the color profile. So you will have to manually tell the Photoshop what profile to assign to image. Note: when opening HDR images in Photoshop you will need to set gamma to 0.4545 manually because Photoshop automatically uses gamma 2.2 on all HDR images.
- You should choose your working color space profile (non linear version). In our example this would be AdobeRGB. Your image may look slightly different than the one in LW Image editor. This is because Photoshop also uses your monitor .icc profile to color correct the image for your monitor.
But wait we can do that in LW image editor too - although manually. What you need to do is instead of setting output profile to AdobeRGB, replace it with "your monitor profile".icc. Just be sure you don't save the image with this setup, because once you open the image in Photoshop it will add another color correction for your monitor on top and you will end up with wrong looking image. But wait, there's more - this setup in Image editor has more advantages: you can acctualy mimick (soft-proof) colors how they will appear in different output mediums (HDTV, cinema and even print). For more information about this take a look at the bottom of Lightwiki pages under "PostProcessings"