A bit halftone tinted.

úterý 7. prosince 2010

True photometric Lights in Maya and Linear Workflow.

Ok, here is my contribution to the Maya community. Now for physically-correct use of photometric lights built-in Mental Ray (as for Maya 2011 goes).

I assume you already know all about linear workflow. If not, I recommend to study some materials on the web. Just enter "Maya Linear Workflow" in Google.

One link though... this is everything you have to know about setup in Maya if you don't want to waste your time reading theory :)
(This applies to Maya versions earlier than 2011. For Maya 2011 there is easier approach described on the bottom of this article)

So, let's get this party started:

We have one true photometric light in Maya already built in. It's called Physical sun.
Go to Render settings window and in the Indirect Lighting of Mental ray settings, click on "create" button next to Physical Sun and Sky.

Attribute editor pops up with the selected mia_physicalsky1 node. There is one important thing to change.

It's called RGB Unit Conversion.
If all three values are set to 1, then it produces true photometric intensity.
If set to 0.318, then it produces intensity in candela per square meter. For more information about this, try official Maya Help and the section Sun and Sky. A lot of useful info there ;)
So leave it set to 0.318 because we want to work in candela/m2 units.

Ok, the most important part is done, now we just have to assign exposure mental ray lens to our camera.
It's because now, if you hit Render button, the image will be very bright. We have to "tonemap" the image.

Click View - Select Camera and in it's Attribute editor scroll down to "Mental ray". Inside, you'll find Lens Shader row, which has already one assigned lens (mia_exposure_simple1). This is work of script which created Physical Sun and Sky for us earlier. But we don't want this. Right-click Lens Shader and hit Break Connection. Now hit the checker next to it and create mia_exposure_photographic.

And now hit render again. A voila! If Cm2 Factor on mia_exposure_photographic set to 1, the image is ok because we are working in Candela/m2. Now we can work in candela per square meter on all photometric lights we would like to add to the scene and everything is physically correct so we can tune and don't worry about intensities too much. One important thing is to set correct Units to Meter Scale in photometric light's attributes (mia_photometric_light). I'm working on millimeters so I have to put value of 1000. If Intensity Mode is set to 0, we are working in candelas.

Great thing about this setup is, that now we have camera, which behaves like traditional SLR. We can change Fstop, ISO, Exposure and much more in mia_exposure_photographic as we are used to from (D)SLR cameras.

Two more notes

  1. In this setup, every "standard" texture will be washed out. To make it ok again just turn on Color Management in Render Setting in Maya 2011. For earlier versions on Maya you'd need to place Gamma Correct node between each texture to reverse gamma corrections. Gamma Correct's node value should be 0.4545, which is exact opposite of gamma 2.2.
  2. To render SSS shaders correctly this way, you need to uncheck Screen Composite in SSS Shader's Attribute Editor.


I'd recommend this initial setup before starting any "physically correct" lighting setup in Maya as this might save a lot of energy on trying to fix problems like too bright highlights, too dark shadow areas and overall bad light distribution when not using linear workflow. I also recommend using mia_material in such setups because, unlike Blinn, it has physically correct light distribution.

Žádné komentáře: