Generating Volumetric Effects using Mental Ray's Parti-Volume Shader
In this tutorial we will be learning how to render volumetric effects using Mental Ray. In particular, wewill be using Mental Ray’s Parti-Volume shader to create volumetric light effects like light fog in our scene, and the Parti-Volume Photon shader for volumetric caustics.
Step 1
The scene we'll be using consists of a simple hallwaywith some windows. We will be rendering the effect of lightfog shining into the hallway, as when seen from inside.
Step 2
To get started. our first goal is to assign some basicmaterials to the scene. We will assign a simplecolored material to the hallway, and a Mental Ray Arch & Designmaterial will serve this purpose.
Step 3
We are now going create a Spotlightthat is going to illuminate the scene. We will be using a spotlightbecause a spotlight can help us direct the photons exactly where wewant to, unlike a Point Light or Directional Light, which emitsphotons in all directions.
We are going to direct the Spotlightso that it points through one of the windows as shown below.
Step 4
We will turn on Ray TracedShadows for this light and we are also going to set the Multiplier to10, to brighten up the scene a bit. We are going to set the light toemit photons for our caustics effect that we will be generatinglater.
To do this, Right Click on the light and go to ObjectProperties > Mental Ray tab and check on the GenerateCaustics option.
Step 5
Next we are going to set some renderingoptions, like changing the renderer to Mental Ray and assigning avolume shader to the scene. To set the renderer to Mental Ray, PressF10 to go to the Rendering Options and then go to the AssignRenderer rollout and change the Production renderer to Mental Ray.
Step 6
Next go to the Renderer tab andscroll down to the Camera Shaders section inside the Camera Effectsrollout, and assign a Parti Volume shader to the Volume slot. Thiswill be the volumetric shader that shades the light's fog effect. Wewill be tweaking the shader a little later.
Step 7
Now Let’s turn on global illuminationfor our scene. We are doing so because our hallway is going to haveonly one light source and if we do not have the light bounce off thewalls, we will have a dark room. To turn on global illumination,press F10 to go to the Render Setup and go to the Indirectillumination tab to Enable Global Illumination.
We are also going to increase thenumber of emitted Caustic and GI Photons to 200000. This way we willhave much more detailed lighting in our setup.
Step 8
Let’s give the scene a quick render to testout our setup so far.
As we can see above, we can definitelysee the light fog, but the effect is too strong. Now is the time totweak the Parti-Volume shader to get our desired effect. Let’s nowtake a look at the various settings in the Parti-Volume shader thatwe can use to our advantage.
We will just take a look at the mostimportant parameters in the shader.
Scatter color: Denotes the colorof the light fog. Keep in mind that the fog color is independent ofthe Spotlight's color. So if you change the color of the spotlight,keep in mind that you need to match it with the Scatter Color. In our case we willleave it at the default white color.
Another important use of thescatter color is that we can use it to control the intensity of the fog byadjusting the whiteness of the color. Since our current setup has avery intense fog effect, we can decrease it to something moremanageable like 0.235.
Extinction: This parametercontrols the intensity of the fog effect. It denotes the amount ofscattering the light undergoes when travelling through theenvironment. Let’s reduce this to something like 0.02 andgive it a quick test render.
r,g1,g2: These three parametersare jointly used to denote the type of scattering that we need. Itdenotes whether we need an isotropic scattering or forward orbackward scattering. This has to deal with whether the particles inthe environment scatter the light to the front of them, behind them, or evenly in all directions. Some preset combinations are shownbelow:
The differencesbetween the scattering types are subtle, but can clearly be seen bycomparing the various scattering modes in the Ram player.
Non Uniform:This parameter can be used to introduce cloudy effects into the light's fog. A value like 1 produces a non-uniform, cloudy shading, while 0 produces a uniform fog effect.
Use this parameter with caution since it candirectly affect rendering times. You might also not want tooverdo the effect (like in the image below), where the parameter is set to 1, justfor exaggeration.
Height: Thisparameter is used for simulating ground fog effects and can beactivated by setting the Mode to Fill Only Below Height. It can be used toshade the light's fog only below a certain height.
Minimum andMaximum Step Distance: This parameter controls the accuracy withwhich the scattering is shaded. Smaller numbers mean more accurateshading at the cost of rendering time, while larger numbers can speedup rendering but can introduce some artifacts. Play with the values until you get the right amount for your setup. A rule of thumb is toset the Minimum Distance to be 10% of the Maximum Distance.
We can also specifywhich lights need to be volumetrically shaded using the Lightsoption. But since our scene has only one light, we will leave it at the defaults.
Up until now wehave seen how we can shade light fog in Mental Ray. Now let’s see howwe can use the same Parti-Volume shader to shade the photons and getvolume caustics.
Creating Volumecaustics effects
To create volumecaustics, we need a particular setup that shades the caustic photonsinto our scene.
The following setupshows how it’s done.
First let's turn onCaustics in the Mental Ray setup by going to the Render Setup dialogby pressing F10 and navigating to the Caustics section in theIndirect Illumination tab. Turn on caustics by checking the Enable box to have causticsgenerated in our scene.
For volume caustics, we need a spotlight that generates photons. These photons pass through the photon collector whichspecifies which photons need to be shaded for the volumetric effects.These to be shaded photons, now pass through the object that generates the caustics and finally get shaded volumetrically. Let’s see how wecan model this setup in 3ds Max.
Step 9
For the photon collector we are goingto use a simple Plane and a Mental Ray material, so that we can customize the material according to our needs.In this case we are going to use it to just shade the photons. Let’ssee how to do that below.
As you can see, I have assigned a Transmat material to the Surface, Shadow and Photoncomponents of the shader. A Transmat shader is nothing more than a dummyshader that tells the main Mental Ray shader to do nothing for thespecified component. So we are not going to render the surface,shadow, nor any photons from the photon collector Plane. It’s justgoing to be a plane that shades the caustics photons that are goingto be generated. And as for the Photon Volume, we assign aParti-Volume Photon shader which is just a Parti-Volume shaderdesigned for photons.
Also make sure thatyou turn Off the shadows for the photon collector Plane, since we donot need it to cast any shadows onto the scene.
Step 10
We are going to usea Raytrace material for the glass Sphere that is going to cast thecaustics. We are going to set it to be completely transparent andgive it some Reflection. The Specular Highlight profile can also bechanged to get a more controlled reflection on the Sphere.
Step 11
Down in the MentalRay Connections for the shader, we are going to assign a DGS MaterialPhoton shader. This gives the Sphere a volume in which the photonscan get refracted and generate the caustics effect.
Also makesure to check the Generate Caustics checkbox for the Plane and theSphere in the Object Properties dialog. Now render the scene. Here Ihave reduced the Scatter Color of the light fog to bring out thecaustics effect.
In the above imagewe can see that the color of the volume caustics is white (same asthe Spotlight's color). But we can change the color of the volumecaustics in a total of two ways.
Change the light color of the Spotlight
Change theScatter Color of the photon volume shader on the photon collector.
Changing the ScatterColor changes the entire caustic simulation's color and hence diffusesthe green color more into the environment. But it does not affect theenvironment color, since the scene is still lit by the white spotlight.
Changing theSpotlight's Color changes the entire color of the scene and also thecaustics effect. But it has a much tighter diffusion of color. Keep inmind that the light fog is still white since it is independent of the Spotlight color, and is instead dependent on the Scatter Color of theParti-Volume shader.
Conclusion
Using the abovesetup we can easily introduce volumetric effects into our scenes toimprove the realism and also give some scenes that wow factor usinglight fog. Hope you guys learned something new from this tutorial. And I hope to see you again in another exciting tutorial!
You must Sign up as a member of Effecthub to view the content.
A PHP Error was encountered
Severity: Notice
Message: Undefined index: HTTP_ACCEPT_LANGUAGE
Filename: helpers/time_helper.php
Line Number: 22
2284 views 1 comments
You must Sign up as a member of Effecthub to join the conversation.