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.
The "simplest arithmetic" changes dramatically depending on the workspace icc profile.
I created a linear icc profile and the linear dodge blending then matched what it looked like while in 32bit mode.
There seems to be some gamma mapped arithmetic when the icc profile is sRGB or adobeRGB.
Im looking for the math formula that is being applied when a more common icc profile like sRGB or adobeRGB is in use.
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.
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.
The issue Im trying to solve is the very basic summation of raster passes generated from a 3d renderer.
Typical CG shaders simply add the components(reflection, diffuse, specular etc) to produce a beauty image.
Linear dodge blending mode is the right choice to do this in photoshop.
This works perfectly when photoshop is in 32bit image mode.
When the photoshop image mode is changed to 8bit, linear dodge layer blending produces a very different result.
Clearly this is as a result of gamma mapped arithmetic with color profiles like sRGB or adobeRGB.
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.
Our clients want final photoshop files using adobeRGB icc profile working space.
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. I have tried reverse gamma values
like 0.45 but this is not working.
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).
Sorry I left out an important part. We need to keep the layers separate in 8bit so they can
still be manipulated.
Im actually surprised that this issue has not been resolved long ago.
Rendering separate passes is very common as is the use of photoshop in retouchiong such CG
render layer sets.
I would stay in 32bit mode but the files are gigantic and our clients have requested 8bit files.
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.
thanks Paulo for explaining the issue so well
are there any Adobe software engineers listening to this forum?
Ive tried pre gamma adjusting the 32bit layers prior to converting to 8bit but nothing
that I can think of is working
this cant be this hard can it?
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).
I did just that ... created a icc profile wth gamma 1.0 and yes it worked fine.
The problem is I have to deliver this psd file to users that work in adobeRGB workspace.
As soon as the image profile is converted to adobeRGB the blending results are very different due to
"how data is represented in color spaces".
I must admit Im not sure what the math is, but if you could point me to a document that describes how photoshop implements
linear dodge in adobeRGB then perhaps I could pre process the 32bit image to compensate before it gets changed to 8bit.
thanks very much
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.
…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:
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...
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?
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 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
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?
I want to apologize for implying that Adobe engineers were not listening to this forum.
Clearly they are. All the responses are very appreciated.
Noel I had already managed to do as you suggested converting from 32bit to 8 bit with a linear RGB profile.
As you mention this is only half the solution. No one in our shop is willing to work with a linear RGB color profile.
Their standard settings are adobeRGB workspace in 8bit mode.
When I set the workspace to adobeRGB the lineardodge blending mode instantly produces a wildly bright result.
Which as you guys have pointed out is a result of gamma encoded arithmetic in 8bit mode.
(What I am trying to do is sum up CG render passes as layers in photoshop.
In 32bit mode the layers add up to the beauty render.
In 8bit mode they do not.)
I was hoping for a solution using color settings. There is toggle in the colorsetting preferences which allows you to set RGB blending gamma to 1.0.
This does nothing to resolve this issue.
My next attempt is to pre process the pixel layers(with adjustment layers) while in 32bit mode to compensate for the gamma encoded 8bit math. I have tried several things but since I cant find the exact math(searching the web for a long time and found no actual details) no success yet.
The frustration for me is that this is so easy in AfterEffects, Nuke, Shake etc. I am surprised no one has resolved this for photoshop.
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.
We render 32bit float openexr images so there is no color space, they are linear.
I want to give the client the ability to changes the layers as they choose
but they want to do that in 8bit mode.
(I will start another posting regarding photoshop's native inability to view openexr images that do not have
a default header ... render passes from maya create exr files that show black in photoshop)
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?
Just to explain a bit more,
We are rendering renderpasses which are the shading components of a beauty image.
Layers like reflection, diffuse, specular etc are "added" together to re-produce a beauty.
Linear dodge(add) is the correct blending mode.
I want to give the client the means to paint out just the reflection but leave the other components.
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?
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...
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.
Here are the files if you'd like to examine them more closely...
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.
The original image files are created in linear float. The only color management involved is that the viewer used to display the renders
is gamma 2.2 corrected. When these float (openexr) images are loaded into photoshop(32bit mode) they look the exactly as they did
in the CG application viewer.
I am using Maya and mentalray. The render viewer is set to gamma2.2.
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.
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.
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.
... 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.
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!
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.
>> 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).
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?
Im not rendering 8bit images because 8bits does not provide enough color bandwidth for the amount of
colorcorrection that may be required.
Also we want to go with 8bit instead of 16bit due to the size of the final psd file
which will around 150 layers.
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.
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
Thanks for the concise description of the situation.
this mode of operation since they are used to the current non-linear layer compositing in 8bit mode.)
Your arithmetic examples point out the difficulty but I dont think its quite as hopeless
as your math implies.
Although I must admit my simple minded attempts have failed.
If linear dodge in 8bit mode is simply just adding two numbers that have been
pre converted into gamma space, then we should be able to reverse gamma the numbers
befoer they are composited and see a summation that would be the same in 32bits.
I tried this.
With a exposure adjustment layer (while in 32bit mode) I use gamma 0.45. This resulted in
the layers becoming dark. The adjustment layers are merged down, then the image is converted to 8bit mode.
The layer composite result was still not right (too bright).
I going with screen mode for now until I can come up with a way to use linear dodge.
Screen Formula: Result Color = 255 - [((255 - Top Color)*(255 - Bottom Color))/255]
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.
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.