Volumetric Lighting (light rays, god rays, light scatter)


#1

Been trying to figure this out in maya for some time. I’ve tried fog but the light still passes through objects. What am I missing?
Most of the tutorials I’ve been finding just skip over steps and don’t really explain how to properly set this up.

THE PIC: The top two images are from another 3d program. I simply select “volumetric” in the display options and the light works well.
The bottom two are from maya. Obviously not what I’m looking for. I tried mapping a water caustics pic to the light color… it gives me “rays” but not very good quality and light still escapes through the object walls rather than just the holes.

Something that works in Mental Ray is prefered but for now im just trying to wrap my head around the basic setup.
Any help with this would be greatly appreciated! :slight_smile:

Thanks.


#2

ooooo The Ant Farm… I had a friend who worked there. Hiring? :smiley:

heres a tut i made a while back on volume lighting.
http://rapidshare.com/files/252129207/volume.avi

Hope it helps

Cheers


#3

This is a constantly difficult question, as over the years the workflow involved has changed a bit…

But the concept is:

  1. Enclose your scene in a cube or similar, simple poly shape.
  2. Fill this cube or shape with a parti_volume shader, which is “Participating Media Volume Shader”, in the long form.
  3. Attach lights and a physical light shader to the volume’s shape.
  4. Tweak for about two hours until it starts to look right.

I imagine after a few tries Step 4 would grow lower and lower, but it’s always a pain to do volumes in MR. The benefits though are that they look amazing, and combined with GI and caustics are very accurate.

The reason for Step 1 is that containing the calculations make them work faster; mental ray’s volume mathematics don’t have to work with infinite space, and therefore the math is much simpler and quicker to render. Most other software packages like you posted have built-in limiters that limit the math, but the negative to that approach is that you can’t surpass those limitations. MR starts with none and lets you build your own limits to suit a particular scene, which is (among other reasons) why it’s so complex to do volumetrics with mental ray.


#4

yes, definetely use parti_volume shader

…I wouldn say it takes two or more hours to finetune it is just really a physically correct volumetrics so its heavily dependent on light intensity (recommended quadratic fallof or even physical light shader) and scene units.

If you are aware of this and know that your scene is in correct scale its a matter of seconds to pull out great volumetrics in your scene!

try search forum for “parti_volume” you will get tons of threads with tips how to use it…

Cheers!

L.


#5

The volume light with fog only works with the Maya Software renderer as far as I’m concerned. It also doesn’t work with raytrace shadows, so you have to use shadow maps.

It’s also very slow. I would set up a separate pass with this effect, or you can use the parti volume in Mental Ray.

Here is a scene.


#6

does it works with fluids?


#7

Thanks everyone for the help. I finally got it to work :slight_smile:

@nfrancisj Thanks for the vid! & unfortunately they just laid a bunch of people off. :confused:


#8

We’ve got a tutorial for this at our wiki site:

http://cgnotebook.com/wiki/Mental_ray_volumetric_shadows_with_parti_volume_in_Maya

very important: remember to check “auto volume” in mental ray render features.

info on how to tweak the parti volume node here:

http://cgnotebook.com/wiki/Mental_ray_for_Maya_parti_volume

Enjoy! :buttrock:


#9

Thanks guys, this thread just helped me a lot. I’m trying out volume lighting for the first time in mental ray and Maya having come from 8 years of 3dsmax. I didn’t think it would be so complicated to setup.

Just a quick question. What would be the best type of node in Hypershade to connect to the Spotlights colour channel for an underwater effect of animated volume light rays? Do you have to use the Caustics option in mental ray? Or can you do without it? I’m in Maya 2008

In 3ds max I would just load an animated noise procedural texture into the lights colour and it would render quickly enough.


#10

here you can find the same question, and the solution

http://forums.cgsociety.org/showthread.php?f=87&t=819636


#11

Thanks, thats what I was looking for.


#12

hey NarfNarf -

it doesn’t necessarily need to be very difficult, there’s also the maya software approach using volume primitives and dmap shadows:

http://cgnotebook.com/wiki/Volumetric_Shadows_in_a_Maya_Software_Render

i’ve just updated this article to include a how-to for underwater light rays (scroll to the bottom), it’s a setup i use a lot and i find it looks awesome.

there’s a link to a scene you can download too, which should make it pretty much drag and drop for you if you choose to go the easy route!

hope this helps, stay awesome
:thumbsup:


#13

but if i’m not wrong these method doesn’t work with raytrace shadows, like for example a sun & sky


#14

spot on tostao_wayne - if you need raytraced shadows in your volume you’ll need to use the parti_volume approach :wink:


#15

Ok, I followed the video tutorial exactly to the point where he renders for the first time and some white volume light appears. In my scene I get just the two spheres, no volume light.

http://rapidshare.com/files/252129207/volume.avi

Then I took a look at this tutorial and the difference is he creates a Lambert node first and then applies the Transmat and Parti_Volume to that, then assigns it to the cube. I tried that and it worked perfectly. (in the video he just assigns the Transmat to the cube, no lambert involved)

http://cgnotebook.com/wiki/Mental_ray_volumetric_shadows_with_parti_volume_in_Maya

…then I went back to the video tut to where an MR physical light is connected to the Spotlights Custome shader> Light Shader channel. I did that and it worked. So then I turned on Emit photons for the Spotlight and enabled GI in render globals, I created a transmat photon node and connected it to the Shader groups Photon shader too and then rendered, it looked good.

In the video tutorial he then changes the colour of the physical light which is connected to the Spotlights light shader, to blue and the value to 4, and his render result is a blue volume light. I tried the exact same and my render is just black. Nothing comes out?!? :shrug:

What am I doing wrong?

Thanks in advance.


#16

is your cube etc the same scale as his? try turning your intensity up to 40, 400, 4000 etc and see if it makes a difference- this is where these things most commonly go wrong. if not you’ll need to look somewhere else- could be a lot of things! let us know :slight_smile:


#17

ok I’ll check the scale of my scene. Sounds like that may be the problem. thanks


#18

Just a quick question.

If I want this volume light to work with Mental Ray GI, should I connect the “transmat_photon” to Custom Shaders> Photon Shader, and transmat to the Lamberts Shader Group> material and shadow shader. Then also connect “parti_volume” to Volume Shader?

Or does the “Transmat_photon” connection remove the need for the “Parti_volume” connection to make this render in GI?

I’m assuming that I need “parti_volume” connected too. I’ll do a test render now.


#19

Ok, just as I was putting together the screen grabs for my next question I noticed a value that made a BIG difference, and I solved my Black render problem. So I might as well post my error and solution because I think it will be fairly common for everyone else approaching Volume Lighting effects in Mental Ray and Maya for the first time. I’ll explain it in the last image.

First, here’s my Volume light setup for use with Mental Ray and Global Illumination.

Second, here’s my Spotlight and Physical light connections

Thirdly, here’s my physical light colour values. Notice the V value is at 1000!

Fourth, here’s my render from all of those settings.

Fifth, here’s the important part. When I tried to change the colour of my phyical light to blue. I didn’t notice that when you do that and try to make the colour in the top left of the window also blue, your V value suddenly changes from 1000 to 0.74 or something tiny. So move your cursor and click anywhere in the spectrum, and down’t worry about the colour swatch in the top left. Once it says V = 1000, it will work.

Here’s the final blue Volume light render.

I can stop banging my head of the wall now.

Thanks to all for the advice. :beer:


#20

While the MR parti volume approach has been discussed here, you CAN use the lightfog from the maya lights and mental ray, with raytrace shadows OR DMap shadows. They work fine in 2009, however I can’t get this particular approach to work in 2010. Has anyone figured it out?