View Full Version : Controlling Physical Sun's Photons via Bounding Box

07-29-2009, 03:26 AM
I've looked and looked and read and read but I still can't make this work:

How does one have a Physical Sun cast photons in a concentrated area around a model?

I have seen one set up (http://forums.cgsociety.org/showthread.php?f=87&t=463632&highlight=photon+bounding+box) that works for point and spot lights but I tried it with a directional light with a physical sun connected as both the light shader and the photon emiter but no photons were created. "Automatic Photon" is checked and 800,000 photons were set but nothing shows up on the map visualizer when its a directional light.

Other light types work normally and the photons were "trapped" inside a cube with a transmat and a photon_basic applied to it.

Is there a simple way to do this?

Thanks in advance

07-29-2009, 01:20 PM
Did you create your Physical Sun&Sky setup via render settings (the automated mode)?
It works for me in most cases (I simply connect the mesh with the Sun BB slot) but sometimes I have to select the mesh in wich I want the photons to be casted in, then make the connections with the Sun via connection editor and in the end break the connections to make it work.
I know it sounds absurd but you have to belive me it works!
You'll notice that the numbers still remains when you break the connection between the mesh and the sun, in fact this suggest another solution: you can create a box bigger than the area of interest for your photons, then copy the BB info into the sun parameters and then hide the box, or simply delete it.
Try this ways, or just create your own way to make photon driven works, you can play with it in many ways.
Hope it helps.

07-29-2009, 01:42 PM
I didn't create them using the automated mode, I'm using an IBL sphere and the physical sky would just get in the way. :)

I create a directional node and in the Light shader and photon emmiter I connect the same instance of the physical sun. I then put the physical sun's multiply at around .125 or a little higher so it's not too strong.

I have copied the BB info from a cube and pasted it into the sun's BB info but I can see the photon's either getting trapped outside the box or still bouncing every where.

I'll have to post some screen shots and maybe a scene with a sphere so you can see what I mean.


07-29-2009, 05:59 PM
don't bother casting photons from your sunlight

if you need them concentrated on a specific model, create a spot light that emits only photons, and focus it on just the area you need.

07-29-2009, 08:08 PM
Or use a portal_light.

07-29-2009, 09:45 PM
So it really doesn't matter if the light generating the photons is a spot/portal/directional? A photon is a photon is a photon? There is nothing magical or inherently special about the Physical Sun shader?

I'll try your suggestions, thanks guys

07-30-2009, 12:15 AM
mental ray can draw the photon intensity from the physical sun if you need a more realistic intensity based on sunlight (use "automatic photon intensity" on the physical_sun node). you don't really need it to come from the sun, though. it's always best for things like caustics to cast the photons from a separate spot light that doesn't do any real illumination (turn off emit specular and diffuse), but just cranks out photons. that way you can focus a large number of photons into a smaller place, and get better results faster.

07-30-2009, 12:29 AM
I've read about this being used for caustics a couple of times. I was just interested in making a car sitting on an open road during the day look real. I'm under the impression that Physical Sun+plus IBL+GI+FG= the fastest and most realistic approach.

Other have said GI for exteriors/landscapes is pointless and to turn the FG bounces up to 4 or so and rely on that.

But then there's this post by Master Zap, whom I'm inclined to believe...


So I'd like to get some GI involved from a physical sun but I'll just use a portal light if there is no difference (other than the physical sun being a nightmare to set up correctly)

Kel Solaar
07-30-2009, 08:09 AM
I think I would go for the the "Photon Only Spot" it's fast and easy to control :)


07-30-2009, 02:07 PM
So I'd like to get some GI involved from a physical sun but I'll just use a portal light if there is no difference (other than the physical sun being a nightmare to set up correctly)

The portal light photon emission will only take into account the environment skylight color and intensity, and not the sunlight itself. Ive had some luck with the physical sun emitting photons, but as stated, it is a pain to set up correctly, so I would recommend the "spotlight casting photons only through the window" approach. It is faster and can look very pretty :buttrock:

07-30-2009, 10:06 PM
OK, time for another round of tinkering with a spot light.

Thanks to everybody!

07-31-2009, 02:42 AM
Other have said GI for exteriors/landscapes is pointless and to turn the FG bounces up to 4 or so and rely on that.

I disagree. Obviously GI is based on photons, this is where people forget it can produce much nicer results than just FG by itself....more natural colours when bouncing around the scene and some nice indirect shadowing are some of the advantages.

in my opinion a combination of FG + GI works best on *both* outdoor scenes and indoor scenes, maybe not true years ago - but now physical sun is a godsend.

It is also extremely fast to shoot photons compared to multiple FG bounces. so you get nicer results for much faster time.

08-05-2009, 12:40 AM
When you are rendering exteriors, do you use GI from the physical sun? If so, how do you set it up so photons aren't being shot into infinity?

I tried again to have a cube become a sort of bounding box but it still doesn't work. Simply entering numbers into the physical suns bounding box parameters doesn't work either, the photons are being shot far beyond the numbers I've entered. I'm including the tiny scene I'm trying to get this to work in...



08-05-2009, 03:16 AM
I do use GI for exteriors but I don't care if they are shot off to infinity.

Even with a scene that has millions of polys it only takes 30 seconds to shoot a million or so photons everywhere. Opening the map into map viz confirms that the photons are evenly spread and reach all the points so I'm not concerned about wasted photons.

I know the bounding box trick but I just tested and you're right it doesn't seem to work anymore (2009spa1).

08-05-2009, 04:32 AM
After tinkering with the spot light for a bit I began to wonder if it would still be better to have the directional emit the photons because they seemed so concentrated with the spot. It sounds like you feel the same way. This is a wierd thing to say but I'm almost glad you couldn't get the bounding box to work either (I'm on 2009 as well) I tried everything I could think of and read but I still never got it to contain the sun's photons. Alas....

Thanks for the reply!

08-05-2009, 04:40 AM
Have shot photons from physical sunlight and has mostly worked fine for me in 8.5 so is this a 2009 specific issue?


07-13-2010, 05:05 PM
I just tested and this (containing photons generated via Phys Sun in a bounding box) appears to be FIXED in Maya 2010. Let's hope it stays that way!

07-13-2010, 09:29 PM
I don't have any problems using a bounding box with MR Sun/Sky in 2009. The actual light's location simply needs to be inside the box. If it's outside, then it doesn't work. But again, I wouldn't go using photons from the sun/sky unless the recipe specifically called for this for some reason... a spotlight gives better results for caustics.

But others saying that their million photons firing off into nothing doesn't affect rendertimes... I don't believe we're talking about the same issue. Even on my fastest workstation, "no photons stored after emitting 10,000" bogs down the GI calc tremendously, and by tremendously, I mean that no matter how fast your CPUs, "zero" is still a speed, and that's how fast it's going until it gets past these "errors".

But I use a sphere (generally) instead of a cube. I'll try to replicate the error you others are having using 2009 and a cube; perhaps the higher-poly sphere just works better?

07-15-2010, 04:55 AM
Hmmmm...yep it seems to be working just fine in 2009 as well. Maybe I moved the light?

Another noob question: I use Mia materials for pretty much everything. It seems like the photons take a long time to calculate and don't even show up once the rendering is completed. I crank up the photon's intensity to 1,000,000 and it STILL doesn't have an effect. Then I attach a mib_photon_basic into the SG of the Mia material and it behaves normally. I thought the mia mats had built-in photonic abilites, no additional shaders are needed...what's up with this?

07-15-2010, 05:33 AM
I don't have any problems like that which I can directly attribute to the mia_material_x... Sure you're hooking it up to your Shading Group properly? I'm pretty sure my method is improper, but it's been working for me professionally for many years, and I am loathe to change it...

To be honest, it really depends on your scene and your lighting setup (in order for me to be helpful). If you can post an example, or perhaps start a new thread specifically about that topic even, then I think you'd get more help.

07-16-2010, 01:07 AM
This is what I mean, the mia_x_passes doesn't seem to be interacting with photons. But once I attach a mib_photon_basic it behaves the way I expect it to. I was under the impression that the mia's had built-in photonic capabilities.

Is this right?

07-16-2010, 03:09 AM
Your workflow is much different than mine, but I see what you're trying to do. It should work, but I noticed your had "Suppress All Maya Shaders" unchecked in your Shading Group. That should be checked.

What I've done for the past five years, which may be "wrong", is when creating a new material I place a new Blinn on it. Then, tweak the shader for viewport purposes until it's where it needs to be. Then, create the mia_material and link it all up in the Shading Group, using "Suppress all Maya Shaders". Also, I connect the file and color nodes from the Blinn shader Perhaps this isn't the proper way to do things, but I often have to switch between Maya Software and mental ray, so this way makes sense... And updating one file node affects both my visual representation and my mia_material_x.

I've never used mia_material_x_passes before though.

Rendering your scene as-provided tossed up the expected "362004: no photons stored after emitting 10000 photons from light "areaLightShape1" (tag 66e)" errors right and left, and rendered a gray sphere with gray background:


You're using an area light which is set to emit photons, but wasn't set to "use light shape" for starters. Result:


The expected result, but there are still no photons connecting with anything (same errors in Output Window, and an empty Map Viz node too). This leads me to believe your light was wonky, so I tried a bunch of crap with the light and received the same error. Some renders were (predictably) affected based on the light changes, but still no photons to be found, although 10K are firing off. I even switched the Area Light to be a Spot Light; same result.

So I thought I'd try my Shading Group method, just to test that aspect of it. That is, select all geo with your mia_material_x_passes, apply new Blinn, apply default mia_material_x in the Material, Shadow, and Photon slots, turn reflectivity to 0 so the _x is more like your _x_passes.

Here's my result with your scene:


GI working now. Rendered almost instantly (4 seconds), and the MapViz appeared even faster. Also, no lost photon errors in the Output Window.

So I swapped your mia_material_x_passes1 shader back into the Shading Group, and came up with the same errors we had previously. My conclusion: mia_material_x_passes1 doesn't work with GI. Like I said, I've never bothered with this shader previously, and either I don't know enough about it to make it work or something else is going on. _x works fine; _x_passes, no photons. I wish I could help more, but perhaps at least we've isolated some things that aren't the issue, such as the light and the render settings you were working with. It's definitely the shader, and after tweaking on it for awhile to see if any in-shader settings helped, I came up with no solution to make _passes work with photons.

So to make a long story even longer, mia_x_passes = no GI, like you said, but mia_x works just fine. Odd, and I wonder why MR made it like that? One guess!

07-16-2010, 03:37 AM
Thanks for making all the screenshots, I appreciate it. I don't think "Use light shape" controls photon activity but with Maya you never know... I guess I should just stick to mia_X and forget about mia_X_passes for a bit...

07-16-2010, 05:13 AM
Yeah, I'm no pro with passes. I'll do an AO pass on occasion, and use alphas and z-depth a lot, but perhaps someone else knows how to make it work with photons. Sounds like you already had a solution in place? mib_Photon or something? Also never used that one, but if it works, I say go for it!

As for the bounding-box light issue, anyone else still having problems with this? I tested it against that scene also, and it worked just fine... Maya 2009 though. Perhaps a newer version has a different workflow.

CGTalk Moderation
07-16-2010, 05:13 AM
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.