Photometric Light Creation?

Photometric Light Creation?

Anonymous
Not applicable
1,095 Views
19 Replies
Message 1 of 20

Photometric Light Creation?

Anonymous
Not applicable
I've used Maya for a while, but most of my work is done in 3ds Max. I am exploring the Maya 2011 trial version, and I'm trying to figure out how to set up proper photometric lights. In 3ds Max, a photometric light is just a click away. But it seems that in Maya I have to first create a standard light, then add a photometric light shader and a photon emitter. Is this correct? Is there a faster way to do this? Can a script be made that creates the light for you?

I've been searching around for some good Mental Ray for Maya resources. Can you recommend any of your favorites?

Thanks!
0 Likes
1,096 Views
19 Replies
Replies (19)
Message 2 of 20

Anonymous
Not applicable
Just thought I'd try and bump up this thread. I would really like to know if a script can be made that will create a new Area light and assign the mia_photometric light shaders to the light shader and photon shader components. This seems like an easy task for someone who's familiar with MEL. But as I'm not one of those people, maybe its not as easy as I assume...

Any scripters out there know how to do this?
0 Likes
Message 3 of 20

Anonymous
Not applicable
If you can provide a sample scene file (so that I can see what exactly you want), may be I can help you with this script. Looks like an easy Job.
0 Likes
Message 4 of 20

Anonymous
Not applicable
Here is a sample scene with a sample light all set up. Thank you for your help.

Edit:

The script needs to be able to create a new Area Light and mia_photometric_light shader each time it is run.

(1) Create a new Area Light
(2) Enable "Use light shape" within the mental ray options
(3) Change the shape from the default rectangle to a sphere
(4) Set samples to 32
(5) Create a new mia_photometric_light node and assign it as a Light Shader and Photon Emitter
(6) In the mia_photometric_light node set the "Manual Peak Intensity Cd" to 2000

You'll notice that I also have a mental ray exposure node assigned to the camera.

photometriclightscene.zip

0 Likes
Message 5 of 20

Anonymous
Not applicable
Ok, so here's what I've come-up with,

https://www.creativecrash.com/maya/downloads/scripts-plugins/lighting/c/photo-metric-light-setup

It works 100% accurate only if there's no Other Area Light in the Scene.
This limitation is due to the fact that I am still working on fetching the newly created areaLight-name in a variable.

Rest all works fine I guess, just source the script and it'll create a setup for you. I'll try to enhance it with UI and other stuff as and when I get time. Please check if I've left anything else.

Now here's a query for you, can elaborate the purpose of this kind of setup, I mean how does it add-up to your Image.
0 Likes
Message 6 of 20

Anonymous
Not applicable
Yeah the tough part is getting it to work so that it creates new nodes each time so that it can be used repeatedly in the same scene and session.

Now here’s a query for you, can elaborate the purpose of this kind of setup, I mean how does it add-up to your Image.


In the Maya help, look for the mental ray "Sun and Sky" section. Towards the end of that it discusses Photometric Light. Here is a copy and paste of part of it:

The Problem
One difficulty in using base mental ray shaders to render a physically correct scenes with GI (using photons), is in balancing the photon energy and the direct light correctly. The reason for this is that the intensity is generally specified as an intensity for some given direction (for example the peak intensity on a spotlight), but the energy is the sum of (or technically, the integral) of all such intensities in all directions.

So for example for a spotlight, for the same peak intensity, you would need different photon energies depending on the width of the spotlight cone, and depending on the shape of the intensity distribution within that cone. And while this can be calculated for a mathematically defined intensity distribution (such as a spotlight cone) what about an arbitrary distribution as defined by a light profile?

Furthermore, to ensure optimal convergence of the photon solution for a light which varies its intensity based on the direction of light (e.g. a spotlight or a light using a light profile), instead of emitting photons of different energy in different directions, one should emit photons of similar energy in different densities. So the amount of energy-per-area (the density of photon energy) at a given point must match the direct light arriving at that point.

The Solution
To solve all these issues, we introduce the mia_photometric_light. It takes all the guesswork out of balancing the photon energy with the light intensity by peforming a numerical integration of the chosen intensity distribution to calculate the proper photon energy automatically, as well as takes care of adapting the photon density to the distribution, all automatically.

To use it, simply use the same instance of the shader as both light and photon shader on a light source. The light must have an origin (i.e. the shader does not work on an infinite light source). The light must be set to emit photons, and must be given a nonzero energy value (although the actual value will be overriden by the shader, a nonzero energy value is required, or mental ray will not emit any photons at all for the light). The exponent should always be 2. If the light is a spotlight, a spread value should be used. See the mental ray manual about lights.
0 Likes
Message 7 of 20

Anonymous
Not applicable
Thanks for the Info, and I've done changes to make it work everytime-and-everywhere (with Maya 2011+ ). Check if this works for you.
Regards.
0 Likes
Message 8 of 20

Anonymous
Not applicable
Your above link doesn't work for me. Is there another link to use?
0 Likes
Message 9 of 20

Anonymous
Not applicable
CeativeCrash says, File Pending Moderation, so Check this Attachment.

photometriclightsetup.zip

0 Likes
Message 10 of 20

Anonymous
Not applicable
Thanks this is great! There are a couple issues I've found however.

(1) When it creates the light, the "Illuminates by default" option is unchecked, so the light is not active.

(2) It creates a new mia_exposure_simple node each time the button is pressed. It should first check and see if an expsure node already exists on a camera and if so, not create a new one.

(3) I should have said that it should make a mia_exposure_photographic node instead but I failed to mention that. But I see it is as simple as replacing the node name in your script.

Thanks for your help with this!
0 Likes
Message 11 of 20

Anonymous
Not applicable
Done: Check it out.

photometriclightsetup_1.zip

0 Likes
Message 12 of 20

Anonymous
Not applicable
Very nice. It looks like your code is trying to assign the exposure control to all the "renderable" cameras in the scene. I added a couple more cameras and ran the script, but it only connects the exposure control to the default perspective camera. Can it assign to the default perspective, and all other newly created cameras? Its not a big deal though I guess to manually connect them.

Thanks for your help. You've turned about 20 clicks and multiple data entries into one button as it should be!
0 Likes
Message 13 of 20

Anonymous
Not applicable
Is it ok if it connects all the cameras to mia_exposure_photographic? coz i can't check what's new and what's old in your scene.

Every-time while executing the script, it'll check all the cameras in the scene and 'll connect mia_exposure_photographic to all of 'em.
0 Likes
Message 14 of 20

Anonymous
Not applicable
Every-time while executing the script, it’ll check all the cameras in the scene and ‘ll connect mia_exposure_photographic to all of ‘em.


That's what I thought it was supposed to do. But if I run the script in a scene with multiple cameras, it still only connects the exposure control to the default perspective camera...?
0 Likes
Message 15 of 20

Anonymous
Not applicable
OK, check the attachment:

photometriclightsetup_2.zip

0 Likes
Message 16 of 20

Anonymous
Not applicable
That fixed that issue, but now the script won't work after the exposure control has been assigned. If I try to run it again in the same scene, it says:

"//Warning: 'mia_exposure_photographic1.message' is already connected to 'frontShape.miLensShader'."

And then it stops and doesn't do the rest of the script.
0 Likes
Message 17 of 20

Anonymous
Not applicable
Sorry, my bad, I took MEL for granted :), let me fix this and 'll get back to you in some time. You can play with the old version till then.
0 Likes
Message 18 of 20

Anonymous
Not applicable
Sounds good. Thanks for your help!
0 Likes
Message 19 of 20

Anonymous
Not applicable
<b>EDIT: January 31, 2011:
now this scripts connects mia_exposure_photographic to all cameras in Scene/</b>

And CreativeCrash link is working perfectly. Finally they approved the file 😉

Download file Here (CreativeCrash)
Cheers!!! and tell me if anything goes wrong...
0 Likes
Message 20 of 20

Anonymous
Not applicable
Thanks! I haven't had much time to test it, but so far it seems to work great!

One thing I noticed - the lights that are created with this script do not show up in the "Lights" tab of the Hypershade. Do you know what could be causing this?
0 Likes