PDA

View Full Version : Out putting a linear to light .exr from mental ray : HOW ?


Aneks
05-14-2009, 03:16 AM
Hi,

how do I get a Linear output, from mental ray ?

can this just be done by a render setting ?

Aneks
05-14-2009, 08:47 AM
No magic fix.

the recommended mia_simple_exposure mentioned in various threads is the best way

big thanks to Zap Anderson for clarifying this for me.

SlipAway
05-14-2009, 08:54 AM
It would've been nice for you to keep the original question as is, in case someone ran across the same issue and was doing a search on the forum.

Would you mind sharing the solution?

Aneks
05-14-2009, 09:11 AM
Attach a mia_simple_exposure shader to your render camera. Set it's gamma to 1. Set the output framebuffer to 32bit float. Leave the output frame buffer set to 1.

Take EVERY texture in the scene that is not linear and use a gamma node with the RGB values set to .454 to negate the sRGB gamma. This is not needed if your textures are linear and Float.

mutliply EVERY relavent colour swatch in your textures by .454 to compensate for the gamma.

render. it's linear !

SlipAway
05-14-2009, 09:18 AM
Thanks. How does one know if the textures are linear or not to begin with?

Aneks
05-14-2009, 09:23 AM
Chances are they will be. Most digital imaging applications use an sRGB compensation to display things correctly on a monitor. Linear images without a corrective LUT will appear very dark on your monitor.

the only time you are going to have linear textures or linear images to use as textures is when you are using linearised film scans or specially prepared linear textures from another app like Photoshop or your comp app !

Hehud
05-14-2009, 11:04 AM
http://www.floze.org/2008/07/six-tuts-on-light-and-shade-part-i.html

as described here

but by trying, if you leave the gamma of the mia_exposure_simple at 2.2 and changing the gamma of the Primary framebuffer to 0.454 you don't need to connect to each texture a gamma correct

but Floze change the gamma from Primary framebufferto 0.454 and also the gamma of the mia_exposure_simple1 from 2.2 to 1

"As you can see from Fig. 8, we set the Gamma value in the Render Globals’ primary framebuffer menu to the desired value, which is - simply because mental ray works this way - 1 divided by the value (2.2 for approximating sRGB in our case), which equals 0.455. At the same time, we also need to remove the gamma correction of our lens shader, so we must set its Gamma attribute to 1.0 (linear equals no correction; you can select these shaders from the hypershade’s Utilities tab). Thus we completely hand over the gamma correction to mental ray’s internal mechanism, which automatically applies the right “un-gamma” value to every of our textures. There are no more worries for our color textures now"



But by trying this the texture are way to dark so juste change the gamma from the Primary framebuffer to 0.454.(soo you don't need to add a Gamma Correct
and that work closely as adding a gamma correct to each texture

maybe Floza is right but by trying his methode, the texture seems to dark.

Aneks
05-14-2009, 12:29 PM
no. you should not use the frame buffer gamma set to .454 to get a linear output. This is incorrect. Doing so changes a number of things. None of which is what we wnat. Again I am referring to a very specific Linear workflow. I had a brief email conversation with Zap from mental images directly and he advised that the framebuffer should stay at 1 for linear.

If you find things "looking too dark" it is probably because you are viewing a linear image on a non linear display device hence this whole gamma discussion.

if you want to see one of the artifacts caused by the .454 framebuffer gamma you can see it here:

http://www.djx.com.au/blog/2008/10/06/linear-workflow-and-gamma-update/#more-101

SlipAway
05-14-2009, 01:13 PM
no. you should not use the frame buffer gamma set to .454 to get a linear output. This is incorrect. Doing so changes a number of things. None of which is what we wnat. Again I am referring to a very specific Linear workflow. I had a brief email conversation with Zap from mental images directly and he advised that the framebuffer should stay at 1 for linear.

If you find things "looking too dark" it is probably because you are viewing a linear image on a non linear display device hence this whole gamma discussion.

if you want to see one of the artifacts caused by the .454 framebuffer gamma you can see it here:

http://www.djx.com.au/blog/2008/10/06/linear-workflow-and-gamma-update/#more-101

I believe he's saying the opposite: "So for me, the "nicer color blending" is a good enough reason to alter my workflow and use frameBuffer gamma set to 0.455." If you read it carefully he's saying the first 2 tests show improper blending, while the third at framebuffer gamma .455 is blending more naturally.

Is Zap's view that mia materials are already linear, and that Maya materials are not, therefore would need a gamma adjustment?

Aneks
05-14-2009, 01:19 PM
You are right he does say that but I think he's assertion is incorrect. The third image looks too light. The first image does not have white/light pixels, instead it blends smoothly between colours

Check the link to the LAMRUG forum in the comments section. It shows some other artifacts that are introduced with the 'erroneous' framebuffer .454 technique, expecially in regaurds to textures for bump and spec etc !

from the email I got from Zap:

Me:

Basically if I render with my framebuffer set to 32bit float and its gamma set to 1.

Zap:

Yes, this is the right way.

Me:
I then use a mia_simple_exposure node with it's gamma set to 1 and de-
gamma all my textures in Maya (we actually do this externally and give
Maya 32bit degamma-ed textures, but I know I can use a gamma node and
take out the 2.2)

Zap :So far, correct. If you have mia_exposure_simple with gamma=1, you should actually get an image that looks "wrong" if displayed uncorrected, i.e. you should *not* get an sRGB encoded image, you should get the linear image.

I see through the fog a bit now.

Aneks
05-14-2009, 01:24 PM
This is the LAMRUG link. I think these examples show the differences better :

http://forum.lamrug.org/viewtopic.php?f=6&t=1144&start=0&st=0&sk=t&sd=a

Ironhalo
05-14-2009, 03:01 PM
ive began implementing a linear workflow on my latest project, and i've been doing a lot of reading about it beforehand. it can make your head spin..

anyway i make all my textures linear in photoshop so i know what the renderer is seeing. correct me if im wrong, but render engines ignore color profiles and thus the srgb 2.2 gamma. isnt it more accurate to paint and edit photos in a linear profile vs applying a .45 to offset the srgb correction? that would also keep the hypershade a lot cleaner.

i thought maya swatches are in a linear space too, so they shouldnt need a gamma correct node?

another question.. for the best render do you have to create file textures in a non 8 bit format?

SlipAway
05-14-2009, 03:20 PM
ive began implementing a linear workflow on my latest project, and i've been doing a lot of reading about it beforehand. it can make your head spin..

anyway i make all my textures linear in photoshop so i know what the renderer is seeing. correct me if im wrong, but render engines ignore color profiles and thus the srgb 2.2 gamma. isnt it more accurate to paint and edit photos in a linear profile vs applying a .45 to offset the srgb correction? that would also keep the hypershade a lot cleaner.

i thought maya swatches are in a linear space too, so they shouldnt need a gamma correct node?

another question.. for the best render do you have to create file textures in a non 8 bit format?

Same here. I read up on it constantly and some days I get it, the next day I forget it. It would be nice to see some Maya and mental ray guys show up in here and just clear it up once and for all. What shaders are linear? Maya no mental ray yes? Swatches? Viewport render reality? Best image format and data type to use? Best way to create or modify textures before using them? Best and easiest way to create a linear workflow that will not bring even the brightest to their knees?

Or better yet, integrated gamma correction internally done by Maya, giving me a linear image to use in post.

Ironhalo
05-14-2009, 03:49 PM
i think theres a lot of information out there already. its just translating things from theory to a working model. this site gave me a tone of insight:

http://www.ypoart.com/tutorials/tone/texture_environment.php

SlipAway
05-14-2009, 04:03 PM
I'm not saying there's not info out there. I've read hundreds of articles and forum threads on it. The problem is there is no concensus, just varied opinions. My point is that the software makers need to come up with a solution that is consistent across the board so I spend more time creating and less time trying to figure out if my de-gamma'd gamma has been twice gamma'd over or if the inverse of my double gamma will produce a wrong gamma that I then correct in Photoshop. Wait was it .455 or 2.2? Then it's on to if my half-float, 8 bit good for nothing, 32 bit short, sweet 16 format won't matter a damn if I corrected gamma or not. :scream:

CGTalk Moderation
05-14-2009, 04:03 PM
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.