Saturday, April 14, 2012

physical_light and areaLight

Today I read a post on CGTalk that brought to my attention something I hadn't noticed before about area lights and mentalray. Prior to maya 8, if you wanted an area light in mentalray you would start with a spotlight and set some attributes to turn it into an area light. This changed in maya 8 where the maya areaLight now has a mentalray section with a bunch of new attributes.
The thing I had not noticed is best explained by showing some renders.
The first picture, which I will use as a comparison, is rendered using maya software renderer with raytraced shadows. An areaLight has been scaled into a thin rectangle. (I have positioned a white polygon to give a visual reference of the light's position). The illumination does not look very realistic given the shape of the light.
Here is a snapshot of the areaLight's attributes. Notice that I have set quadratic decay to simulate that of a real light.
The second picture was rendered using mentalray and I simply enabled the mentalray area light with the "Use Light Shape" flag. (The white polygon is no longer required since mentalray area lights can be flagged "Visible".) This is worse than the software render - there appears to be no relationship between the shape of the light and the illumination.
Here is a snapshot of the mentralray tab in the areaLight's attribute editor.
The thing is that the walls are brightly illuminated, with a sudden cut off at the height of the light. It is as if the areaLight is extending to infinity and ignoring the shape of the light!
Fortunately the solution to this problem is a simple one. You need to use a mentalray physical_light shader, which you simply connect to the "Light Shader" slot in the "Custom Shaders" tab of the areaLight's attributes.
The third picture is a mentalray render using an areaLight with a physical_light as the light shader. This is a much more convincing result.
The physical_light has it's own set of attributes with take over most of the funtionality of the areaLight. So here's a snapshot of the areaLight attributes.
and the physical_light attributes.
Note that the color swatch is used to set the intensity of the light as well as its hue. In my render I set the luminance value of that swatch to 10,000.
The "Cosine Exponent" can be used to control the spread of the light. It is interesting to note that setting it to 0.1 gives a result similar to the render without the physical_light connected. A value of 5.0 makes the light very directional with almost no spread at all.
One more thing. If you go to the trouble of hooking up a physical_light you can get a little bit extra for almost no cost. Make a few copies of the areaLight and hook up the same physical_light to each copy.
This is what it looks like rendered using mentalray with three areaLights that share a single 
 physical_light as the light shader.


No comments:

Post a Comment