Custom LUT lens shader

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 04 April 2013   #16
Hmm. I wouldn't be at all surprised to learn I've been doing something wrong, but I think I've got a decent linear workflow. I generally only convert from adobeRGB to sRGB when I'm not getting a perceptual match on a critical element.

My linear workflow with mental ray has been:

Color Management: enabled, default

Framebuffer Data Type: RGBA (Float) 4x32 Bit

Render View Color management:
Image Color Profile: Linear sRGB
Display Color Profile: sRGB

Only color swatches are gamma corrected.

For this exterior scene, I have an mia_exposure_photographic with Cm2 Factor at 24,000 and Gamma set to 1 (should still be linear, no?), as well as an mia_physicalsky with Multiplier set to 7.

For what it's worth, I've experimented with this same issue since switching to V-Ray and it appears to have the same results. I'll put together a stripped down scene and PM you a link for download tomorrow.

APerez, sorry for highjacking your thread!
Old 04 April 2013   #17
I would render to 16-half, not 32-bit, those files are large for not much gain. (16-half is still floating point)

Why Adobe RGB? That's really designed for print. Is this for print work?

mental ray has Sharp colorspace, that's wide gamut. But it's not exposed in Maya just yet.

I would not render through a lens shader. It bakes in things you might want better control over in post.
My opinions are always my own...and maybe a friend's, but never my employer's.
Old 04 April 2013   #18
Yeah we're not really using full 32-bit anymore, but I still forget that it's overkill, so it's good to keep in mind. Although according to Photoshop, it seems to still write 32-bit whether I choose RGBA (Half) or RGBA (Float).

The majority of our work is for print, with resolutions of 8K by 5K not at all uncommon. The majority of our house uses adobeRGB, so we try to keep in line with them. I've heard that vfx studios are using primarily sRGB or Linear Rec 709, but I don't know much about that.

I've gradually moved away from using lens shaders or tone mapping pre-render, but this scene does have one and I'm not sure why. I guess I thought that if the gamma is set to 1, it's relatively safe. INTERESTINGLY, when I remove it, the mystery color shift goes away! So it seems likely that I've been confusing a color shift caused by the photographic lens shader as a problem with color profiles?

I've uploaded a project with two scene files and a handful of textures and pre-rendered images. Take a look if you have the time. Hopefully it's self-explanatory as I've tried to label everything cleanly. Mainly, compare the rendered .exr's to the corresponding source images. Note that in the 'tablecloth' scene, there is the troublesome lens_shader.

It looks like I was introducing a color shift issue when I tried to reproduce the problem in an empty scene. I think my mistake has been using the 'Convert to color profile' using the perceptive intent, which shifted the RGB values, as opposed to simply assigning a new profile. Doh. Still, it seems like maybe the lens shader affects the adobeRGB texture differently than the sRGB texture. Could that be? I made progress, but am still a bit confused...

Long story short: Pretty sure I screwed up in multiple directions. Both byConverting instead of assigning, and using a lens shader. Also have/had a problem of assigning adobeRGB to the final render output produced with sRGB textures.

God what a mess.

quick edit: Anyone care to recommend how to determine accurate physical sun and sky multiplier settings without using a lens shader?

Last edited by onetime : 04 April 2013 at 01:05 PM.
Old 04 April 2013   #19
Yea, sorry for the hijack.

Took a first look at your colorChart scene. If you turn off "Color Management" and gamma-correct your texture 0.454, your output will match the input 100%. That's it I think.
On top of that, if you use any tone mapper, it will slightly distort your colors, but that's the nature of tone mapping.
Regarding the "mia_exposure_photographic" lens shader... I don't think there is a problem using it, just be aware of the color mapping attributes, "Burn Highlights","Crush blacks" and "Saturation".
Said before... for this workflow you need to use ONLY adobeRGB textures (and color input for that matter). Linearize or de-gamma all input, and finally ASSIGN adobeRGB. Any sRGB textures need to be CONVERTED to adobRGB.

Yes it's a mess, but I hope this helped a bit.

We really need proper, WORKING, color management! Autodesk hello?
Old 04 April 2013   #20
Hey Onetime,

Tobbe is correct when he says that using a lens shader will change the colors and saturation to a certain extent. If color rendition is crucial to you, maybe choosing a visual style that doesn't necessitate a photographic rendition would be easier (I mean a stylized look, without photographic lights or lenses). That said, I'm still going to go through the workflow I think you should follow for photographic 3D rendering.

first of all you should be aware that Photoshop's integer 16bits format and Maya's half-precision floating point 16bits format are different. Photoshop's 16b uses the same maths as 8bits (integer), but with increased bit-depth. Maya's 16b uses the same maths as 32bits (float), but with reduced bit-depth. Photoshop does not recognize the half-float 16bits format, but recognizes that the maths are similar to the 32bits format. That's why it's showing it to you this way.

Another thing you should be aware of is that Maya's color management feature is not working properly for me (Maya 2012). It introduces significant banding in perfectly good textures. I suspect that the automatic gamma shift is applied in a destructive manner. For now keep using the good old gamma shift nodes, or linearize your texture before using them in Maya.

As for the photographic lens shader you should use it for previewing your render from inside Maya. Remove the node completely before the final render. It's the only decent filmic exposure emulation (what people call tonemapping) in Maya. You can find equivalent film emulations in compositing packages to get a matching look when importing the final render. The only other workflow option is to only preview your renders through your compositing package and its film emulation. Two things are certain: Always look at your render through a film emulation, and always render your 3D images without any film emulation.

The film emulation I use in compositing is the one included in OpencolorIO (developed by Sony Pictures Imageworks), specifically the spi-anim config. You could also use the film emulation developed by the Academy of Motion Picture Arts and Sciences in conjunction with Fujifilm: ACES. That last one is also included in OpencolorIO.

If you choose to use a photographic lens shader in Maya to preview your renders, try using these settings:
cm2 factor: 2, ISO: 0, vignetting: 0, Burn highlights: 0, Crush blacks: 0.5, Saturation: 1.3, Gamma: 2.2.
These settings for me create a look that sort-of matches the compositing film-emulation.
If using these settings, don't use Maya's color management and leave the render view tonemapping input and output profiles to linear (gamma is corrected by lens shader).


1. keep adobeRGB texture as they are.
2. convert sRGB texture to adobeRGB using absolute colorimetric intent.
3. In maya switch off the color management feature.
4. In maya use gamma correction nodes to linearize your textures (gamma 0.454).
5. In maya leave the render view input and output profiles to linear sRGB.
5. Render through photographic lens shader for lookdev and preview only.
6. Render the final images in RGBA half-float 16bits, and remove the lens shader.
7. Import the render in compositing package and interpret renders as linear adobeRGB.
8. Apply a film emulation in compositing, maybe from OpencolorIO.
9. Render the composited images while keeping the film emulation this time.

I hope all of this makes sense.

ps: I want to add one more thing, which I am not really doing myself but I know some VFX studios are. A film emulation basically looks like an s-curve, you can think of it as adding contrast and bringing all the highlights back in range so they don't burn. This will make the image look like a photograph but it will also alter the perceived contrast in the textures you are using. In theory, when you paint a texture you are probably mimicking the exposure values of a photograph, and not the real world (just like you paint textures with a gamma 2.2 and not 1.0) You should then undo this before rendering (just like you gamma correct the texture to be in linear gamma). So there are really two things you should correct on a texture before it's truly linear: the gamma, and the film emulation. Fortunately some people in VFX have already noticed that, and offer tools to correct both at once: OpencolorIO. It includes a color profile called "dt8" which you use as an input, and ask for a linear output. This conversion will linearize the gamma and apply an invert film emulation.

Last edited by APerez : 04 April 2013 at 10:50 AM.
Old 04 April 2013   #21
Wow, thank you guys for all this information! I really appreciate you taking the time to break this stuff down. It definitely helps to clarify some of the confusion I was having with these stupid color profiles, tone mapping, gamma, etc...

To be honest, I'm not using mental ray so much recently, but I think most of this stuff applies to V-Ray as well, and will definitely make working in mental ray slightly less painful. Looking forward to putting this stuff into practice.

And again, sorry for taking this thread in what appears to be only a tangentially related direction. Cheers.
Old 04 April 2013   #22
Thread automatically closed

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.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 01:10 AM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.