PDA

View Full Version : Contrast Loss in LINEAR WORKFLOW


govindk
09-27-2012, 08:09 AM
While doing a test for Vray in Maya for linear workflow, I noticed that there is a lot of loss in the contrast when you add a sRGB LUT to the viewer.

When try to bring back the contrast in NUKE (with a grade node), the result seems unsatisfactory. Even the AO pass seems to brighten up excessively.
Wanted to know few workarounds for this issue. I mean to get the contrast back.
One thing I figured out was to copy the same image and desaturate it and overlay it to the original, seems to get back a little contrast. Or to use an AO pass and mult it over.

Here is the TEST image I am working on:-

http://img31.imageshack.us/img31/1897/linerh.jpg

(The swatch is corrected to LINEAR WORK FLOW)

kanooshka
09-27-2012, 02:37 PM
The linear image looks correct for the matte surface you have. If you're trying to achieve a darker feel, trying working on the ratio between specular and diffuse reflection. Also make sure you're using either 16 bit or 32 bit images before you're converting the LUT. Also make sure to ungamma any textures or swatches with a .455 gamma.

-Dan

govindk
09-27-2012, 03:20 PM
hey kanooshka,

I felt that my matte is wrong as well.
Here are my setting for Vray http://imageshack.us/a/img545/5387/capturebgi.jpg

I read that in V-Ray (un-like mental ray) if you select affect swatches, it takes care of the gamma part of adding .454 (i can be wrong of course, because I am still learning V-Ray).

I think I will try Reflection like you said and see if things darken a bit more.

Thnx a lot for the help !!

dannyboy374
09-27-2012, 11:38 PM
Hey there, here's the workflow I use:

In color mapping, type is 'linear multiply', and set the gamma slider to 2.2

Check affect background, subpixel mapping, and don't affect colors. do NOT check linear worklow.

In your vray frame buffer you can toggle on the sRGB, this will let you see it in the correct gamma.

I'd render to a 16 bit exr.

In vray you don't have to worry about the .454 tricks anymore, having the settings under color mapping will take care of all of that for you.

dannyboy374
09-27-2012, 11:40 PM
One other thing, a good way to keep all your textures kosher, I'd open them in nuke, regardless of their format, and save them as an .exr. Being an exr, maya/vray will take them down to .454, and you can even see this in your texture swatches. exr in, exr out, it'll simplify your life :)

Panupat
09-28-2012, 01:49 AM
danny - the right one is "physically" correct. And the good thing is, you can always adjust it later to get the effects you want. Linear images (exr, hdr) stores a lot more information than, say, jpg or png. So you can darken or brighten them much more.

govindk
09-28-2012, 06:47 AM
Hey dannyboy374, thnx for the tip.

CG TALK is awesome for this, I get tips that I don't find in tutorials !! will do that .exr conversion in NUKE...saves time. However Since I started texturing in Mari, I can output exr directly from it, so no worries.

Anyways, When I un-check the LINEAR WORKFLOW button, I get extremely "blown out" results, on a simple "matte grey" v-ray Shader.

I did post a thread about LINEAR WORKFLOW switch on Chaos Group, but didn't get any help so far.

Here's the link:-

http://www.chaosgroup.com/forums/vbulletin/showthread.php?70055-Linear-Workflow-switch&p=561535#post561535

govindk
09-28-2012, 06:52 AM
I know why we check Affect bg, Don't affect colors, affect swatches but why do we check sub-pixel mapping?



I tried switching off and on, the LINEAR workflow button and got these result :argh: :banghead: http://imageshack.us/a/img594/769/newde.jpg


And the "affect swatches" switch, seems to add 2.2 to the shader if checked on and keeps in LINEAR if un-checked...!! I can be wrong but here is an image, just to be more clear to what I mean http://imageshack.us/a/img594/7205/neweq.jpg
However it doesn't seem to make any difference in the final render, I rendered with it on and off, but the render remained same. the render is affected only when I turn the L.W.F switch on & off.

Here is a little HI-REZ image with settings :argh: . (the images are directly screen grabbed from Maya) - http://imageshack.us/a/img821/6766/compilec.png


THIS is what is given on V-Ray for Maya's manual in Spot3D:-

Linear workflow - when this option is checked V-Ray will automatically apply the inverse of the Gamma correction that you have set in the Gamma field to all VRayMtl materials in your scene. "Note that this option is intended to be used only for quickly converting old scenes which are not set up with proper linear workflow in mind. This option is not a replacement for proper linear workflow."
http://www.spot3d.com/vray/help/maya/150R1/render_params_colormapping.htm

earlyworm
09-29-2012, 06:39 AM
Turn off the linear workflow option, set the gamma back to 1, render to EXR and then turn on the sRGB button in the VRay render buffer.

In Nuke, leave the colourspace setting on the read node as linear, set the viewer lut to sRGB. If you compare the Vray render buffer and the Nuke viewer both should match.

You don't say what your output format is. But assuming you just want a JPG image sequence, all you need to do is set the colourspace on the write node to sRGB and hit render.

I avoid gamma nodes in Maya and pre-linearize my textures in Nuke.

I hope that helps. Best to keep things simple when working in linear.

govindk
09-29-2012, 07:38 AM
My out format is going to be exr...!! Used to that from Mental Ray Linear Workflow

I would love to keep it simple, however, different tutorials says different things.
I wanted one that would match, so I can stick to it.

Some say switch on LWF switch with 2.2 gamma (v-ray will automatically inverse everything to .454)..!! :hmm:

Then I read Spot3D and came to know that LWF switch is merely there for legacy purposes.

Expereinced artist like Robert Nederhorst, check's the LWF switch with Gamma 2.2 and seems to work fine. (in his Archetype tutorial in Maya from Gnomon). :surprised

I understood what Linear Workflow is, but how to do it inside V-Ray properly is what I am trying to figure out.




EDIT:-

I made a mistake, R.Nederhorst on Archetype does not use LINEAR WORKFLOW button, got confused with his V-Ray Primer documented in which he has turned on LINEAR WORKFLOW button

Panupat
09-29-2012, 02:31 PM
Well, legacy or not, if you know what it's doing, then it's in your hand to exploit it :) I leave mine off and add Vray gamma attribute to textures myself.

My usual settings are

Adaptive DMC
gamma 2.2
tick - don't affect colours.

You can also tick "affect backgrounds" if you like, but the other 2 I usually leave them off. The reason to do it this way, if you noticed, vray doesn't clear the noises in darker area much. It pays much more attention to the brighter area. Now, if you look at "Don't affect colours" you'll also see (adaptation only.) That means, Vray will use the brighter image only to compute noises. You can really notice the difference if you have soft shadows in your render.

govindk
09-30-2012, 05:54 AM
I use the settings you must mentioned, however I used to use it with LWF switch on.

Now I don't and I apply a 0.454 gamma node to my color swatches (of no textures), and it seemed fine.

Thnx!!

Panupat
09-30-2012, 07:38 AM
You don't need gamma node if you're using Vray.

Simply select your file node, open attribute editor (ctrl+A if it isn't already opened)
choose Attributes > Vray > tick "Texture input gamma"

govindk
09-30-2012, 05:58 PM
You don't need gamma node if you're using Vray.

Simply select your file node, open attribute editor (ctrl+A if it isn't already opened)
choose Attributes > Vray > tick "Texture input gamma"

Even for plain swatches?!

earlyworm
09-30-2012, 11:44 PM
Setting the gamma to 2.2 in the Colour Mapping options* is only for when your outputting to a non-linear format such as JPG. If your rendering to EXR then you want to leave it at 1.

*Exception given to having the "don't affect colours" option on - which doesn't apply any colour mapping to the final image. But I don't use that option and I don't know enough about what it's doing to comment on it.

If you leave the gamma at 2.2 and bring it into Nuke as a linear EXR then all you are doing is doubling up your colour transforms (which is bad for the image) and your confusing what should be a very simple workflow.

Here is a simple setup between Vray and Nuke using a constant shader set to 0.18 (mid-grey). Both the Vray and Nuke viewers are set to an sRGB lut and I'm rendering to an linear EXR. It's simple, easy to understand and is technically correct. If you pre-linearize or add the extra attributes to your file nodes - as Panupat suggested - in order to linearize the texture during rendering then you don't need any gamma nodes (or mention of gamma) in your scene whatsoever.

http://earlyworm.org/3d/images/vray_linear.jpg

govindk
10-01-2012, 03:12 PM
My god!! So many Methods...!!

I am going to copy paste something from an other thread:-

In Mental Ray -
(1) You change the setting under color management,
(2) and under texture file node (depending on what you have set as input under color management),
(3) render window for viewing properly
(4) add .454 gamma node to swatches...!!
(5) rendering in 16 bit or 32 bit exr or similar linear supported format...DONE!! (hope I didn't miss anything)

In V-Ray-
(1) Turning on affect BG, don't affect colors under color mapping and setting Gamma to 2.2
(2) Adding a texture and selecting the bit map input gamma under Vray extra node for 8-bit files
(3)sRGB button for V-Ray Frame Buffer
(4) Adding .454 gamma node to swatches
(5)rendering in 16 bit or 32 bit exr or similar linear supported format

So according to EarlyWorm, tthe above mentioned method's are for jpeg and other 8bit formats..!! For .exr or .hdr we should keep it to GAMMA 1
So all this while even in Mental Ray, I was doing it wrong then.

kanooshka
10-01-2012, 03:28 PM
Basically the rule of the thumb is if it's not an hdri and a color or texture looks "correct" on your monitor. You need to ungamma it before rendertime (.454). This applys to any colors whether it's diffuse/specular file or a swatch on a material or light.

-Dan

govindk
10-01-2012, 04:50 PM
OH!! You have to color correct the swatch on a CG LIGHT? :surprised
There is so much I need to learn regarding the technical part of LWF :banghead:

revilo3D
10-01-2012, 09:42 PM
*Exception given to having the "don't affect colours" option on - which doesn't apply any colour mapping to the final image. But I don't use that option and I don't know enough about what it's doing to comment on it.


Its simple really. If your sampler looks at the image at 1.0 and samples it accordingly - when you apply a sRGB LUT to your image in nuke or the VFB - your image will not have appropriately or sufficient sampling - espeically in darker areas. Setting color mapping to 2.2 but choosing dont affect colors makes sampling take place with a brightened picture - but still outputs an linear image.

Do note guys that sRGB and gamma 2.2 is not the same thing. Be careful of this. From an eyeballing point of view you can't tell the diff.. but sRGB has darker blacks.

earlyworm
10-02-2012, 05:40 AM
Its simple really.

Thanks, that makes some sense - I'll give it a try. But wouldn't you want less samples (relatively speaking) in those darker areas anyway? A little bit of sampling noise in the shadows does help mimic grain/noise.

revilo3D
10-02-2012, 09:58 AM
Mmm perhaps but remember a dark value of 0.2 turns to 0.5 with a sRGB LUT. Now you have issues in your midtones.

It all really depends really too - linear can also have contrasting affects - and may result in oversampling when not needed. Sampling is intended to be adaptive in relation to our perception to achieve quality/speed where needed. The image should really be sampled in relation to as how we will see it :)

govindk
10-02-2012, 11:39 AM
EarlyWorm one more aspect of that "do not affect color," is that if you do not turn in on then it bakes in the gamma value you have set into the image. In your method however, I reckon, turning that switch off doesn't do anything much as you set your Gamma Value to 1.0

After doing a couple of test with different lighting scenario (1 simple rect light, dome light with a black & white ramp, HDR images, etc)...

I feel this workflow suits me better, kinda inclined to what revilo3D & majority of others suggested:- :beer:
(1) Setting Gamma to 2.2, with do not affect color turned on
(2) Adding a texture and selecting the bit map input gamma under Vray extra node for 8-bit files & adding .454 gamma node to color swatches
(3)sRGB button for V-Ray Frame Buffer to view my images properly
(4)Rendering in 16 bit or 32 bit exr or similar linear supported format

However it does lack a lot of contrast which I am still trying to figure out, why?
In some situations I am getting good results with sRGB button turned off. So I think I will un-gamma those images with 0.454 or similar value inside Nuke to get it back. It better to do that, rather than working on non-linear and getting wrong maths.

**And I am also wondering if it is really necessary to add 0.454 gamma node to CG Light (vray light) swatches, like kanooshka suggested. If that's what he meant, I might have understood it wrong.

Here is an image with few of my settings for LWF tests, that I think I will stick with:-

http://imageshack.us/a/img705/7158/10796679.jpg

One interesting observation I made during this test is that - WHEN I applied an HDR images to my dome light and rendered it, without adding "bitmap input gamma," I got a renderTime of 4min on a 800 by 600 rez
by adding "bitmap input gamma," and setting it to 1.0 I got the same result, no change whatsoever in quality or noise but the renderTime went down by 1 min, I got a 3min...

http://imageshack.us/a/img803/7006/87178601.jpg

Panupat
10-02-2012, 12:49 PM
The lack of contrast gives you a lot more information to work with in the darker area. Feel free to adjust it in post to have the desire contrast. It's way better than have an image without enough data.

govindk
10-02-2012, 01:27 PM
The lack of contrast gives you a lot more information to work with in the darker area. Feel free to adjust it in post to have the desire contrast. It's way better than have an image without enough data.

Precisely Panupat!! :thumbsup:
I thought I was doing something wrong, that's why I was loosing contrast.
But continuous tests made me realize that its better to work on post rather than fiddling around with Maya and waiting each time for render to complete.

revilo3D
10-03-2012, 12:37 AM
One interesting observation I made during this test is that - WHEN I applied an HDR images to my dome light and rendered it, without adding "bitmap input gamma," I got a renderTime of 4min on a 800 by 600 rez
by adding "bitmap input gamma," and setting it to 1.0 I got the same result, no change whatsoever in quality or noise but the renderTime went down by 1 min, I got a 3min...

Interesting observation there :) Will keep an eye on that. Do note - HDR is a linear file format and will not be required to be corrected. I think by applying the a correction attribute but not changing it - it's coverting the HDR file into vrays internal format and may be more efficent. Have a look at your memory usage and see if you spot any changes there. This may also be a +1 for apply attributes rather than linear workflow checkbox option.

earlyworm
10-03-2012, 04:37 AM
Mmm perhaps but remember a dark value of 0.2 turns to 0.5 with a sRGB LUT. Now you have issues in your midtones.

It all really depends really too - linear can also have contrasting affects - and may result in oversampling when not needed. Sampling is intended to be adaptive in relation to our perception to achieve quality/speed where needed. The image should really be sampled in relation to as how we will see it :)

Never had problems with my mid-tones before. :)

Interesting I would have assumed the opposite, that normalizing the values that your sampling (with a gamma of 2.2) would result in a higher number of and a more uniform distribution of samples.

As I say, I'll try it out sometime.

govindk
10-03-2012, 07:58 AM
revilo3D After reading your post, i did test it again and this time observed my RAM...

I think you must have already guessed it ;) , however When you do not use BIG(bitmap input gamma), the RAM usage is less compared to when you add BIG with a value of 1.0 to the HDR image.
It climbed up a little, so yes there is a difference.
And I think like you said, V-Ray might be optimizing it. :beer:

EarlyWorm, you posted a picture of a cube, I thought that was little washed out though, I did not see your shader, so I can be wrong !!

earlyworm
10-04-2012, 07:32 AM
EarlyWorm, you posted a picture of a cube, I thought that was little washed out though, I did not see your shader, so I can be wrong !!

You thought an unshaded grey cube was a little washed out!? :) Sorry I couldn't have come up with a prettier example.

The point was just showing that they're matched visually and it's a very simple test from which you'd easily spot if something was wrong between the two.

Good find with the RAM usage.

govindk
10-04-2012, 07:39 AM
Even I was testing things with a matte grey Vray shader and getting washed out results.
I thought you were doing the same and I thought it did look a little brighter

FranciscoSCN
10-12-2012, 03:50 PM
I feel this workflow suits me better, kinda inclined to what revilo3D & majority of others suggested:- :beer:
(1) Setting Gamma to 2.2, with do not affect color turned on
(2) Adding a texture and selecting the bit map input gamma under Vray extra node for 8-bit files & adding .454 gamma node to color swatches
(3)sRGB button for V-Ray Frame Buffer to view my images properly
(4)Rendering in 16 bit or 32 bit exr or similar linear supported format

However it does lack a lot of contrast which I am still trying to figure out, why?
In some situations I am getting good results with sRGB button turned off. So I think I will un-gamma those images with 0.454 or similar value inside Nuke to get it back. It better to do that, rather than working on non-linear and getting wrong maths.

**And I am also wondering if it is really necessary to add 0.454 gamma node to CG Light (vray light) swatches, like kanooshka suggested. If that's what he meant, I might have understood it wrong.

I'm also trying to find my preferred LWF method and as such, I'm trying to understand other methods. I don't really understand the one you described here. Newbie analysis, but here goes:

It seems to me that you're only using V-Ray Colour Mapping to sample the image with a 2.2 gamma setting (as others have pointed out in this thread). Because of this, you're linearizing your input textures files with the V-Ray extra attributes and the swatches with a simple Maya gamma node (but not the light colour swatch).

Is my analysis wrong? Wouldn't it be more simple to set Colour Mapping gamma to 1.0, affecting colours AND affecting colour swatches? That way you wouldn't need to manually apply a gamma node to every single colour swatch in Maya, leaving only colour textures to be gamma corrected, for a correct linear output render. What is your motivation to have Colour Mapping, well, affect the colours?

Also, by not setting any Colour Mapping, will V-Ray output a 1.0 gamma file? (it sure seems so, since you're not affecting colours but are maintaining a linear output)

govindk
10-13-2012, 10:38 AM
FranciscoSCN, what you said is something even I assumed in the beginning before doing tests. Again this is something I understood from my tests, so I can be wrong. As I haven't seen a V-Ray proper Linear Settings from Chaos Group for Maya, though there is for 3DS Max.

The reason you gamma correct your scene(mid-tones) is to get a even lighting without blowing out areas and get details even in your darks. When you set your value to 1.0 you are not affecting anything at all. Everything is default. By adding a 2.2 gamma V-Ray understands why we do that, and affect our lighting big time.

Affect Colors check box, is merely for visual purposes.
It shows your final swatch look. Doesn't affect render in anyways, or so I assume.

And I really do not think we need to color correct our light swatches to 0.454 gamma value like we do for shaders.
I did for a RAMP, nothing changed except the intensity of the color, thereby reducing the overall cast, which I can easily do with my slider controls and do not need an extra gamma node and it did not change my lighting much. So far I am getting a proper linear workflow with the current method. Yes I have a contrast issues, but with a simple color correction NODE in Nuke I am getting amazing results and more information in my dark region.
I do not think we need to have absolute dark anywhere (unless for some particular creative reason for a shot, for example Batman in pitch darkness, emerging out :D ).

here's an image, if you haven't seen already. - http://imageshack.us/a/img705/7158/10796679.jpg

I do not find it easier than Mental Ray like some others mentioned though, it seems the same to me, in terms of methods.

FranciscoSCN
10-18-2012, 09:55 PM
About the Affect Colours check box, I think you've got it mixed with the Affect Swatches one. As revilo3D said earlier (http://forums.cgsociety.org/showpost.php?p=7428040&postcount=19), the Affect Colours turned off just makes it not apply these settings to the image itself. So you're NOT applying the 2.2 gamma that you've set, but using the 2.2 setting ONLY for the purpose of sample calculations. So this means VRay will still be outputting a 1.0 gamma image but sampling as if it were encoded with 2.2.

govindk
10-19-2012, 11:09 AM
OH !! Sorry about that mann!! I got it mixed...!!

Anyways what you said is correct, except that even you got it reversed :p
With Affect Color ticked on, "just makes it not apply these settings to the image itself. So you're NOT applying the 2.2 gamma that you've set, but using the 2.2 setting ONLY for the purpose of sample calculations. So this means VRay will still be outputting a 1.0 gamma image but sampling as if it were encoded with 2.2."

FranciscoSCN
10-19-2012, 11:57 AM
Indeed my bad, as the setting reads "Don't Affect Colours" and not the other way around.

CGTalk Moderation
10-19-2012, 11:57 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.