Skip navigation
Currently Being Moderated

linear dodge(add) mode different in 32bit than 8bit mode

Apr 5, 2012 2:12 PM

We are rendering raster passes in cg which need to be added together to reassemble a beauty render.

The layer blending mode being used is linear dodge.

There is a dramatic difference in the result in 32bit mode compared to 8bit mode.

We normally work with adobergb1988 color workspace.

 

Does anyone know what is happening?

What is the math being used in 8bit mode with the adobergb colorspace?

The problem is similar with sRGB profile.

If set up a linear color workspace icc the 8bit mode behaves just like 32bit mode.

However no one in our facility nor our clients wants to work with a custom linear icc profile.

I would like to preprocess the layers while in 32bit mode to compensate for the gamma space

processing of sRGB or adobeRGB color profiles in 8bit mode.

Ive tried simply using a exposure node with gamma 2.2 but this is clearly not right.

 

Help.

 
Replies
  • Currently Being Moderated
    Apr 5, 2012 3:28 PM   in reply to willanie

    willanie wrote:

     

    What is the math being used in 8bit mode with the adobergb colorspace?

    Linear dodge has just about the simplest arithemetic operation possible,  L1 + L2 , where L1 & L2 are the two layers involved and the math is done on a channel by channel basis.

     

    Even with that simplicity if one is blending areas where the spatial changes in color values happens slowly (smooth gradients for example) you will see differences between 8 and 32-bit modes just from the math precision.

     

    Perhaps you are asking something deeper, but I would expect some differences.

     

    Paulo

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2012 9:33 PM   in reply to willanie

    I think I better understand your question now. As far as I know, however, I believe the math is the same in 8 and 32 bit modes.

     

    I seem to remember that when you convert to 32-bit mode Photoshop does more than adjust the precision. It automatically converts to a linear profile and changes all the pixel values so the image looks the same. So if you now do a blend, different pixel values are used in the same math (when compared to doing the blend in 8-bit mode with typical profiles) hence different results. It also explains why you get the same result when you change the profile from sRGB or AdobeRGB to  a linear profile.

     

    Have not done work in 32-bit mode so this is speculation on my part.

     

    Paulo

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2012 11:29 PM   in reply to Paulo Skylar

    The math is the same in 8 bit and 32 bit.

     

    But 8 bit is gamma encoded, while 32 bit is always gamma 1.0 (linear light).

    So the values are changed when converting bit depths.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 6, 2012 12:17 PM   in reply to willanie

    I may still be missing some of what you are describing.

     

    It appears that the process results you want are provided by the linear dodge blending in 32-bit mode. This occurrs  because 32-bit mode only happens in Photoshop with a linear profile.  So, if you have the image results you want in 32-bit mode can you not just flatten the image and then convert to 8-bit mode? Except for some quantization differences that result from the 32 bit to 8 bit resolution change you will then have an 8-bit mode image with proper appearance and an AdobeRGB profile (or whatever profile you had initially set your document to).

     

     

    Paulo

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 6, 2012 3:27 PM   in reply to willanie

    Ok, so you have numerous  constraints. I think I finally understand the question.

     

    The problem is that you basically want to have photoshop produce a linear summation of light (via blending) from numerous layers, but done in an 8-bit document that treats light in a coded or non linear way, that is, in a document  having  a profile such as AdobeRGB.  I do not know how to do that !

     

    Having you and your clients both working in 32-bit mode seems like a necessary way to go even though it is unattractive from a data storage & data transfer perspective. Others who may have experience in this speciality will have to jump in.

     

    Paulo

     
    |
    Mark as:
  • Noel Carboni
    23,459 posts
    Dec 23, 2006
    Currently Being Moderated
    May 3, 2012 3:04 PM   in reply to Paulo Skylar

    If you want things combined in linear space you could just convert to a custom RGB color profile with gamma 1.0

     

    Working in 16 bits/channel would cover up any quantization problems. 

     

    This is along the lines of what I do in my OpenGL-based software, since the combination of data (e.g., textures, colors, etc.) in that realm is most straightforward without gamma precompensation.

     

    There is no problem with Photoshop here.  You might want to brush up on color-management to understand how data is represented in color spaces (this is directed to the original poster).

     

    -Noel

     

     

    ConvertToLinearRGB.jpg

     
    |
    Mark as:
  • Noel Carboni
    23,459 posts
    Dec 23, 2006
    Currently Being Moderated
    May 3, 2012 4:35 PM   in reply to willanie

    So the problem is that you want to work in a linear space, but then change over to working in a gamma-precompensated space and have the layer combinations do the same things?  In general that's not going to happen, though I now see why you're interested in what Linear Dodge does.

     

    Without getting into just what it is you're doing, it seems to me you have three choices:

     

    • Work the way you're working now and have your recipient continue working in linear space.
    • Work the way you are now, flatten, then convert to a gamma-precompensated color space for use by someone else.
    • Change the way you work so that you combine things the way 99.9% of the rest of the Photoshop world does.

     

    Maybe you could use Google or the Photoshop help search to get descriptions of what the blending modes do; I don't know a good reference.

     

    -Noel

     
    |
    Mark as:
  • Currently Being Moderated
    May 3, 2012 10:12 PM   in reply to willanie

    willanie wrote:

     

    …are there any Adobe software engineers listening to this forum?…

     

    It just doesn't get more authoritative than Chris Cox, a top Adobe engineer who has been writing Photoshop code for some 16 years or so.  He already replied to this thread, see post #4:

    4.

     
    |
    Mark as:
  • Pierre Courtejoie
    7,038 posts
    Jan 11, 2006
    Currently Being Moderated
    May 4, 2012 1:01 AM   in reply to willanie

    I know that smart object can contain images/layers in a different color space, it might be worth trying. But their "external" behavior will be the same as the external profile. Just in case...

     
    |
    Mark as:
  • Noel Carboni
    23,459 posts
    Dec 23, 2006
    Currently Being Moderated
    May 4, 2012 5:59 AM   in reply to Chris Cox

    Question for Chris Cox:

     

    Just in testing Photoshop CS6, I see that Image - Mode - 16 bits/channel (coming from 32 bits/channel) always appears to add gamma precompensation.  I even tried assigning a linearized sRGB profile I had created, and the depth conversion changed it to sRGB proper (with 2.2 gamma).

     

    Through manipulation of the settings, can an image be converted from 32 bit directly to a 16 bit linear color space?

     

    -Noel

     
    |
    Mark as:
  • Noel Carboni
    23,459 posts
    Dec 23, 2006
    Currently Being Moderated
    May 4, 2012 6:17 AM   in reply to Noel Carboni

    Never mind, Chris, I answered my own question.  I had a momentary lapse of reason due to insufficient coffee.

     

    In your Color Settings, set your preferred RGB color space to a linear RGB profile, then when you convert from 32 bits to 16 or 8 you'll get a direct conversion to your preferred RGB color space, which will be linear, and the layer mixing will be as it was.

     

    So that solves half the problem, and allows someone to continue to work on the image at a color depth of less than 32 bits.

     

    -Noel

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 9:57 AM   in reply to Noel Carboni

    Noel Carboni wrote:

     

    ...

    So that solves half the problem,

    ...

    I just went over this thread, and may be I'm missing something, but it seems that the OP solved that problem as explained in post #5

    willanie wrote:

    ...

    I know this from seeing how 8bit mode behaves when I use a custom linear icc profile. With this linear icc profile

    linear dodge sums up the layers so the final image matches what it looks like in 32bit mode...

    And what is the other half of the problem?

     

    A question @ willanie, how did your images end up being in the Adobe RGB color space?. Is your 3D program color managed and can assign color spaces?

     

    Just curious

     
    |
    Mark as:
  • Noel Carboni
    23,459 posts
    Dec 23, 2006
    Currently Being Moderated
    May 4, 2012 10:03 AM   in reply to emil emil

    I didn't perceive from post 5 that in 8 or 16 bits/channel mode he was able to get images that mix the layers in the same way as 32 bit mode.  In fact, this language says otherwise:

    I would like to figure out what I can do to the layers(exposure/gamma) while they are still in 32bit mode so that they produce a correct summation when the image mode is changed to 8bit.

    That's why I suggested a way to set up Photoshop so that the conversion from the 32 bit linear color space goes directly to an 8 or 16 bit linear color space.

     

    As far as getting the image into the client's gamma-corrected color space, either the image needs to be flattened or the client's expectations need to be changed (as I said in post 12).  There's simply no getting around that, because plain and simple - the RGB values are changed when converting to the gamma-corrected color space, so they're not going to add up to the same results.

     

    -Noel

     
    |
    Mark as:
  • Noel Carboni
    23,459 posts
    Dec 23, 2006
    Currently Being Moderated
    May 4, 2012 10:34 AM   in reply to willanie

    willanie wrote:


    I want to give the client the ability to changes the layers as they choose

    Something that's gone unsaid here is that you're expecting to mix layers using just Linear Dodge.  That can only result in lightening.  Is everything you're layering over the top of your background just adding light?  Nothing on a layer could possibly darken anything from a layer below with strictly Linear Dodge blending.

     

    You do realize that a typical Photoshop user is going to want to use other modes for blending, and those who normally work in gamma-corrected space are going to expect the blending modes to work just like they do with their typical imagery, and they'll anticipate the blending they're used to.  You might be working too hard at this.

     

    Have you actually tried providing a file that's just converted to Adobe RGB to them, with all the layers just set to Normal blending?

     

    -Noel

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 10:55 AM   in reply to willanie

    you have to give more details to be clear what you are doing and what is your goal.

     

    First question: The rendered image/s  were created in a certain program referring to a preview that gives some expectations for the rendered result. Was that preview color managed? In other words what color space and gamma settings were used? If it was a non-color managed program, the preview was in to the color space of the monitor so, the question remaining then is what gamma settings were used for previewing the final result.

     

    Second question, is the rendered result when checked in any program, color space, etc approved to match some pervious result or some expectations. In other words do you like the image/s displayed in someway somewhere - in a certain program displayed with a certain color space, gamma settings, 32 or 8 bits ?.

     

    Third question. What do you want to achieve with the approved result? Your answer to this seems to be "convert from 32 bits to 8 bits and retain the layers" Photoshop displays 32bit images with no gamma correction which makes it different from images displayed in 8bit using standard color spaces all of which are non linear (have gamma curves). The question is, do you want to keep the appearance of the 32bits after converting to 8bits or do you want to simulate the appearance of the 8bits when in 32 bit mode?

     
    |
    Mark as:
  • Noel Carboni
    23,459 posts
    Dec 23, 2006
    Currently Being Moderated
    May 4, 2012 11:23 AM   in reply to willanie

    Thanks for the clarifications.  Okay, I think I better understand what you're doing.

     

    Some time ago I had to solve a problem not unlike this in the combination of light effects in my StarFilter plug-ins, so I actually do have some insight into what you're trying to accomplish.

     

    A way you can get VERY CLOSE to the mixing effect you're seeking is to switch to Screen mode mixing, though you'll have to change the color values in the individual layers in a complex (but consistent) way to compensate for the fact that they've been gamma-precompensated...

     

    Try this:

     

    1.  Create a multi-layered test image with several lighting effects and Linear Dodge mixing.

    2.  Duplicate that image.

    3.  Change the image to 16 bits/channel, which involves converting the image values to a gamma corrected color space.

    4.  Change the layer blending to Screen.

    5.  Make Curves adjustments as shown below to the lighting effects layers.

    6.  Convert to 8 bit mode for final output to your Photoshop users, assuming they can't use 16 bit mode (which could give them a quality advantage down the line).

     

    Screen also has the effect of smoothing the transition into overexposure, as it will not allow any result greater than pure white.  This may help your folks doing Photoshop work on the renderings (e.g., they might be able to brighten an effect without running into nasty white-out).  As you can see, the results can be visually almost identical.

     

    32_vs_16_Bit_Mixing.jpg

     

    Here are the files if you'd like to examine them more closely...

     

    http://Noel.ProDigitalSoftware.com/ForumPosts/32_vs_16_Bit_Mixing.zip

     

    I used Curves adjustment layers to clearly show what's needed for the precompensation, but you could of course bake the changes into the pixel values.

     

    -Noel

     
    |
    Mark as:
  • Noel Carboni
    23,459 posts
    Dec 23, 2006
    Currently Being Moderated
    May 4, 2012 11:20 AM   in reply to willanie

    willanie wrote:

     

    The goal is to convert and keep the layers from 32bit mode to 8bit mode using linear dodge blending mode and make it look the same.

     

    See my prior post for a possible solution, achieved by changing the constraints of your problem slightly, but possibly workably.

     

    You're just not going to be able to use Linear Dodge on gamma-compensated data.

     

    -Noel

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 11:38 AM   in reply to willanie

    OK, so the look of the image is approved when displayed in 32 bit mode using the Adobe RGB color space in Photoshop. How this is matching a non-color managed program with a different gamma settings is a mystery but let's forget about this and take it from the fact that the image is approved as it is and you want to keep it the same when converting to 8 bit, and also to a non- linear gamma, while preserving layers, right?

     

    To achieve that, follow the Noel's instruction quoted below that I thought you have already tried.

    Noel wrote:

    ... In your Color Settings, set your preferred RGB color space to a linear RGB profile, then when you convert from 32 bits to 16 or 8 you'll get a direct conversion to your preferred RGB color space, which will be linear, and the layer mixing will be as it was ...

    After that chose Edit > Convert to Profile and choose Adobe RGB.

     

    Let us know if this doesn't solve all of your problems.

     
    |
    Mark as:
  • Noel Carboni
    23,459 posts
    Dec 23, 2006
    Currently Being Moderated
    May 4, 2012 11:51 AM   in reply to emil emil

    Emil, download the 32_Bit_Test_Image.psd file I posted above and actually try it.  You'll see the huge difference in mixing that willanie is talking about first hand, because in the Edit - Convert to Profile conversion process the color values are gamma-precompensated.  Adding them nets unwanted extra precompensation! 

     

    -Noel

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 12:29 PM   in reply to Noel Carboni

    Ok, I see.

    So, the only problem is with preserving the layers at the conversion at 8bit from the custom profile to Adobe RGB.  If you choose not to preserve the layers in the conversion window the image doesn't change

    Given this limitation, I guess the only choice for editing layers is to keep the files with the custom color profile.

     

    and the interesting thing is that soft proofing with Adobe RGB doesn't change the appearance.

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 12:41 PM   in reply to willanie

    >> What I am trying to do is sum up CG render passes as layers in photoshop.

     

    Then you need to be working in gamma 1.0.

    I'd advise staying in 32 bit/channel if at all possible.

     

     

    >> The goal is to convert and keep the layers from 32bit mode to 8bit mode using lineardodge blending mode and make it look the same.

     

    Again, that means you'd have to convert to a gamma 1.0 profile for 8 bit.  (and gamma 1.0 isn't a good idea in 8 bit because of quantization, you really want 16 bit/channel).

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 1:07 PM   in reply to willanie

    And I would add that the whole point of rendering to 32 bit files is to be able to edit non distractively taking advantage of the 32 bit. If the plan is to edit in 8bit then why not render the images at 8bit files in the first place?

     
    |
    Mark as:
  • Currently Being Moderated
    May 4, 2012 2:14 PM   in reply to willanie

    You can't really have 8 bits, gamma 1.0 and good image quality.

     

    If you have to use gamma 1.0, then you need more than 8 bits.

    And your workflow is setup to require gamma 1.0.

     

    Ideally you'd stick with 32 bit/channel data all the way through.

     
    |
    Mark as:
  • Currently Being Moderated
    May 5, 2012 6:40 PM   in reply to willanie

    Willanie, the problem here is that layers composite differently in a linear color space than in a non-linear color space. 32-bit mode in Photoshop always uses a linear color space and the OpenEXR spec calls for a linear color space. When you convert to 8-bit Adobe RGB, you are no longer in a linear color space and that is why the layers don't composite the same. There is no way around this in Photoshop, After Effects, or any other program.

     

    Well, a near work-around is to check "Blend RGB Colors Using Gamma 1.0" in Color Settings. You said it didn't work for you though. I'm not sure why.

     

    And as was also mentioned before, Screen transfer mode in non-linear closely resembles Add (Linear Dodge) in linear. So that can be another work-around.

     

    But really, a non-linear comp can never perfectly match the linear one. If you want a technical explanation, it has to do with the order of operations.

     

    When you view a linear comp on screen it's:

     

    linear layers ->composite -> linear to non-linear conversion -> view

     

    When you convert to 8- or 16-bit Adobe RGB, the order is:

     

    linear layers -> linear to non-linear conversion -> composite -> view

     

     

    Changing the order of operations changes everything. Sort of like the difference between:

     

    5 * (3 + 2) = 25

    (5 * 3) + 2 = 17

     

     

    Brendan

     
    |
    Mark as:
  • Currently Being Moderated
    May 8, 2012 10:31 AM   in reply to willanie

    Yeah, your formula doesn't work, as you discovered. In 32-bit linear mode, the layers are already dark, they just don't look that way because of the viewer compensation.

     

    You could roll your own linear comp in 8-bit mode by appliying an adjustment of gamma 0.4545 to each layer (the adjustment layers have to be grouped (see the little arrows) so they only effect one layer, not everything below) and then float one adjustment layer at the top with gamma 2.2.

     

      Screen shot 2012-05-08 at 10.22.06 AM.png

    But even with this method you will get a shift because the gamma 0.4545 operation will crush some of your darker pixels in 8-bit. This is what Chris meant when he said that you can't do good-quality linear with 8-bits. It performs a little better in 16-bit mode.

     

    But really what you want to do is not a good idea. Screen is your best bet.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points