Sunday 23 December 2012

Create Underwater lighting - volume in Maya

We will also be covering the creation of caustics. Although i will be using it in the situation of moving open water the process of creating them works in any situation that you require caustics.
for all of the following make sure Interactive Creation is turned off
1. Create a polygon cube and scale it by 300.
2. Name this Cube "photonBoundry". see figure 1.1
figure 1.1

3. Create a Polygon Plane and scale it by 60.
4. Name this Plane "seaBed". see figure 1.2
 figure 1.2

5. Create another Polygon Plane, scale it by 20 and this time translate it by x=10 , y= 17, z=10.
6. Name this Plane "waterSurface". see figure 1.3
figure 1.3

7. Create a Spot Light and rotate it by x=-75, y=50, z=0 and translate by x=15, y=36, z=15.
8. Name this Spotlight "photonEmmitter". see figure 1.4

Part 2 - Water Setup

In this section we will be dealing with setting up the water surface which will provide the medium for which the light will pass through to create the Caustics and volumetric lighting effect. in this section we will just be setting up the surface of the water in a later section we will deal with the "parti_volume" node which does most of the work.
1. Create a new "dielectric_material" by selecting and Right Clicking on the "waterSurface" polygon plane and choosing "Assign New Material" from the menu. You'll find the "dielectric_material" in the Mental Ray nodes in the window that has popped up..
2. Open up the shading group for the "dielectric_material" by clicking on the "go to output connections" button in the attribute editor
3. Click the chequered box next to "Displacement mat." and select the "Ocean" texture from the "2D Textures" Category. the attributes for the texture should now show up.
4. Use the settings as shown in the image below. See figure 2.1
figure 2.1

5. If you want to animate the ocean attribute then Right Click on the "Time" attribute of the ocean and select "Create new expression" and type the following in to the MEL Expression area at the bottom:
ocean1.time = time/2;
Thats it for the water surface.
Part 3 - The Spot Light

In this section we will be looking at how to set up the Spot Light to emit photons and caustic photons. Again these instructions can be used for any situation requiring photon emission. the reason we are using a spot light here is that it offers a very focused beam of light compared to the other lights within maya. This is good as if we were to emit photons in a less focused manner then we would an awful lot of photons which would put unnecessary strain on the rendering and could end up taking forever to complete.
1. The first thing to note for this situation is we will not be using visible light. we will be using only photons that are emitted from the light. Therefore the first thing we need to do is uncheck "Emit Diffuse" and "Emit Specular" in the light attributes. See figure 3.1
2. So that the light covers the area of the "waterSurface" Plane we need to increase the size of the "Cone Angle". if you have followed these instructions correctly you will need to change this value to "74". See figure 3.1
igure 3.1

To confirm that this has worked you can select the light and in the viewport select "Panels > Look Through Selected". the circle that you see is the cone angle. See figure 3.2
figure 3.2

3. Now is time to setup the photon emission. open up the attributes for the light again and open up the "Mental Ray" and scroll down to the "Caustic and Global Illumination" Section.
4. Check the box next to "Emit Photons" and you'll see the section light up. Now set the "Exponent to "1.5". You'll notice that the "Caustic Photons" option is still greyed out. this is not a problem. we just haven't told maya that we want Caustics yet. See figure 3.3
 figure 3.3

5. Open up the Render Options Diologue box and make sure the renderer is set to "Mental Ray" then open up the tab "Indirect Lighting". Open up the "Caustics" Section and check the box next to "Caustics". See figure 3.4
figure 3.4

6. if you now close the attributes for the light and open them again the option for caustic photons will be available. Set this value to 500000. See figure 3.5
 figure 3.5

Thats it for the light.
Part 4 - The "volume" Node

In this section we will be looking at how to set up the "parti_volume" node which over time has become a complicated node to setup. It is this node that makes this tutorial work. although there are differet ways of using the "parti_volume" i have found this setup to be the most dynamic with the use of photonic lights rather than Mental Rays' "Physical Lights"
Setting up the photonBoundry
1. select the photonBoundry Cube and right click and select "Assign New Material". Select "Transmat" from the Mental Ray nodes section.
2. Open up the Shading Group Attrributes by clicking on the "Go to Output Connections" button and open up the "Mental Ray" section.
3. Scroll down to the "Custom Shaders" section and click the chequered box next to the "Volume Shader" attribute. load into there the "volume" found under the "volumetric Materials" section under the Mental Ray nodes. leave the settings for the "parti_volume" alone for now.
Setting up the waterSurface
4. Select the waterSurface plane and open up the attribute editor for it.
5. Select the "dielectric_material1" tab and click the "Go to Output Connections" button .
6. Scroll down to the "Custom Shaders" section and where it says "Volume Shader" type: parti_volume1
7. Now where it says "Phot Volume Shader" click the chequered box and select "parti_volume_photon" from the "Photonic Volumetric Materials" section under the Mental Ray nodes. Again leave the settings alone for the node as we'll set them up later.
Setting up the Camera
1. open up the attributes for the camera by clicking on the "camera Attributes" button in the viewport (it's the second button in on the "mini shelf" in the perspective viewport.) See figure 4.1
figure 4.1

2. Scroll down and open up the "Mental Ray" section.
3. In the "Volume Shader" box type: volume 1
Almost done now!
Setting up the volume nodes
1. open up the hyper shade and select the "volume 1" material that you created earlier and use the following settings. See figure 4.2
figure 4.2

2. Back in the Hypershade open up the "Utilities" tab and open the attributes for the "volume_photon 1" node you created earlier. Use the following settings. See figure 4.3
figure 4.3

Quick note: a few people struggled with the tutorial and it would seem the problems are with he volume and volume_photon setup. when setting the scatter attribute make sure it is a dark grey and not a black colour.

if you want to change the colour of the light coming in then all you need to do is change the "Col" and "Outside Color" of the "dielectric_material1" shader to the colour of your choice. example below.


1 comment:

  1. Please updated the images and the tutorial for a newer version of maya. This was definitely confusing but somewhat easy to follow instructions. More pictures and step by step directions. Or just a video :)

    ReplyDelete