PDA

View Full Version : Linear lighting: exposure simple and render passes


sharktacos
08-05-2010, 03:18 AM
The mia_exposure_simple is apparently not applied on render passes. It effects the beauty pass, but none of the other passes. If I were rendering in 16 or 32 bit then I could simply do the gamma correction in Nuke, however if I am rendering in 8 bit this will produce banding when done in the comp. This banding does not occur when using the mia_exposure_simple.

Is there a work around for this? Is it truly impossible to render in linear space AND have render passes when working in 8 bit?

ndeboar
08-05-2010, 03:44 AM
yup, no one in serious production uses 8 bit any more.

sharktacos
08-05-2010, 04:30 AM
I don't really want to get into why, but there is a very good reason why working in 8 bit is necessary for us in some cases.

So I just wanted to know if there was a way to solve what mia_exposure_simple is solving for passes?

This is a problem that I think is unique to MR. I don't have the same problem in Modo for example.

ndeboar
08-05-2010, 04:50 AM
If you are doing extra passes, then i am assuming you are doing some compositing. You should be brining your footage in as linear, and only converting to sRGB (or what ever you final color spce is) at the end of that comp. So you HAVE to do a 2.2 gamma correction after you've rendered your images out of mental ray any way. You only want to bake in the 2.2 gamma if your doing no post work.

Cheers,

Nick

sharktacos
08-05-2010, 05:03 AM
Why would you need to comp in linear? Comping is sRGB works fine too. As I said, if I do what you are suggesting I get banding.

Basically I am wanting to have the lights react correctly within Maya (=linear) but then render out the result of that in sRGB to comp it with passes in sRGB space (a non-linear comp).

This all works just fine so long as I don't have passes, or if I create them manually in render layers. It also works just fine with passes in other renderers. So I'm sticking to my guns.

ndeboar
08-05-2010, 05:15 AM
Why would you need to comp in linear?


Because that's the whole point of linear, if you break it, then all the composting math you are doing will be wrong. Eg, when you add your specular layer over your diffuse, it will be completely wrong. The white will be over bright due to the sRGB gamma curve. And if you do a color adjustment, it will have a non linear response, so your darks will get a differnt amount of correction to the lighter parts of the image.

Have a read of this, it might make linaer color make more sense:

http://www.swdfx.com/PDF/Nuke_Color_Management_Wright.pdf


Nicko

sharktacos
08-06-2010, 02:45 AM
Because that's the whole point of linear, if you break it, then all the composting math you are doing will be wrong.


Okay let me illustrate what I am talking about. First we have an image rendered with MR in linear space. It is an 8bit iff with the mia_exposure_simple on it.

http://forums.cgsociety.org/attachment.php?attachmentid=155369&stc=1

Next I rendered out a spec and diffuse pass using render layers and comped them in Nuke. These are both 8 bit iff images too. The result is virtually identical to the beauty pass above.

http://forums.cgsociety.org/attachment.php?attachmentid=155370&stc=1

Now look at what happens when I do this with passes: the mia_exposure_simple is not applied and so I need to add the gamma in Nuke after the add. It has horrible banding.

http://forums.cgsociety.org/attachment.php?attachmentid=155371&stc=1

I do understand that I am not doing the comp in linear space. I don't want to. I am however getting good results with the mia_exposure node on my render layers that matches my beauty and the render is done in linear space which is what I want. It works just fine. However with passes is looks like crap. So again, what I want to be able to do is apply the mia_exposure to render passes so that I can comp them in sRGB.

ndeboar
08-06-2010, 03:10 AM
My feeling is if your not going to be using linear color correctly, you may as well not use it all, which will solve all the banding issues your having.

Nick

sharktacos
08-06-2010, 03:26 AM
You entitled to your opinion, but I would still like to have someone answer my question.
If you don't want to help me do that, that's fine.
I do hope however that someone else will.

TaKIKO
08-06-2010, 03:44 AM
You dont realize but you are comping in linear space. Nuke works linearly, if you bring a non linear image into nuke it will convert it linear if you bring a linear image in nothing happens. To view the 2.2 gamma or the sRGB beauty you dont add a gamma node in your comp you should by default viewing your comp in sRGB space. The reason the passes dont have the 2.2 gamma is because the passes get split up from the framebuffer before the len shader is added. The reason your getting the bad quality is because you just dont have the information in your 8 bit image.

WATCH ME!!! (http://vimeo.com/8238875)

ndeboar
08-06-2010, 04:12 AM
You dont realize but you are comping in linear space. Nuke works linearly, if you bring a non linear image into nuke it will convert it linear if you bring a linear image in nothing happens.

Only if its an exr, it treats all exrs as linear, but if it's say a tiff/tga it will be treated as sRGB.

There is really any reason for 8bit any more, especially if your using Nuke. From my production tests, exr half with zip compressions is almost always smaller than a uncompressed 8bit tiff.

Your also loosing all the super white values in your specular highlight using 8 bit.

Mental quantizes the color values before it does the gamma conversion, so you're always going to get banding until they fix that.

But i have a feeling that my advice isn't appreciated, so that's it for me!

sharktacos
08-06-2010, 04:16 AM
Guys, it's very simple:

I comp the spec and diffuse pass with mia_exposure and it works just fine.
I render in passes and it does not.

This is not a comp problem, it is a mental ray problem (which is why I posted here). The exact same results happen in After Effects and in Shake.

The reason I need to do the gamma adjustment in the comp on the render passes is because that gamma was not applied by the mia_exposure in Maya. When working in linear in Maya you need to de-gamma all the textures so everything is in linear space, do the lights, and then re-introduce the gamma again at the end for viewing. That's what the mia_exposure node does.

I'm not asking how to fix this in the comp, I'm asking how to apply the mia_exposure to a pass. It's a mental ray question.

sharktacos
08-06-2010, 04:27 AM
But i have a feeling that my advice isn't appreciated, so that's it for me!

Nick, I do appreciate your advice. We just are unable in some situations to render out at 16 bit. It is not a file size issue, it is a client issue. So while I realize that it is of course better to render 16 bit, and do when possible, in our current situation it is just not always possible. So I'm looking for a way to render in linear but comp in sRGB.

chuckie7413
08-06-2010, 09:27 AM
are you saying the client specifies what you render at?

I can understand them requesting 8bit files on final delivery but surely you can render at what ever bit depth you like to aid you in compositing and then just render the final comp at 8bit?

You can't really render linear in 8bit because you just cannot store all the information necessary for a correct linear file in an 8bit image.

seandunderdale
08-06-2010, 11:31 AM
treat the mia_exposure node as a visualiser. Its not for rendering final images with. It would be helpful if the parameters in the exposure node were in the compositing package so you could dial in the exact values and the 32bit pass look the same....but it doesnt.

The point is, the new colour management preview option in the renderview is meant to do what the mia_exposure node does to a point. Its a visualiser for what the 32bit linear render will look like, when viewed in the correct workspace, and gamma corrected in post. When you get youre renders back from the farm, youll have a MasterBeauty, which is 8bit and looks like the render, and loads of 32bit linear passes that need to be corrected to look like the masterBeauty.

Its not a mistake by mental ray as I see it, its just how it works. It sounds like you want to "bake" the mia_exposure node gamma correction into your 32 bit passes, but thats not an option as far as I can tell.

mowax74
08-06-2010, 02:16 PM
i have to be sure if i understand you right: you guys work in maya with an gamma of 1 and do your gamma correction at the end of the final composition?

right now i worked with a gamma set to 0,445 in the render globals. this is wrong if i output renderpasses for composition?

seandunderdale
08-06-2010, 02:35 PM
changing the framebuffer gamma isnt the correct way to work. The exposure node is simlulating what youll be doing in the compositing process. Also in order for your textures, that were created in an sRGB workspace, to look correct, you need to de-gamma" them with the 0.455 value, so they wont have an sRGB curve applied effectively twice.

sharktacos
08-06-2010, 03:03 PM
are you saying the client specifies what you render at?

I can understand them requesting 8bit files on final delivery but surely you can render at what ever bit depth you like to aid you in compositing and then just render the final comp at 8bit?

You can't really render linear in 8bit because you just cannot store all the information necessary for a correct linear file in an 8bit image.

The client is doing the comp and wants it in 8bit.

As I have demonstrated above, you certainly can render linear at 8 bit. You cannot composite linear at 8 bit, but I do not want to. I simply want to re-introduce the 2.0 gamma back into the passes for the comp in sRGB.

sharktacos
08-06-2010, 03:12 PM
Its not a mistake by mental ray as I see it, its just how it works. It sounds like you want to "bake" the mia_exposure node gamma correction into your 32 bit passes, but that's not an option as far as I can tell.

Given the fact that
1) Many other renderers allow you to have gamma correction in the passes. It is only "just how it works" in mental ray, not in general.
2) mia_exp_simple works just fine in render layers. So it works just fine to do this in mental ray too. It is not only "for display" but works perfectly well as a final output.

I would therefore say it is more accurately a feature limitation based on how MR has set up mia_exposure and the pass system which does not need to work that way. It would not surprise me in fact if this was changed in future versions. But right now I am looking for a workaround.

P.S. the color management system is broken in 2011 for 8 bit display.

sharktacos
08-06-2010, 03:19 PM
i have to be sure if i understand you right: you guys work in maya with an gamma of 1 and do your gamma correction at the end of the final composition?

right now i worked with a gamma set to 0,445 in the render globals. this is wrong if i output renderpasses for composition?

Setting gamma to .455 in the render globals framebuffer does a de-gamma on your textures. In Maya 2011 you can do this instead by checking color management in the render settings (input sRGB, output linear). This does effectively the same thing, but more accurately (the frame buffer way messes up your bump maps). Meaning that in both caes you are now working in 1.0 gamma (in fact you always are, the point is that you need to make your textures 1.0 too so you can work with them). Either way you need at some point, either in Maya or in the comp to re-introduce the 2.0 gamma back in. That's what I'm trying to do here with the mia_exposure node.

seandunderdale
08-06-2010, 03:43 PM
I agree with both of your points, and I often render out render layers in 8/16bit and "baking in" the exposure node. Mostly when working on jobs for print as Photoshop doesnt play well with 32bit when it comes to retouching. You left with a limited amount of tools.

The way I see it is why does it matter? You render out 32bit passes, they need gamma correction, it takes seconds to set it up in the comp, whats the problem? Especially if youre working in Nuke where you change the workspace mode and can view your images straight away in an sRGB workspace and they look correct...

TaKIKO
08-06-2010, 04:08 PM
Shark taco did you watch the link i posted?

sharktacos
08-06-2010, 05:51 PM
Shark taco did you watch the link i posted?

Yes, I familiar with that. It's good.

sharktacos
08-06-2010, 06:03 PM
Okay I solved it. As I said above (see the images) the problem was banding on the gamma.

In Nuke I needed to switch the Plus node to "video color space," and then do a ColorSpace (in: linear, out: sRGB) instead of doing the gamma correction with the Grade node which was giving me the ugly banding.

Works fine now in 8bit and looks 100% identical to the 32 bit. In fact this gives better results in 8bit than the mia_exposure node which slightly washes out the image.

The same thing works in After Effects with a Add if you turn on "blend colors using 1.0 gamma" in the Project Settings. Also 100% visually identical to the 32bit result.
:applause::beer:

ndeboar
08-07-2010, 04:30 AM
You might be able avoid this work around by comping in linear, eg on the input node set the color space to "linear", since that's what your bring your footage in as. Just remember to set your lut to sRGB and you'll have proper linear workflow, happy days!

Nick

Jozvex
08-07-2010, 10:57 AM
Another option may be to apply the mia_exposure_simple to the camera as an Output shader instead of a Lens shader which is the normal way. Output shaders happen to the image afterwards, like a post effect and I *think* it works with the mental ray render passes. Of course it can have artifacts and issues too, but no surprise there. :wavey:

mowax74
08-07-2010, 11:42 AM
thank you guys for answering my question too. now i tested a little bit with your suggestions.

- in maya 2011, for the color input profil, i used sRGB (since my textures are created in an sRGB space)
- the output color profile is set to linear, and in comp i put at the end of my flow an gammacorrection of 1.8 or 2.2 or similar.

for tweaking in maya i can set the output profile to sRGB for previewing what it would look like in comp after applying gamma correction to it.

is this all correct?

sharktacos
08-07-2010, 03:38 PM
Another option may be to apply the mia_exposure_simple to the camera as an Output shader instead of a Lens shader which is the normal way. Output shaders happen to the image afterwards, like a post effect and I *think* it works with the mental ray render passes. Of course it can have artifacts and issues too, but no surprise there. :wavey:

That's an interesting idea. Can you step me through how I would set that up a bit more? Can I just stick the mia_exposure into the output shader slot on the camera, or would I need to run it through a colorBuffer or something?

I did find this thread http://forum.mentalimages.com/showthread.php?t=4572 but it just hurt my brain. :drool:

sharktacos
08-07-2010, 03:56 PM
thank you guys for answering my question too. now i tested a little bit with your suggestions.

- in maya 2011, for the color input profil, i used sRGB (since my textures are created in an sRGB space)
- the output color profile is set to linear, and in comp i put at the end of my flow an gammacorrection of 1.8 or 2.2 or similar.

for tweaking in maya i can set the output profile to sRGB for previewing what it would look like in comp after applying gamma correction to it.

is this all correct?

I think you have the theory exactly right. I'd tweak a couple things on the implementation:

1) Theoretically you do want to reintroduce a gamma correct at the end of your comp when you go back to sRGB at the end of the process. But instead of doing this with gamma, you use (in Nuke) a colorSpace node which gives better results.

2) to preview in Maya you can use the color manager, but you don't change the profile in the globals, rather in the render view display menu you choose the color manager there and set it to image: linear, and display: sRGB. That way you work linear but see in sRGB. Be aware that the color manager display is broken if you are working in 8 bit. (see my thread HERE (http://forums.cgsociety.org/showthread.php?f=21&t=906348) on that)

Another option is to attach an mia_exposure_simple to the lens shader of the camera, which does the same thing and works for both 8bit and 32bit.

sentry66
08-08-2010, 07:03 PM
I agree that it's not absolutely necessary to comp in linear space in all situations. It might not be technically correct and it might not give colors and blending that's physically as accurate, but not everyone needs that for all jobs.

For example when it comes to artistic comps where it's perfectly fine and even encouraged to have exaggerated colors. There's a lot of artistic techniques that people have built up over the years working in non-linear space that are broken and look ugly when working in linear space.

I do think it absolutely makes sense to render with linear lighting and output as float EXR because the shading looks better and HDR is superior to having your whites clip and aids motion blur streaks. But 1.0 gamma blending is really only needed if you're breaking your passes down into their components so you can reconstruct them in post. If you're just working off of a main beauty pass and using it in an artistic way, then comping in 1.0 gamma is a little less important

At the end of the day, what matters is if your work looks good and if you get it done quickly.

ndeboar
08-09-2010, 03:19 AM
I agree that it's not absolutely necessary to comp in linear space in all situations.

If your going to go to the effort of setting up linear in 3d, why not carry that onto comp?

You may as well make your life a lot easier and just do it all in sRGB. Other wise, what's the point of using linear at all?

sharktacos
08-09-2010, 04:21 AM
If your going to go to the effort of setting up linear in 3d, why not carry that onto comp?

You may as well make your life a lot easier and just do it all in sRGB. Other wise, what's the point of using linear at all?

Nick, if you read his post again, he explained exactly why.
Also setting up linear in Maya can be done with a single mouse click. It is not any trouble.

sentry66
08-09-2010, 08:21 AM
If your going to go to the effort of setting up linear in 3d, why not carry that onto comp?

You may as well make your life a lot easier and just do it all in sRGB. Other wise, what's the point of using linear at all?

well, I explained why in my previous post, but I'll try to expand on that further.

Having your renders done with linear light calculates light and shading more naturally so it's more straight forward to get good results without requiring tricks to achieve similar looks.

So for example if you're mainly working with a single beauty pass which has been automatically linearly comped together, what's the harm in adjusting colors in sRGB space if your work ultimately is going to be used in sRGB space? What if you already perfectly nailed the render and therefore breaking the passes out individually serves no benefit other than slowing you down and taking up disk space. Some of our jobs need to be done quickly and don't afford us the luxury of rendering out separate passes for each component and comping them back together.

That and not every animation or render is a mimic of physical reality. A lot of animation work is hyper-real or artistic in nature where exaggerated beautiful coloring is preferred over physically accurate colors. Some of us have developed techniques over the years that work great in sRGB space, but do not work well in gamma 1.0 space.


I'm all for comping in gamma 1.0 space when trying to mimic physical reality or if you break your renders up into their components so you can comp them back together in a gamma 1.0 fashion. But at the same time, depending on the nature of the project, if I can get it done faster and be more predictable in sRGB space, then so be it. I'm going to use the color space that makes the most sense for the project.

seandunderdale
08-09-2010, 09:36 AM
LWF in Maya, then comping in sRGB makes sense also. It makes lighting easier, working with HDRi's easier, makes shadow falloffs more predictable, and works with all of Mental Ray's physical attributes.

In my experience, those things improve render quality, and general production speed, whether Im rendering passes (32bit) or render layers (generally 16bit). Also, I do a fair amount of work for print, so it makes it much eaiser to not work in floating point.

CGTalk Moderation
08-09-2010, 09:36 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.