'Maya'

 
'Physical Light Exploited'
by Florian Wild


What's that illuminated rim around the lower right of our sphere? Looks like physical_light shades both sides of our object, regardless where the normal is pointing at. Hm, let's see if the problem persists if we use MentalRay shaders instead of the Maya lambert:



Apparently it renders correct. So, if you plan to use native Maya shaders instead of custom MentalRay shaders, physical_light might cause problems. What I came across for example, is that extremely bright final gathering blotches (blotches that are “not” caused by insufficient rays) were caused by this fact.

Second, physical_light lacks of almost every neat feature the Maya lights have: raytrace shadow attributes like light radius, amount of shadow rays, shadow ray depth limit, shadow color, light fog, light glow, intensity curve, barn doors (if you ever use it..), decay regions, and last but [i]not[/i] least the capability to emit diffuse or specular only. With this in mind, I went out to find a 'substitute' for the physical_light. To anticipate but hopefully not to lower the suspense (heh..) I can say that this has been successfully accomplished by exactly 75%.

Foremost we need to know what the key-features of physical_light are: It is a) the decay, following physical light's inverse-square falloff law. And more important b) it works perfectly together with the light's photon emission attributes, creating a physically plausible correlation between direct and indirect illumination.

To maintain this correlation, we need to find an exact conversion factor for the light's intensity. Well, if you ever tried to approximate a Maya light's intensity to a physical_light's, you probably came up with the factor 12.5, +-0.1 maybe. Hmm, why this? The physical_light's source code gives the answer: at line 109 it states

[code] switch(areatype) {
case miLIGHT_NONE: /* point, spot or directional*/
/*
* distance attenuation: 4 Pi r^2 is the area of a
* sphere around the point. Same normalization as for
* spherical light
*/
f = type==miLIGHT_DIRECTION ? 1 : 1 / (4 * M_PI * r2);
break;[/code]





..which means, the formula for distance attenuation (for point, spot and directional lights) is 1 divided by 4*pi, multiplied by the radius^2, or 1/(4*3.14159*radius^2). Now, if we use a Maya light, the radius^2 thingy is handled by simply switching the decay rate attribute to quadratic. The 4*pi needs to be handled manually though. So, if our physical light had an intensity of 200000.000, we needed to switch our Maya pendant to a quadratic decay rate, and we needed to divide the intensity by 4*pi - let's have a look. Continuing with the above example, I switched to regular Maya light and set it's intensity to 15915.494:



Page 2


3D Total Homepage