Volumetric lighting....

   4263   5   2
User Avatar
Member
4 posts
Joined: July 2005
Offline
I have a question about volumetric lighting. Im creating a scene in which I want to have one light being affected by volumetrics. Its an interior scene with a window and some blinds in front of that window. I want the light to come through the blinds (be affected by the blinds) and cast a somewhat foggy atmosphere. I tried using the Atmosphere node but it seems to apply it to every light in my scene…any help and suggestions would be great! thanks!
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
I just uploaded a modified VEX Lit Fog shader to the Side Effects Exchange.

http://www.sidefx.com/exchange/info.php?fileid=189&versionid=189

Loading in this .otl file will override any lit fog shops currently in your hip file. The existing values won't change but a new one will be added: Light Mask. Just specify the lights that you want to be lit in here and away you go.


Technical Info:
The illuminance() loop in the fog context has the following interface:

illuminance (P, , , )

Unfortunately the default litfog VEX shader does not have the last parameter light_mask defined.
If you are handy in vex, you could add a string parameter called lightmask and replace the function in the VEX Code:

illuminance(PP, {0, 0, 1}, M_PI)
with
illuminance(PP, {0, 0, 1}, M_PI, “lightmask”, lightmask)

See the uploaded version on the exchange for the actual implementation.
There's at least one school like the old school!
User Avatar
Member
325 posts
Joined: July 2005
Offline
Wow! Great job, man! I should check out you code.
I liked the Mustang
User Avatar
Member
4 posts
Joined: July 2005
Offline
ok…i loaded up the file that you gave me and in the Light Mask parameters sections i chose the light that I wanted. But when I rendered nothing happened. Im not too sure what im doing wrong at all. I just need the fog attached to one light Thanks so much for your help!!
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
It shouldn't matter wether you just type the name of the light in the field or it is the full path and the light name so I am confident you have the right light in the mask field.

Now this is a ray marching shader so it could be that your stepsize is too small or large for your scene. It is designed to work by default on a scene that is say 10 x 10 units in size. If you multiply the stepsize by the number of steps and the value isn't close in approximating the distance from your camera to the farthest effect of your lights, then you will not see fog. Adjust the stepsize to suit the scene.

It could be that the default fog density is too low for your scene. I believe it defaults to 0.01. If in doubt, always crank all the vaues to their max, then render. You may want to boost the color of the fog as well. Try 1, then 2 then 10 untill you see something.

In mplay, there is a handy feature that I always use when I see nothing in the render output, just to be sure. There is a button in the bottom button strip on the right hand side called Adapt to Full Range. Pressing this button will map the current image values' min and max range and scale all the pixels to map that min and max value to 0 to 1. To reset mplay, just hit R while the cursor is over the mplay image. shift-R is the shortcut for Adapt To Full Range.
There's at least one school like the old school!
User Avatar
Member
7025 posts
Joined: July 2005
Offline
Incidentally, you can speed up the Lit Fog shader a lot by putting in a Metamarch call then using metaballs to define the area you want the fog in.

I got something like a 10x speedup using the above, though depends on your scene. I'll see if I can add it to Jeff's modified Lit Fog sometime )

Cheers,

Peter B
  • Quick Links