PDA

View Full Version : Linear workflow giving harsh falloff, what am I doing wrong?


Dromond
06-15-2009, 06:07 PM
First off, I have done a ton of research on these forums and related blogs which has been hugely helpful in understanding and discovering the benefits of a linear work flow.

Here is my basic setup:

-Render using MR in Maya. Use the Nexus shader (created by Luma Pictures) with it's built-in gamma correcting functionality to de-gamma all input textures and color swatches by .455
-preview renders in Maya with the mia-exposure_simple lens shader with its default setting and gamma correction of 2.2
-render out images and passes as 16bit(half) floating point EXR images, deleting the lens shader before output.
-Preview composits within Shake using the VLUT with a gamma of 2.2
-Render out final images to whatever format or bit depth os necessary with a 2.2 gamma correction before the fileOut node.

Through this process I noticed that the falloff of my lighting on models looked very flat, with a harsh falloff to the shaded regions. This makes it rather difficult to get smooth, pleasing images. I am generally using simple lighting setups involving points and directional lights since I am rendering animation. I put together a few simple test renders to illustrate my problem and hopefully get some suggestions on what I am doing wrong.


Here we have an image rendered with the default Nexus shader and one spotlight above the object. This is using normal methods i.e. no de-gamma or correction nodes of any kind. The shader is based on Maya shaders and the result for this is identical to that of a lambert.

http://img195.imageshack.us/img195/7661/gamma22nexus.jpg (http://img195.imageshack.us/i/gamma22nexus.jpg/)


Here is the problem image created with the series of steps that I describe above. Note the harsh line on the edge of the shaded region and lack of definition in the illuminated region:

http://img36.imageshack.us/img36/7426/linearfallofftestgamma1f.jpg (http://img36.imageshack.us/i/linearfallofftestgamma1f.jpg/)



It is straightforward enough to appy a lookup to the image to smooth things out, but this seems like a hack that will cause me problems in the future - not to mention require lookup nodes on every single light pass. Also, some weirdo banding is introduced. Perhaps my [half] 4x16 images don't have enough bit depth:
http://img195.imageshack.us/img195/111/linearfallofftestgamma1i.jpg (http://img195.imageshack.us/i/linearfallofftestgamma1i.jpg/) http://img195.imageshack.us/img195/linearfallofftestgamma1i.jpg/1/w640.png (http://g.imageshack.us/img195/linearfallofftestgamma1i.jpg/1/)


Thinking that perhaps the lack of decay on the light causes the problem, and that perhaps the maya/Nexus shader is tweaked to give pleasing results using the "incorrect" inputs that we usually give it. I set the light to cubic decay boosted intensity way up to compensate. the falloff was more pleasing but still doesn't look right to me, plus my intensity value was 800 or somesuch.

http://img188.imageshack.us/img188/8493/linearfallofftestgamma1d.jpg (http://img188.imageshack.us/i/linearfallofftestgamma1d.jpg/) http://img188.imageshack.us/img188/linearfallofftestgamma1d.jpg/1/w640.png (http://g.imageshack.us/img188/linearfallofftestgamma1d.jpg/1/)


Suspicious that my shader is to blame, I rana test with the mia-material_x shader (with gamma uncorrected inputs and gamma corrected outputs as I imagine that I am supposed to) and no light decay. Again, results were better than with the maya/Nexus shader, perhaps what I should expect?

http://img195.imageshack.us/img195/467/linearfallofftestgamma1igq.jpg (http://img195.imageshack.us/i/linearfallofftestgamma1igq.jpg/) http://img195.imageshack.us/img195/linearfallofftestgamma1igq.jpg/1/w640.png (http://g.imageshack.us/img195/linearfallofftestgamma1igq.jpg/1/)


FWIW I have many assets set up with the Nexus shader for a project that I am working on (because of its excellent pass system) and am really looking for a way to get the right falloff with that.

cheers everyone!


edit: added a red arrow pointing out the problem area
http://img268.imageshack.us/i/gamma22lambert.jpg

ndeboar
06-17-2009, 10:08 AM
I'm getting this too.

Maybe this is more "realistic" ?

Dromond
06-17-2009, 05:26 PM
I'm getting this too.

Maybe this is more "realistic" ?

Hmm, realistic or not, it looks bad and I need to find a way around it. There are many benefits to the linear workflow but this is not one of them!

klingspor
06-17-2009, 08:16 PM
Hmm, realistic or not, it looks bad and I need to find a way around it. There are many benefits to the linear workflow but this is not one of them!Your workflow looks about right to me, though I can't speak for the Nexus shader as I have no first hand experience with it.

But it does look to me like it is a problem with this shader. When you compare the render of the mia it's quite clear that the Nexus shader is doing something unexpected internally.

Also I'd suggest enabling FG and/or GI when doing lighting tests like these, especially if you want to judge realistic light falloff and the like. Getting some ambiance in there will make it look more natural straight away and the eye won't be distracted by the harsh blackness at the bottom of the sphere.

Dromond
06-17-2009, 08:56 PM
Your workflow looks about right to me, though I can't speak for the Nexus shader as I have no first hand experience with it.

But it does look to me like it is a problem with this shader. When you compare the render of the mia it's quite clear that the Nexus shader is doing something unexpected internally.

Also I'd suggest enabling FG and/or GI when doing lighting tests like these, especially if you want to judge realistic light falloff and the like. Getting some ambiance in there will make it look more natural straight away and the eye won't be distracted by the harsh blackness at the bottom of the sphere.

Well it's good to hear that my process description is on the right track. Here is the thing:

Although I didn't post it, the result of the Nexus shader is identical to that of a standard Maya lambert. (And the shader is based on the Maya shaders, so that makes sense.)

Certainly, applying some actual lighting expertise to this image would help to to look more realistic, appealing, etc. but that is not quite what I am getting at. The problem is that a standard light on a standard sphere is so flat looking that it needs either serious tone mapping work or multiple lights to get a pleasingly smooth result that reveals the form of the sphere (or the form of whatever the light is illuminating) that approaches the result of the same render under more normal situations. i.e. I could think of many ways to make this image look better, but I am wondering if there is something more fundamental that I can change so that I am not running into the problem with every light, object and scene that I run through this work flow.

cheers!

klingspor
06-17-2009, 09:00 PM
So what happens if you turn off Nexus' internal gamma correction? I suspect that's where the problem lies because every thing else seems pretty standard.

MasterZap
06-18-2009, 08:28 AM
Here is the problem image created with the series of steps that I describe above. Note the harsh line on the edge of the shaded region and lack of definition in the illuminated region:

http://img36.imageshack.us/img36/7426/linearfallofftestgamma1f.jpg (http://img36.imageshack.us/i/linearfallofftestgamma1f.jpg/)


http://img268.imageshack.us/i/gamma22lambert.jpg

Thing is, this is actually the correct render for a lambertian surface.

You are not used to seeing it, because your mind has been hammered into seeing the wrong looking lambertians that computer graphics have been shoving in our faces for ages and eons.

Experiment time: Take a ping pong ball and a flashlight and go into a dark room and try it. This is actually much more realistic.

/Z

klingspor
06-18-2009, 03:48 PM
Thing is, this is actually the correct render for a lambertian surface.

You are not used to seeing it, because your mind has been hammered into seeing the wrong looking lambertians that computer graphics have been shoving in our faces for ages and eons.

/ZAre you sure everything is fine with his render? I normally wouldn't doubt a word you say, but that harsh falloff doesn't look right to me at all.

To test this I recreated his scene using stock MR shaders: mia_material with a gamma corrected color set to [0.5,0.5,0.5], weight 1.0 and roughness set to 0.0 to simulate a Lambertian surface. One area light with cubic falloff and a mia_exposure_photographic with gamma 1.0 and setup to mimic the dark exposure in Dromond's renders.

Rendered to .exr and final gamma correction to 2.2 in Photoshop.

If you look at the image I rendered, the falloff on the left side of the sphere is much more natural than that on Dromond's with the Nexus shader. Sorry, it's very dark which makes the comparison a tad difficult.

What am I missing here?

Dromond
06-18-2009, 05:23 PM
First off, much thanks to you all for your help.

...This is actually much more realistic.

/Z

Shucks!! From the horse's mouth, too. This is what I was afraid of. Thanks, Mr. Zap.


Are you sure everything is fine with his render? I normally wouldn't doubt a word you say, but that harsh falloff doesn't look right to me at all.

To test this I recreated his scene using stock MR shaders: mia_material with a gamma corrected color set to [0.5,0.5,0.5], weight 1.0 and roughness set to 0.0 to simulate a Lambertian surface. One area light with cubic falloff and a mia_exposure_photographic with gamma 1.0 and setup to mimic the dark exposure in Dromond's renders.

Rendered to .exr and final gamma correction to 2.2 in Photoshop.

If you look at the image I rendered, the falloff on the left side of the sphere is much more natural than that on Dromond's with the Nexus shader. Sorry, it's very dark which makes the comparison a tad difficult.

What am I missing here?


I think that I know what's going on here. Allow me to make a few points:

A) Rendering with appropriated gamma corrected images in linear space leads to more realistic calculations of light transmission - which then requires more realistic light inputs to give the pleasingly soft and smooth light falloff that we are used to being delivered to us, however incorrectly.

B) I've included a few more test images below along the lines of yours which I think illustrate this.

C) This is kind of a problem. Linear space definitely opens up some possibilities and takes care of long standing problems. However having to give more accurate light inputs - such as using cubic falloff and area lights - seems like it comes at a serious cost in render time (again this is for animation production) and ease of control. Perhaps I am not looking at this the right way, or being suspicious of techniques that I generally avoid. In other words, I am used to being able to use unrealistic lights that come from discrete points and thus render very fast - and end up with images (however unrealistic) that I can easily work with. Hmmm.

These are all rendered using the mia_exposure_simple node with default settings.

1) A Maya lambert with gamma correct input of 0.5 0.5 0.5

http://img197.imageshack.us/img197/1546/01mayalambert.jpg (http://img197.imageshack.us/i/01mayalambert.jpg/)


2) A Nexus shader with internal gamma (identical to the lambert if you overlay them.)

http://img38.imageshack.us/img38/6062/02nexus.jpg (http://img38.imageshack.us/i/02nexus.jpg/)


3) Mia material set up the same way as Stefan's. The shadow line is slightly softer but the overall falloff is still very flat.

http://img19.imageshack.us/img19/2007/03miamaterial.jpg (http://img19.imageshack.us/i/03miamaterial.jpg/)


4) The same mia shader but with the light given cubic falloff, intensity 6000. The overall falloff is smoother and shows more of the sphere's form.

http://img44.imageshack.us/img44/5816/04miacubic.jpg (http://img44.imageshack.us/i/04miacubic.jpg/)

5) The same shader and light but now with area lgiht turned on. The shadow line is much smoother.

http://img196.imageshack.us/img196/70/05miacubicarea.jpg (http://img196.imageshack.us/i/05miacubicarea.jpg/)


6) The original lambert with the cubic/area light and falloff to smooth the penumbra. Not as good as mia-material but OK.

http://img188.imageshack.us/img188/4319/06lamertcubicarea.jpg (http://img188.imageshack.us/i/06lamertcubicarea.jpg/)




So, I think that my question is answered, but my problem isn't quite solved. Do I really want to be using area lights and cubic light decay all of the time? The cubic decay could take some getting used to - the area lights might slow everything down a lot (I use a lot of spotlights) when rendering for animation. Hrrrm.

Dromond
06-18-2009, 05:31 PM
And here is my own light comparison with the gamma node -> maya lambert setup.

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

klingspor
06-18-2009, 05:38 PM
And here is my own light comparison with the gamma node -> maya lambert setup.OK, looks like that explains why I thought it didn't look right.

Sorry, can't help with your plight, though. If you want to use a linear workflow you'll just have to stick to the newer physically correct shaders and make sure your lights fit in with that workflow.

Otherwise you could just say "Screw this, it's too complicated for my workflow at the moment" and go with whatever works for you. It's not like nobody made any good animation before this linear workflow came along to redefine the "rules". :shrug:

Dromond
06-18-2009, 05:42 PM
OK, looks like that explains why I thought it didn't look right.

Sorry, can't help with your plight, though. If you want to use a linear workflow you'll just have to stick to the newer physically correct shaders and make sure your lights fit in with that workflow.

Otherwise you could just say "Screw this, it's too complicated for my workflow at the moment" and go with whatever works for you. It's not like nobody made any good animation before this linear workflow came along to redefine the "rules". :shrug:

That sounds like good advice. The light is really more the problem than the shader at least as I see through my results. The benefits of the linear workflow (and compositing high bit depth images) are worth it to work around this. I'll use area lights when necessary and re-grade my light falloff in post when I have to.

MasonDoran
06-20-2009, 08:46 PM
try viewing the render in a compositing app with sRGB color space.

Dromond
06-20-2009, 10:58 PM
try viewing the render in a compositing app with sRGB color space.

Yes, I'm doing that. Shake with a 2.2 gamma VLUT.

JasonA
07-01-2009, 04:24 PM
Iv'e never worked with the Nexus shader system, but it sounds very intriging. Im a bit confused though because you're using cubic falloff on your lights while saying the shader is forcing you into a 'realistic' light workflow. Lights decay quadratically, so in theory it should look more 'realistic' with those type setting but your renders with cubic do look better. It seems like the logic isn't quite adding up.. :)

Dromond
07-03-2009, 01:30 PM
Iv'e never worked with the Nexus shader system, but it sounds very intriging. Im a bit confused though because you're using cubic falloff on your lights while saying the shader is forcing you into a 'realistic' light workflow. Lights decay quadratically, so in theory it should look more 'realistic' with those type setting but your renders with cubic do look better. It seems like the logic isn't quite adding up.. :)

The Nexus shader actually doesn't force you to do anything different than you would with any other shader. The gamma correction for color inputs is purely optional. As for what the realistic decay rate of light is, i have absolutely no idea. So I would be just as perplexed as you on that one.

The shader/plugin is available here: http://www.luma-pictures.com/nexus/

InfernalDarkness
07-03-2009, 06:11 PM
It's not like nobody made any good animation before this linear workflow came along to redefine the "rules".

In this area I'm completely "in the dark". I've never understood the reason to use "linear workflow", or any of the gamma-correction, or anything like that. Why would someone do such a thing? Seems like a LOT of work, and the output images don't appear to be any different than ones we could generate without any "linear workflow." When using exposure_simple, I generally just turn the gamma down to 1.0, and if it needs to go higher for print, I just turn it back up in post (Photoshop). Not "physically accurate" by any means, but is that why "linear workflow" is important? Physical accuracy?

Maybe this is the wrong place to ask this, but what is the purpose of all this gamma-correction stuff and what is "linear" about the workflow?

As for what the realistic decay rate of light is, i have absolutely no idea.

From FaultyMoose:

Physical light has a quadratic decay. What this means is:

As you double the distance, you quarter the intensity of the light.

The earth is ~12756km in diameter.

It is ~150,000,000km from the sun.

There's going to be an imperceptible decay in light intensity between 150,000,000km and 150,012,756km :)

Even by the time you get to Mars, ~250,000,000km from the sun, you're still looking at around 50% of the intensity of light hitting Earth.

With practical lights, such as light bulbs, for a realistic result you need a standard distance. Let's say, a light bulb has an intensity of 1.0 at 1m away from the source. Meaning it has an intensity of 4.0 25cm away, and 0.25 4m away. Generally though in real time rendering quadratic decay is replaced with linear decay (double the distance, 1/2 the intensity) as it's easier to avoid hot spots and tonally map your scene for an apparent higher dynamic range. In addition, a terminator (or a max distance) is defined, and changing the decay simply changes the way the intensity curve falls off from the light source to its max range. You don't want to be calculating every light to infinity :)

Hope that helps, Dromond!

leif3d
07-03-2009, 08:23 PM
In this area I'm completely "in the dark". I've never understood the reason to use "linear workflow", or any of the gamma-correction, or anything like that. Why would someone do such a thing? Seems like a LOT of work, and the output images don't appear to be any different than ones we could generate without any "linear workflow." When using exposure_simple, I generally just turn the gamma down to 1.0, and if it needs to go higher for print, I just turn it back up in post (Photoshop). Not "physically accurate" by any means, but is that why "linear workflow" is important? Physical accuracy?

Maybe this is the wrong place to ask this, but what is the purpose of all this gamma-correction stuff and what is "linear" about the workflow?



Gamma correction and Linear workflows have been around for quite a while, even Stuart little in 1999 was rendered with a Linear workflow in Renderman. So I'm not sure why people are saying it just "came along," when in reality it has been used for more than a decade.

Max users have enjoyed a correct workflow for quite a while now, while everyone else is either stuck doing a lot of work or having an R & D department take care of the workflow behind the scenes so artists don't have to worry about it. In fact, I've encountered many Max users who apply a linear workflow and have no idea what it's doing behind the scenes, which shows you how greatly simplified the system is.

-Here is a very simple explanation for Cinema 4D which is directly applicable to Maya:
greyscalegorilla.com/blog/2009/03/24/gsg-cast-22-gamma-correction-in-cinema-4d/

-Here is a very good and easy to understand explanation of Gamma correction by Yves Poissant:
ypoart.com/tutorials/tone/index.php

-Forthe best an most detailed explanation go to Master Zap's site:
linearworkflow.com

MasterZap
07-03-2009, 08:28 PM
In this area I'm completely "in the dark". I've never understood the reason to use "linear workflow", or any of the gamma-correction, or anything like that. Why would someone do such a thing? Seems like a LOT of work, and the output images don't appear to be any different than ones we could generate without any "linear workflow." When using exposure_simple, I generally just turn the gamma down to 1.0, and if it needs to go higher for print, I just turn it back up in post (Photoshop). Not "physically accurate" by any means, but is that why "linear workflow" is important? Physical accuracy?


In short, Yes.

A computer monitor is a nonlinear device. Memory positions contain values from 0-255 (8 bits) but the halfway value (127) is NOT half as bright as the full value (255), it is only about 20% as bright.

Surely you would want two lights shining on an object to add up to twice as much light?

Well, if you do not care about gamma, you could be adding 127 (= 20% light) + 127 (= 20% light) and get 255 (= 100% light).

So sure; if you think 2 + 2 is 10, then by all means, ignore gamma correction.

I have a plan to create as site that will explain this once and for all, and it will be at www.linearworkflow.com but unfortunately I havn't had time yet, and I apologize to the universe for that. I will, at some point, do so.

To be harsh; if you (or your software) don't care about gamma correction, you should just stop rendering now, go home, and be ashamed. Nothing you do will ever be "accurate" in any way. The problem is most software has blindly ignored this for years and years;

Until recently, 3ds Max is the only Autodesk product that even cared about gamma, and even there it was off by default (and had bugs). I am the guy who has been teaching autodesk about linear workflow, and finally in max 2010 there is actually a quite well working linear workflow by simply
- turn on gamma correction
- set gamma to 2.2
- set "input" and "output" gamma to 2.2
- check the boxes "affect color selectors" and "affect material editor".

XSI ... oops sorry, "Sofrtimage" :) ... has a whole color management system (glory to the skies!). AFAIK, Maya still is in the dark, gamma wise, which is depressing indeed.

Most compositing software is learning; AfterEffects now (after Stu Maschwitz did the same kicking and screaming at Adobe as I am doing at Autodesk) has floating point linear workflows.

Basically, linear workflow is imperative. It is step 1, before you do anything else.

The only reason it is "work" is, unfortunately, because software has been ignoring it for 20+ years. Because nothing has been physically correct anyway, so it was just another "wrong" in the infinite list of "wrongs" piled on top of eachother in traditional CG.

When rendering has gone physical, displaying the physical data incorrectly is just.... silly. It will look incorrect. It won't work. It's like making a perfect painting, then pouring black ink across it and wrapping it in cellphane.

The rendering engine "Maxwell" took the world by storm back in the day, and everyone thought it was due to "spectral rendering". Bollox. It simply did gamma correction correctly out of the box, plus added some nice tonemapping on top of that. The rendering itself was simply fairly plain physically correct rendering, nothign special. It was simply displayed correctly.



/Z

InfernalDarkness
07-03-2009, 09:10 PM
To be harsh; if you (or your software) don't care about gamma correction, you should just stop rendering now, go home, and be ashamed. Nothing you do will ever be "accurate" in any way. The problem is most software has blindly ignored this for years and years;

I understand what you're saying from a mathematical standpoint; of course 2+2 isn't 10 (unless you're religious or whatever).

But from a necessity perspective, why is this necessary? My clients certainly don't mind. Nor would they possibly care, if I were to explain this to them. In fact if I did explain this to them, they would likely not remain my clients, as most of the people who my company caters to are morons at best (homeowners).

Is linear lighting about photorealism, then? Would say, a competitor (if there were any other Maya-users as low-end as me in this world) using this linear workflow create more realistic, lifelike images which would make mine look fake, since I'm not using a linear workflow?

I'm seriously asking why this is necessary, when so many people have made such beautiful renders without it. But, Master Zap, I am taking your word for it that it's important. The concept is sound, your math is infallible and that makes perfect sense to me, but I guess I just don't understand the necessity?

Are you saying that an image done in linear light is impossible to render using non-linear lighting? Or are you saying that linear workflow makes more accurate, realistic rendering possible and that's why we should use it?

Again, I apologize if I sound like an idiot. It's just entirely new to me here; I've read of the topic but never tried using it.

leif3d
07-03-2009, 10:11 PM
In my opinion, if you have done research and have come to the conclusion that it has no benefit to you, then you probably shouldn't bother with it.

Everyone needs to understand this simple point:

Gamma correction is only about what's right or wrong. It has nothing to do with artistic freedom. If you are not using a Linear Workflow, then you are rendering Computer Graphics the wrong way. Period. This doesn't mean you can't make wonderful images.

Without a proper linear workflow you will always work around lighting and shading inaccuracies and you will always get an image that does not obey to what you are telling the software to do. You are only making your life harder.

Now. This doesn't mean you can't do incredible images without gamma correction and make a very good living working non-linearly, but it's like Chris Rock said: "You can drive a car with your feet, but it doesn't make it a good idea."

As a related issue...a couple of guys at work think I'm crazy when I tell them that they should map their wacom tablets to the aspect of their monitor, but then they tell me: "But we'll loose tablet space?!" Then I tell them: "Well, you realize that when you draw a circle, it's not a circle right? it's an oval..." Then they turn to their monitor and draw a perfect circle, while looking at me like I'm a jackass. They had no idea that their hand motion is compensating for what they are seeing on screen.
At this point I ralized that getting used to working a certain way is stronger than what's wrong or right, and depending on your personality and goals, people will accept this reality as correct unless necessity dictates otherwise. For others, being anal comes at a cost of sleepless nights and much more stress.
I fit in the second category.

In the end, CG depends on what the person wants to get out it. If someone is happy working in the most innacurate way, because it gives them great results, then by all means stay on that path. It's called artistic freedom. Just make sure you understand that you are bending the system and working against the design of the software.

MasterZap
07-04-2009, 01:17 PM
leif3d, The above was a beautiful beautiful post, and it should be framed. Expressed perfectly, IMHO!


Is linear lighting about photorealism, then? Would say, a competitor (if there were any other Maya-users as low-end as me in this world) using this linear workflow create more realistic, lifelike images which would make mine look fake, since I'm not using a linear workflow?


Yes, exactly.

Any time you throw two lights of the same intensity of something, you are not throwing twice the amoutn of light, you are throwing about 5 times the amount of light. Which makes other bits end up dark, which causes you to throw in even more fill lights to compensate. You end up using lights with no physical falloff (linear or even NO decay on the lights, eek) because using the real quadratic falloff looks really wierd without gamma correction (you get a burnt out spot, one inch of useful light, and blackness).

Global illumimation behaves realisitically with a linear workflow. Without it, light doesn't reach in; you end up addign additiona bonce lights, and basically "working it" in ways you shouldn't need to.

Like leif3d's "draw a circle on a wacom" analogy; the risk is you are so used to "drawing the unround circle" that giving you a properly calibrated tabled may actually confuse you. Starting to use lienar workflow takes a little bit of "de-learning".


I'm seriously asking why this is necessary, when so many people have made such beautiful renders without it. But,

Because they worked it, they tweaked it, and they hammered it until they got "the pretty picture". It still doens't look completely "real" but it could be "pretty".


Are you saying that an image done in linear light is impossible to render using non-linear lighting?

Yes. Exactly. Since simple addition breaks (and light is basically additive), even the most fundamental combinations of effects end up wrong. You can make "lookalikes" and hacks, but they will be lookalikes and hacks only.

Sometimes - and this is scary - shaders contain hacks already that they don't even tell you; coz the programmer saw "this looks crazy" and implement a stupid workaround in the shader, without telling anyone. Such a shader contains a hack for nonlinear-workflow and may actually break under a linear workflow (and the hack is just a hack, not a real fix, the only real fix is doing it right).

An example of such a hack is shader attenuating the diffuse under the specular highlight, because they have found the specular highlights blow out in an unrealistic and ugly way. So they write code to baskcally subtract the specular highlight from the diffuse. (Or basically comp on the specular in "screen" mode). Both are horrible horrible HORRIBLE hacks, and the correct thing is to simply work linearily. The highlights look wrong because add breaks int he nonlinear space, whereas the prpoer add in the proper linear space simply looks correct, no hacks needed.



Or are you saying that linear workflow makes more accurate, realistic rendering possible and that's why we should use it?

Yes. More accurate, more realistic. Not necessairly "more beautiful" because ther renessaince painters could make "pretty" without regards to the linearity of the response in the canvas and the paint, they just "painted until it looked nice", and did that with blood, sweat, and tears.

/Z

Undseth
07-04-2009, 02:32 PM
I wonder if perhaps anti-aliasing in a rendering (pixel sampling or sub-pixel sampling) will be improved if a rendering engine is 100% designed for linear workflow. Purely speculative on my part.

InfernalDarkness
07-04-2009, 03:47 PM
Thanks for your summations and replies, Leif and Zap. Now I'll just have to give it a shot, and learn how to make linear lighting in my images too. I've always bordered just this side of photorealism, never quite reaching it, and maybe not using this technique is holding me back on that level.

Dromond
07-04-2009, 04:39 PM
I wonder if perhaps anti-aliasing in a rendering (pixel sampling or sub-pixel sampling) will be improved if a rendering engine is 100% designed for linear workflow. Purely speculative on my part.

Do any packages other than Maya do this? (Max 2010?) Having the contrast ratio determine how many samples to use based on a linear image (with contrast only in the high range that our eyes usually gloss over) is so sloppy. I'm sure that this could be accounted for at render time by gamma-correcting the values before the contrast part of the process happens, even if you are writing linear to a float format.

cheers everyone!

Undseth
07-04-2009, 05:03 PM
Just want to clarify that I was simply hoping, that maybe antialising in a rendering would improve somehow. It was probably a very stupid of me.

Stellios
07-04-2009, 10:48 PM
i hate to interject, and am by no means trying to hijack this thread, but i am in need of clarification... I understand the concept of gamma and linear workflow (to an extent) But i assumed that correction only needed to take place on textures that i hand paint in Photoshop or similar app.

does that mean the default shaders native to maya are in a non-linear color space? Meaning all along maya has shipped shaders that have never worked properly with the renderers?

Hamburger
07-05-2009, 01:40 AM
What about this:

http://mayastation.typepad.com/maya-station/2009/05/colors-are-washed-out-with-mental-ray-sunsky.html#comments

Also, Maya swatches need to be adjusted with gammaCorrect nodes using the frambuffer .455 method

its under the developments consideration.

take what you want from these comments, but hopefully it means AD are going to have some sort of a linear wokflow in 2010 or at least much better system than they have now!
have to wait a few months i guess....

leif3d
07-05-2009, 04:19 AM
leif3d, The above was a beautiful beautiful post, and it should be framed. Expressed perfectly, IMHO!

Thanks for the very nice complement Zap. Especially coming from you. :)

I wonder if perhaps anti-aliasing in a rendering (pixel sampling or sub-pixel sampling) will be improved if a rendering engine is 100% designed for linear workflow. Purely speculative on my part.

Your speculation is right on. Try rendering a wireframe with a gamma of 1 and then with a gamma of 2.2, you will notice a very nice shade of gray with a 2.2 gamma. It will also have very nice antialising free of any weird flickering, especially on very fine detail that is smaller than a pixel. Say bye to cranking up the AA for no good reason!


does that mean the default shaders native to maya are in a non-linear color space? Meaning all along maya has shipped shaders that have never worked properly with the renderers?

Sort of...
I'm sure Zap can give a more accurate explanation, but in lamens terms, shaders work fine in the default scene gamma of 1, because you are picking colors with a 2.2 display, the problem is that lighting intensities and falloffs are not calculated the right way, therefore giving you a washed out picture.
Once you change your render output to gamma 2.2, then your lighting will be correct, but the shading is now off, because the color you are choosing is being seen through a monitor with a gamma of 2.2, so when you apply a gamma of 2.2 to a final image you will get things blown out to hell again.

The only way to get this right, is to give your final output a gamma of 2.2 for correct ligthing, as well as gamma correct any color that is going to be used for rendering, except pure black and pure white. So specular colors, colors, ramps, procedurals, 8-bit textures, light color or any value driving a color swatch needs to be gamma corrected before going out to the renderer.
What this will do, is feed a value of .45 to the renderer and then the renderer will apply a gamma of 2.2, which will give you a result of 1.0.

Hopefully this simplification helps demystify gamma correction a bit.

I'm not going to go into more detail, because there is so much material online on this topic that it's not worth it. Check out the links I posted above for a good start.

Stellios
07-05-2009, 07:55 PM
one more question:

at the begining of this thread the author writes he uses a nexus shader when he applied the inverse gamma to the lambertian surface. How can I plug the gamma correct utility into my shaders to set an inverse gamma? Do people normally use this nexus shader? or do they adopt workflows native to maya?

Dromond
07-05-2009, 08:18 PM
one more question:

at the begining of this thread the author writes he uses a nexus shader when he applied the inverse gamma to the lambertian surface. How can I plug the gamma correct utility into my shaders to set an inverse gamma? Do people normally use this nexus shader? or do they adopt workflows native to maya?

Let me take this one.

The Nexus shader is freeware put out by Luma Pictures. It is not commonly used, to my knowledge.

What you want to do is use a regular Maya gamma node with values of 0.455 between your file textures (or other colors) and your shader color imput. I reccomend doing a lot of research through the link in this thread if you want to change your workflow.

3DRenderer
07-19-2009, 09:20 PM
Zap, when do you think your linearworkflow.com site will be complete? Around and about when? I have just been waiting and can not wait til its done. I have been reading up on everyone else blogs and posts about workflow, gamma, and such. And would really like to thank everyone for the knowledge. Zap, David, Robert, Andrew, etc....

royter
07-21-2009, 02:16 PM
AFAIK, Maya still is in the dark, gamma wise, which is depressing indeed.
/Z
is that also true for maya 2010?

Hamburger
07-22-2009, 02:32 AM
we'll find out in two or three weeks.

mercuito
08-27-2009, 04:16 AM
So how does the mia material calculate the diffuse differently from the standard lambertian shading? What shading model is it using that gives it a slightly less hard falloff?

I'd like to know so I can incorporate this in a shader I'm working on.

Thanks

Kel Solaar
08-27-2009, 07:29 AM
So how does the mia material calculate the diffuse differently from the standard lambertian shading? What shading model is it using that gives it a slightly less hard falloff?

I'd like to know so I can incorporate this in a shader I'm working on.

Thanks

Seeing the Roughness Parameter it would make sense that it's an Oren Nayar like Diffuse Component. Need Zap to confirm though :D

KS

leif3d
08-27-2009, 02:17 PM
So how does the mia material calculate the diffuse differently from the standard lambertian shading? What shading model is it using that gives it a slightly less hard falloff?

I'd like to know so I can incorporate this in a shader I'm working on.

Thanks

I was wondering the same thing the other day.
I assumed it was something like a Cook-Torrance mixed with and Oren Nayar component.

mercuito
08-27-2009, 08:52 PM
Correct me if I'm wrong, but I'm pretty sure that Oren Nayar is exactly the same as a lambert till you adjust the roughness - so that wouldn't explain why the soft falloff is there when the roughness = 0;

However, I have been able to perfectly match that mia material by doing a little cheat inside my shader - who knows this might be what the mia does too.

dyei
10-13-2009, 03:10 PM
when i see threads like this, i feel strong desires to study raytracing and shader writting in deep.

another question would be:

what happen when your gamma in your renders is right, but your monitor gama is not? you could see the wrong data anyway?

crispy4004
10-13-2009, 07:04 PM
So in simple terms, is Linear worfklow the process of achieving the full range of values in a rendered image? In other words avoiding clipped highlights and shadows that our monitors automatically resort to when the values are too high? I get that screen in compositing is just a dirty hack to prevent the highlights from clipping.

What I don't understand is why the finite gamma correct value for the textures? Textures are an interpretation of real life by either a digital camera or artist, where is this .455 gamma value coming from?

Also, in terms of an animated sequence, why should I be concerned with implementing a true linear workflow when I have to fake so much with Final gathering + AO to avoid flicker anyways? Is it enough to understand the theory behind these problems so when I gamma correct in Fusion I know how to tackle the clipping?

Don't get me wrong, if linear workflow was easier to implement I would add it to my workflow in an instant. Hopefully that will be soon with mercuito's core render pass system.

CGTalk Moderation
10-13-2009, 07:04 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.