View Full Version : Light Fog.

07 July 2004, 05:44 PM
Hey there, I am making preparations for my next project. Trying to clear out issues before they rise.
One of them is light fog.
Here is the test scene:

What way should I use to get nice light fog from the window to the floor where highligh is happening. If using traditional spotlight and enabling light fog, you get circular light fog cone. If I resize that cone larger than window, weird artifacts start to happen. So I understand the cone border detects where fog should happen, and if it hits mesh it disables fog behind that mesh.
Here is the reference what I like and would like to know how it was made:

Prefferably I would like to render it as separate pass and comp it together later. I am willing to learn but have no idea where to start, any tips or hints are very welcome.
Thank you

07 July 2004, 05:54 PM
well... i think the best way to achieve that result, is mapping your image to the color light slot.

07 July 2004, 06:04 PM
Sry slipknot66 but you are missing my point here. Lets wait if someone else understands what I am trying to do. If noone will answer I'll try to express myself better.

07 July 2004, 08:38 PM
There are many god rays plugins and scripts that can do this in most compositors.

For example, genarts sapphire:
or the foundry tinder

07 July 2004, 09:51 PM
Well I think slipknot66 is right. In the 2nd picture you posted the person mapped the stainglass texture to the colour slot of the light, turned on light fog, probably with a decay rate. Your window is square so you can adjust the barn doors if you are getting artifacts.

07 July 2004, 10:14 PM
That second picture is from MR's feature list page.
Yes I have thought to make those volumetric rays directly in comp but as I got some time, I would like to learn something new.
OK, adding color to the spotlight and enabling light fog. Thats exactly what I've been trying to do since from the beginning. I ran into trouble and was wondering that maybe it is some kind of common mistake.

Anyway, here is the same scene what I gave as a example. But here light fog is enabled and also a fractial is connected to spotlights color. Everything is fine until the cone is smaller than my square window:

But now, once I resize the cone so that it is bigger than my square window:

Thats what's giving me problems. I guess mayas standard light fog is entirely 2D effect, or I am doing something completly wrong.
If you look again now that Mental Ray pic, its all fine there :shrug:
Wonder how that pic is made.

07 July 2004, 11:16 PM
i think i found a solution, check this tutorial, im trying this one too:)

07 July 2004, 01:00 AM
well... here is what i got until now, playing with volume photons etc... now im melting my brain trying to find a way to emmit some colors..:)

07 July 2004, 08:30 AM
Use a 3dFluid as fog, map the color to the light, render in mentalray with raytrace shadows. In my experience, it's faster then using parti shaders.


EDIT: actually, it's even better to model the window, and map the transperancy of the window with the color. See attached example.

07 July 2004, 08:42 AM
You can change the Fog Color by changing the Scatter Color on ur Parti_Volume shader assigned to the Bounding Box if thats what ur trying to do!

07 July 2004, 09:33 AM
Thank guys alot :thumbsup:
slipknot66, I also found this tutorial but for some reason I was thining that altough it seems similar, it is not very good for simple volumetric light.
Anyway, now I got something to start with, thank you guys very much again :)

07 July 2004, 03:15 PM
Hey zylphyr, thank you again for the scene. I think it will work very good for what I need it to do. And depending on the fluid complexity it renders very fast too. :thumbsup:

slipknot66, were you able to attach color to those volumetrics, and could you add abit grain too. Could you tell me what was the rendering time on the last pic. Or if you can make new tests, I would be interested to know.

07 July 2004, 03:21 PM
Hey, I've been playing with volume fog in mental ray recently. I've managed to get the fog too be non-homogenous byt just setting the uniform value of the parti_volume to something other than 0 (the closer to 1, the more the fog billows).
As for colours, you can set the fog colour, but I haven't yet tried to add patters of colour (as if it is coming through a stained glass window).
I will try that tonite though. If I come up with anything, I'll post it here.

07 July 2004, 05:11 PM
ok.. now the light is generating colors, but is passing thru the objects.. i think is something wrong with the shadows, im using raytraced shadows....

the firts image i posted i was using a mentalray spotlight, now im using a maya default light

07 July 2004, 05:48 PM
You are getting photon leaking above the window. You'll need to increase the subdivisions for your wall and or ceiling to fix that. The reason that occurs is due to the GI radius being too large and the photons consider the radius on both sides of the wall instead of being blocked because the photons consider vert information when calculating the accuracy. You can raise the GI accuracy to compensate for that but it will increase your render time of course, or what I tend to do is add more subdivisions in the problamatic areas. That tends to take less of a hit on rendering than increasing the accuracry settings.

07 July 2004, 05:48 PM
That is very weird slipknot66, but what are the rendering times?
Thats what I got with zylphyr's metheod after playing around abit:
It took 5min with P4 2.4, I think it is just going to work fine what I need it for!

07 July 2004, 06:01 PM
well.. thanks Bill, but i know that already.. this is just a test with volume, and to eliminate that with GI you just need to turn on FG and increase the number of rays, as this is just a test im not worrying about GI is an example how FG can help
Nice render Splin, but hey.. now im interested to find a way to resolv this problem with volume photns, i know that using fuids is much more faster than volume, but im not sure if you can achieve the same results with fuids. well im still melting my brain here..loll as soon as i get some results i will post it here:buttrock:

07 July 2004, 06:19 PM
Very cool slipknot66. A little bit grain and a nice smooth falloff and it will be very cool.
I just needed a simple grainy volumetrics to fall from square size window to the floor while still casting nice variety of details from the environments outside. Now I can continue working on it and my mission is complete, thx again zylphyr :thumbsup:
Tho I think after I have resolved other issues with my upcoming project, I will definetly try to play around abit with volumetric scattering.
Waiting with great anticipation with what you are able to come up slipknot66!

07 July 2004, 07:53 PM
Only problem is that the fog appears to be coming in from beyond the edge of the window.

07 July 2004, 09:58 PM
Only problem is that the fog appears to be coming in from beyond the edge of the window.
You mean the rendering from slipknot66?

I were just wondering and going through both ideas in my mind. I like the fast cool looking volumetrics what using fluid container gives. But on the other hand I also really like the nice glow or bloom what FG gives to volumetric scattering. Thats the only minus so far what I've been able to come up with when using fluids.
Really looking forward to those new renderings of yours slipknot66. By the way, would you be so nice slipknot66 and share out that scene you are working on. Would save me lot of headache I guess ;)

07 July 2004, 12:31 AM
well.. here is a new test, but im still melting my brain about how to emmit some color patterns,

ive found a new node inside Mentalray/Maya, but i dont know how to connect that thing with the lights.i think this is the key to emmit some color patterns?!:shrug:

07 July 2004, 02:58 AM
Yes, I was referring to that second to last rendering Slipknot did, sorry should have been more specific.

07 July 2004, 03:17 AM
hey Splin, here is the Maya scene:thumbsup:

just right click and save target as

07 July 2004, 07:56 AM
Just to ask, this isn't rendered using volumetrics is it? It's the final gather that is causing the light rays to render? I've managed to get volumetric fog and volume caustics working, but can't seem to change the colour of the light being shone through the object (i.e. the photons are the same colour going into the volume as leaving it.
I've tried a lot of different things, but can never get the sphere to change the photon colour. I assume it'd be pretty much the same deal as if the sphere were a plane (window) with a colour pattern in it and transparency applied?
Also, I had a scene with a torus, with a ramp mapped to both colour and transparency. Using normal caustics, I get the coloured caustics on the ground. I figured by adding a ray marching box around the scene, I could get the volumetric fog to be coloured too (or at least shown). No joy. Anyone tried this yet?
Nice render Splin, but hey.. now im interested to find a way to resolv this problem with volume photns, i know that using fuids is much more faster than volume, but im not sure if you can achieve the same results with fuids. well im still melting my brain here..loll as soon as i get some results i will post it here:buttrock:

07 July 2004, 08:47 AM
Splin: you're welcome.

I did a quick test with the same setup, only using parti_volum instead of fluid. (see attached) I am avoiding GI & FG, so no photon tracing. The parti_volum feels abit more "real" than fluids, but the render time goes up a notch. The trick here is to attach MR physical lights to your maya lights...


I've attched a test render. as you can see, the sampling needs to upped a bit. Render time around 2 min on a dual Xeon 2.8

07 July 2004, 11:23 AM
hey slipknot,
I was just checking your scene file from post #23. I noticed that you connected the transparency of your texture to the transparency of the phong shader. Instead it should be the the color output that needs to be connected to the phong's transparency. After fixing this your scene rendered just fine.

07 July 2004, 12:56 PM
grafix, what is the rendering time on that pic?

07 July 2004, 01:59 PM
Splin, that pic required 13 min 56 sec on an Athlon XP 2200+ / 512MB RAM.

07 July 2004, 02:01 PM
hey grafix..

damn it was that simple!? and i was melting my brain here:eek: ..loll
thats the problem when you are tired, sometimes the answer is in front of you..loll
thanks grafix

07 July 2004, 01:31 AM
just to post my render version of the scene:twisted:

07 July 2004, 11:38 PM
But dude it looks very good :thumbsup:
Tho rendering time is a killer!

07 July 2004, 10:09 PM
yea.. but i think we need a faster computer,if you stop and think about all the calculations that are behind all this.. geez.. i think its fast?!

07 July 2004, 10:20 PM
Of course it is fast, no doubt about it! But to use it in production..thats under a doubt. It all looks cool, but fluid is so much faster plus so easy to animate if it should be needed. And the quality is very acceptable too imho. Tho need still to investigate last update what zylphyr made, that looked interesting. Had problems with pc last few days...

07 July 2004, 12:42 PM
Hi, i gave it a go and just wanted to learn more about it and how it was connected and also had a play with the lights since i'm struggling with mr. Hope you don't mind me playing with the scene :)

However i came across a problem, i did not want to light link to avoid the problem because i wanted to learn what the problem is and how to fix it. But the light is coming through the walls, i built another poly around the edge of the room to prevent any leaks and i also lowered the gi radius but nothing helped. Here is an example, can anybody help me?

07 July 2004, 12:55 PM
Increase the subdivisions of your walls because photons go off of vert information.

07 July 2004, 06:09 AM
I was curious how you guys are getting the nice colored volumetric streaks. I can get the color on the floor using a spotlight projection and I can get solid colored volumetrics using a MR Physical light and parti-volume. I tried adding the stain glass image to the Physical light color parameter and cranking the color gain up to a million and got a colored volumetric but it's just a mottled mess instead of streaks. The render times are pretty bad so testing is slow going. Any hints for a Maya 5.01 user(unable to load any of the examples posted here since they are obviously Maya 6 based. Thanks.

07 July 2004, 08:07 AM
If you set up a scene as described here: (uses maya 5.0.1)
and then place an object between the light and the camera (ie. so the light passes through the object). Now assign a coloured texture to the object and map the colour of the texture to the transparency of the surface aswell.

This will colour the rays the same colour as the surface is passes through.

Good luck.

07 July 2004, 02:31 PM
Man, I can't believe I was so close but missed the key point of adding the color to the transparency- I never would have thought of that. I know that someone had mentioned something similar but at that point it went completely over my head. :-) I won't get a chance to retry it until tonight but I have no doubts that it will work. THANKS!

07 July 2004, 05:40 PM
Man, I can't believe I was so close but missed the key point of adding the color to the transparency- I never would have thought of that. I know that someone had mentioned something similar but at that point it went completely over my head. :-) I won't get a chance to retry it until tonight but I have no doubts that it will work. THANKS!..loll yea was the same thing with me, the answer was in front of me all the time,sometimes its kinda difficult to see that when you are tired.. loll:thumbsup:

07 July 2004, 11:18 PM
It looks like the answer wasn't as close for me as it was for you- I still can't get it to work. I can get a solid volumetric fog cast from my window(and volumetric shadows from spheres in the light path) but I can't get any color in the fog due to the colored window. In fact, it won't cast the window pattern on the floor so I have to use a separate spotlight to project the image to get that happening. I have the stainglass image file applied to both the color and transparency of the glass so it seems like it should be working. Am I overlooking an obvious render setting? I tried turning on caustics but that didn't do anything to help it. Suggestions? Probably more like where I might be screwing up in my thinking or forgetting to do something obvious. :-)

08 August 2004, 12:16 PM
Hey Craig,

I've created a very simple scene under Maya 5.0 that works for me and that might give you a
hint on what's wrong with your scene...

To improve rendering speed I put in quite large values for the step length in the parti_volume shader. I you want a more detailed response of the colored fog to the light rays, put in values such as 0.05/0.5 for min/max_step_len.

Good luck ! :thumbsup:

08 August 2004, 08:34 PM
Increase the subdivisions of your walls because photons go off of vert information.
I have had that kind of problem before. Now as you BillSpradlin came along, that kind a sounded working solution, at least it makes sense. But I tried it out and whatever I do, photons still seem to come thru the mesh. I went really crazy with subdivisions but it made little or no difference. All that more complex geometry started to slow down rendering, basically not helping. So I placed another plane between the light and my object, that seemed to help but it was still not neccesary. I wonder how is this resolved in vray for example, this problem does not exist there, or if it does then in really small scale.

08 August 2004, 09:21 PM
usually i resolve that problem increasing the number of Rays, FG GI.. dont know it works to me.

08 August 2004, 01:15 AM
usually i resolve that problem increasing the number of Rays, FG GI.. dont know it works to me.
Fine, but in my opinion it is not a good solution for problem like that. Raising GI rays is not good beyond some point where your have reached the optimal lighting condition. And raisig FG rays can bump up rendering times unneccesarly. GI and FG are very dependable from each other, and rendering times change dramaticaly, depending how one is set up according to other.
It just doesnt make sense. :shrug:

08 August 2004, 01:52 AM
If raising the subdivisions of your walls does not work then you'll need to adjust your gi radius and accuracy accordingly. Usually rasing the accuracy a bit and lowering the radius will get rid of that problem. This happens because sometimes the radius of the area being effected by the photons resides on both sides of the wall thus causing the photons to slip "through" both sides. Increasing subdivisions usually works because the photons will consider the vertex locations, but in some cases as stated, it does not fully get rid of the problem.

08 August 2004, 02:09 AM
thx BillSpradlin for your input. So basically it is always good idea to make the walls out of two meshes instead of one if you understand what I mean. The interior mesh and also so called protective mesh what is positioned abit away from the interior mesh, to catch the photons hiting the wall and preventing them to reach interior wall.
Anyway, thank you all ;)

08 August 2004, 02:43 AM
Graphix, thanks for the file!!! I FINALLY found out what the problem was- it was the window(glass) itself(the last thing I would have suspected!). Even though the color looked fine and the color file's was connected to the transparency, it still refused to work(even tried just a checkerboard texture- still bad). I had made the window in a side view using the polygon tool(it was an arch window) and even though the plane itself was offset to fit in the wall opening, the pivot point for it was in the center. I probably should have looked at this a little more closely to see why it worked the way it did but I just made a new window and applied the original glass material- worked fine. Weird. The only thing I can think of is that the volumetric light was using the pivot point of the glass so the major offset of the plane's center caused the volumetrics to miss the actual plane itself. It turned out working VERY nicely in the end, and I did learn a lot in the process, so it wasn't a waste of time. Thanks for everyone's time. This was something that I had wanted to mess with at some point and this turned out to be a good time. :-)


08 August 2004, 12:23 PM
Hi guys, I decided to try rendering this scene too. I'm going to do the volumetrics in a seperate pass though using Fluid Effects hehe. Here's the image without the fog:

Hehe I added in some edging etc and moved the spheres just for fun. I'll explain more tomorrow but right now I gotta go!!


08 August 2004, 03:03 PM
Fun stuff, isn't it? :-) I see a problem with yours though that you may(or may not) be aware of. The pattern being cast by the stain glass window doesn't properly correspond. Notice that the arm with the green sleeve that is reaching up is actually at the bottom of the window but the pattern on the floor has it coming from the top. Obviously I spent too much time playing with this stuff the last few days to even care about such things. LOL.

08 August 2004, 01:28 AM
Ok, the fogged version is here:

I figured I'd better not kill 56kers with another large image in the post.

And yeah, you're right CraigT about the pattern not matching up. I was too lazy to fix it and hoped no-one would notice, hehe.

08 August 2004, 01:50 AM
cool... i liked ..:thumbsup: is this fluids?what was the render time?i think my version of this scene took that longer to render because of the 2 area lights i was using, and of course the volume scatter .. hehe

08 August 2004, 01:56 AM
very cool Jozvex, glad that you could join. It interests me too, what was the render time?
The fog is looking very good, I still belive fluid will smash volumetric scattering guys. It looks same as good and has much more possibilities, plus renders way much faster ;)

08 August 2004, 02:01 AM
well decided to show my little test here too:
just a little test I did, not finished yet, many things need some fixing and tuning, but currently have no time to work on it anymore.
I agree that the whole fog thing looks abit weird right now but some tuning will fix it, just a test.

08 August 2004, 05:02 AM
Noooooo!! I wrote a really long reply but they started backing up the forum after I started posting and so I lost it all! Never mind, it went something like this:

~FlaShBaCk MoDe~

I can't believe no-one asked me how I got the GI looking so good (well, it looks good to me hehe) and with no leaking! :surprised

I wanted someone to ask me so that I could explain how I did it. Well, I'll explain anyway hehe. I didn't use any photons or Final Gather at all! No area lights either, just two spotlights outside the room. The way I got the GI was by using MR Path shaders. I applied Path shaders to every object except for the window glass. Path shaders calculate super accurate GI using straight Monte Carlo sampling. They just shoot enormous amounts of rays into the scene for every pixel and figure out the GI. You can control the number of GI bounces too by using the Reflection raytracing setting in the Render Globals. In my scene I used 7 GI bounces. Any more than 7 didn't make much of a difference. The quality is totally based on the number of rays you send into the scene, which is based on your Sampling settings. With settings of Min 1 Max 1, the scene renders quite fast but looks very grainy. For my scene I used settings of Min 4 Max 4 and you can still see some noise!

Using Path shaders is a great way to get accurate GI, but it's really slow. My scene at 800x600 took 3 and a half hours to render. It shot 524 million rays into the scene!! Not including shadow rays.

The fog I rendered as a seperate pass using Fluid Effects. It only took 35 minutes to render and I probably could have made it render faster. The main reason why I rendered the fog as a seperate pass is because for some reason, Fluid Effects and Path shaders don't work together properly at all. Everything turned out black. I think Fluid Effects don't work too well with secondary rays or something.


08 August 2004, 01:16 PM
did u try it with the "raytraced shadows" for the volume light???

What render do u use


08 August 2004, 04:31 PM
Oh Jozvex, hehe that is so cool. For example I was not open for new ideas, it looked like its all there is what those guys posted earlier. Anyway, its very cool this technique you are talking about, must test it out!
Thank you for sharing, its very very cool. Need to look if that path shader is a mr default shader or not..o well, back to bed first, need to get my health back....
But the render times :hmm:

08 August 2004, 04:35 PM
btw Jozvex, would be very cool if you could share the scene. Is it possible?
I got suddenly very interested about the way you achieved it ;)
Thank you

08 August 2004, 10:56 PM
Splin, yes the Path material is a default Mental Ray shader. I think it's been in Maya ever since 4.5.

Here is my scene file for you!:

I tried to keep everything neat and tidy so it should be easy to figure everything out.


08 August 2004, 03:18 PM
Thanks for the scene Jozvex:thumbsup: i was checking the scene, this path material is cool, but i see no advantage in using this material, as the render time is almost the same as if you were using FG and GI.Well thats just my opinion, all the images i created, using FG and GI, took me 2 and 3 hours to render at 1024x768.So.. i see no advantage in terms of render speed, but was a valuable information, Thanks again Jozvex:thumbsup:

08 August 2004, 09:41 PM
Splin, yes the Path material is a default Mental Ray shader. I think it's been in Maya ever since 4.5.

Here is my scene file for you!:

I tried to keep everything neat and tidy so it should be easy to figure everything out.

Hey Jozvex, thank you very much. Will look into it once I feel better.

08 August 2004, 10:43 PM
No worries guys!! Get better soon Splin!

this path material is cool, but i see no advantage in using this material, as the render time is almost the same as if you were using FG and GI.Well thats just my opinion

And you're basically right! The documentation suggests that it's only really good for checking to see if your FG + GI results are accurate, because the Path shader is gauranteed to give the right result.

However, I think it could be more usefull than that. For example, with sampling settings high enough (probably like 5, 5 haha) it would give you flicker-free animation with accurate GI. So if you seriously just can't get GI and FG looking good it's always a backup. Also, because it's a shader and not just a rendering option for the whole scene like it is in other renderers, you could apply it to only one object that really needs good quality GI etc.

So I think it has some possibilities, just.....slow possibilities.

08 August 2004, 10:48 PM
Did you know that by setting your min and max sampling settings to equal numbers i.e. 1/1 or 4/4 that you turn off mental ray's adaptive sampling? This isn't a good thing to do and will slow your rendering down quite a bit. Also for every 1 time you raise the min sampling each pixel is evaluated 4 times, so a value of 0 for the min is 4, 1 is 8, 2 is 12 and so on. I'm sure you already knew that, but just in case for those that didn't.

08 August 2004, 10:58 PM
Hehe yes I do know that, but seeing as though the sampling directly results in the amount/quality of GI, adaptive sampling would directly apply less quality GI to areas it decides to give less sampling. Plus, the results are SO noisy that MR would probably just apply the maximum amount of sampling over the whole image anyway. Certainly though if I just had one or two objects using the Path shader I would us AS (adaptive sampling).

And I hate to correct you (but I will, haha) but the sampling actually goes:

Min 0 = 1 sample per pixel
Min 1 = 4
Min 2 = 16
Min 3 = 64 samples per pixel

etc etc

08 August 2004, 11:03 PM
I knew it was something like that heh, gotta stop staying up so late =)

08 August 2004, 07:10 AM
ok at last I am well again and can get back to pc full time!
It sucks being sick :s
Anyway, Jozvex thank you again for the scene. It was very educative, nice and clean, had a chance to learn few things. I noticed that you are using native MR materials instead of standard maya materials. Some time ago Lazzarus(if I remember his name correctly) reccomended me to take a deeper look into MR native materials. But for a newcomer they can be a big headache and hard to understand. So, can you reccomend maybe a few good resources where should I begin. MR manual covers them pretty bad, especcialy when it comes to relation with maya.
thx for your time, and oh, a while ago wanted to congratulate you for those kick ass MR tutorials you have on your site. ;)

08 August 2004, 07:39 AM
It's my pleasure for the scene and the tutorials! Hopefully I'll get around to the rest one day hehe. I'm glad you're better.

I wish I could recommend some good info on standard Mental Ray shaders, but there's hardly anything out there really, unless it's for XSI. I only used MR shaders in that scene because the Path material is responsible for the whole effect, and it's a MR shader. Most of the time (especially now in version 6, that has blurry reflections etc on standard Maya shaders) I just use the standard Maya shaders unless I need a specific effect like SSS or something.


08 August 2004, 03:40 AM
ok, thank you alot. I guess I will take a deeper look into those xsi shaders what someone posted some time ago here. Said that they work fine in maya etc. Maybe it was Lazzarus again :p
Said that someone even made a short tutorial about them or something...just curious. Cant recall really, it was quite some time ago.
huh, MR is so deep!

08 August 2004, 10:08 PM
..Most of the time (especially now in version 6, that has blurry reflections etc on standard Maya shaders) I just use the standard Maya shaders unless I need a specific effect like SSS or something...

Hi, I also use now mostly the standart materials (>> I take the "settings from maya" for photons).. but there seems to be a big difference of the photon "affectness" between the maya materials and their mr-equivalents.. I don't even had the time to found out this exactly, but it seems that dgs works much better then the maya materials with many photons. I'm sure that maya_lambert get translated to mr_lambert instead to dgs, but also the mr_lambert works different in a gi+fg setup (I know this 0.318-thing with the maya shaders is now fixed in 6.0 but..) ..actually I had some problems with the maya materials after I used a dgs as "white wall-material" for finetuning an interior scene ..also I would like to know if in XSI or max, a white dgs has also a whole different "1.0 brightness" then a white mr_lambert etc. etc..

did you found out something more about this differences???:shrug:

10 October 2005, 11:51 PM
another cheap way of doing this
(I dont want to be repeating so if someone already said it, then sorry)

SW render
attach the image to your light source color
add fog to the light
pick the fog cone and ope the att editor
under hte cone shape tab
render states
increase the volume sample to 2
render with ray trace

CGTalk Moderation
10 October 2005, 11:51 PM
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.