Ok, folks, I finally got around to creating that DGS tutorial I've been promising for ages... So here goes.
For a detailed explanation of what DGS is and what it actually does, you can check out my post "A Full Explanation of DGS Shaders" at the following link:
http://www.highend3d.com/boards/showflat.php?Cat=1,2&Board=MayaMR&Number=158994&page=0&view=collapsed&sb=5&o=0&fpart=
This tutorial post that you are currently reading is meant to be used in conjunction with the "full explination" post (that I have linked above) to obtain a solid understanding of what DGS is and how to use it within Maya.
Before I start, let me just say that I am not in any way shape or form a Mental Ray expert, nor am I an expert on DGS, I have just used DGS quite extensively and have a solid understanding of how it works and how to use it. Thus I am sharing the knowledge I have pilfered from various sources ; )
Anyone with other insights into this area, or even corrections, can feel free to let me know : )
Oh, and as of right now this tutorial has no images associated with it... I know I had said I wanted images to go along with it, and I WILL do so (hopefully shortly), but I figured I have kept all of you waiting far too long and needed to get something up. So this is currently just a text-tutorial ; )
... and like all of my other posts, this WILL be long. Yes, I talk too much.
Right, so, now onto the actual DGS tutorial.
First things first, we need to create an environment variable in order to get access the Custom Mental Ray Shaders (of which DGS is a part).
If you already have this variable set, you can skip down past the next few steps...
Ok, the Environment Variable.
This tutorial is Windows-centric, though it all applies to Mac as well... The only real issue is that I actually don't know how to create an environment variable to access the custom shaders on OS X, but considering that after a 3-or-so-year trek through the hellish Windows world I am moving back to Mac soon, I should probably learn how to do it (in other words, if anyone knows how to access the custom shaders in OS X, please tell me ; )
So, step 1, right click on "My Computer" (or whatever you have it named) and go to properties.
Go to the "Advanced" tab and click on "Environment Variables."
You will see two areas, one for "User Variables" and one for "System Variables."
We want "User Variables."
Click on the "New" button and a separate window will open, with two fields: "Variable Name" and "Variable Value."
Under "Variable Name" type:
MAYA_MRFM_SHOW_CUSTOM_SHADERS
Under "Variable Value" type:
1
Ok, now the Mental Ray Custom Shaders should load when we launch Maya.
They will appear as a separate tab, named "mental ray," in Hypershade, as well as next to "Materials," "Textures," "Lights," and "Utilities" in the Create Render Node window.
For those of you skipping the Environment Variable section, you can start reading again now ; )
There are tons of nice little Mental Ray shaders in there, but for this tutorial we will focus on the dgs_material, dgs_material_photon, and physical_light shaders.
All right, so, first, how to assign a DGS material.
The first step in doing this is the same as assigning any other material: pick a material (lambert, phong, blinn, etc.) and assign it.
(side note: since DGS materials do not affect an OpenGL display, I would recommend using a material that most closely visually resembles what your DGS will look like at render time... i.e. for primarily diffuse materials, use lamberts and for primarily specular/glossy materials, use phongs and blinns. This will not affect how it is rendered AT ALL, but it makes it easier to see what's going on in OpenGL previews.)
Once you have assigned your shader, open the "Attribute Editor" and click on the "Go to Output Connection" button (the little right-facing arrow to the right of the name of your shader and the left of the "Preset" button).
This will switch the "Attribute Editor" to shading group mode. Within this mode, click to expand the "mental ray" section.
There are all sorts of fields in this section. For our purposes, we are concerned only with 3 things:
The "Suppress all Maya shaders" checkbox, the "Material Shader" field, and the "Photon Shader" field.
First, click on the "Suppress all Maya Shaders" button. This makes the renderer ignore all settings within your Maya shader (be it Lambert, Blinn, Phong, whatever) and allows the renderer to use pure Mental Ray shaders (once assigned).
Next, move down to the "Material Shader" field and click on the create texture button (the checkerboard) to the right of the field.
This will open a "Create Render Node" window. The tab all the way on the right of this window is the "mental ray" tab, which our environment variable lets us access.
Find and click on the "Dgs_material" button under the "Materials" section of the "mental ray" tab.
Your attribute editor should now display the settings for your new DGS material. You can obviously change the aptly named "dgs_material1" to whatever you want ; )
Here is where you have control over all of your DGS settings, as outlined in my "full explanation" post. I will go over them again, briefly, here.
The first two settings, Caching and Node State appear in just about all mental ray shaders... they are irrelevant for our purposes... ignore them : P
The first notable setting is Diffuse. This controls the base-color of your object. As stated in my "explanation" post, if you only use the diffuse attribute, your DGS will look a whole lot like a lambert (albeit a physically accurate lambert ; )
Glossy controls blurred reflections, and works in conjunction with the Shiny parameters.
Specular controls mirror (non-blurred) reflections. If Specular or Diffuse is used without any Glossy value, the Shiny parameters are ignored.
Shiny is where the amount of blur (the density of the assumed microfacets, as outlined in my explanation) is controlled.
The HIGHER the setting, the LESS blurry it is. This works similar to the Cosine Power attribute of a phong.
If you have a really high value, like, say, 1000, your Glossy reflection will appear like a Specular reflection. If you have a very low value, like, say, 1 or less, your Glossy reflection will appear like a Diffuse reflection.
Shiny_u and Shiny_v control the amount of blurring along either (or both) the U and V axis of a surface. They work just like regular Shiny, in that the lower the value, the larger the blur.
If either Shiny_u or Shiny_v is set to any value other than 0, regular Shiny is ignored, regardless of what value you have in it.
Use Shiny_u and Shiny_v to get "anisotropic" looks to your shaders. They also work well for a brushed metal look.
Transp controls (simply enough) how transparent your object is. This needs to be set at something less than 1.0 to get reflections on your surface. So, to get a somewhat reflective glass surface, set it to, say, .85, and set your Specular to white. To get frosted glass, do the same using Glossy instead of Specular, and set your Shiny value(s) accordingly.
Ior controls the Index of Refraction of your surface. Though it defaults at 0, 1.0 is the setting used for no refraction, and thus it always needs to be changed to 1 if you want a surface with no refraction.
A list of commonly used Index of Refraction values can be found here:
http://hyperphysics.phy-astr.gsu.edu/hbase/tables/indrf.html
Those are the DGS settings in a nut-shell. For a more detailed look at all of these settings, please refer to my "Full Explanation of DGS Shaders" post. The link, once again, is here:
http://www.highend3d.com/boards/showflat.php?Cat=1,2&Board=MayaMR&Number=158994&page=0&view=collapsed&sb=5&o=0&fpart=
As a side note, to achieve physical correctness it is not recommended for your Diffuse/Glossy/Specular values to exceed a combined value of 1.
So, if you have, say, a red diffuse with, a .9 value, and you want to have a glossy reflection on it to add a slight blurred highlight, the most you can set said glossy value at and retain physical accuracy is .1
Obviously, you can have combined values less than 1 and retain physical accuracy, and you can have them more than 1 if you are not concerned with physical accuracy.
All right, now that we have our DGS_material attatched and set to our liking, we can move on.
Assuming that you have a light in your scene, Mental Ray set as your renderer, and are not using Gi, Caustics, or FG, hit render now...
... and voila! We have nothing. Fantastic, no?
The problem here is that there is an attribute missing from display in the attribute editor.
Mental Ray's DGS shader has an extra attribute not readily available via the Maya interface. This is the "Lights" attribute.
The "Lights" attribute tells the shader what lights to use. It works kinda like Maya's light-linking, in that you can have only specific lights affecting your DGS shader.
The thing is, the "Lights" attribute IS there, we just can't see it in the "Attribute Editor." This is (in my opinion) a SEVERE issue of the Mental Ray for Maya implimentation, which does nothing but slow down your workflow.
To add insult to injury, Mental Ray standalone's DGS "Lights" paramater defaults at a setting of 0, which tells the shader to use all lights in the scene. Mental Ray for Maya's DGS light paramater does not. It defaults at using NO lights. What a pain.
Luckily, there is a way around this.
The easiest way to do so is to open the "Connection Editor".
Select your DGS shader, open the "Connection Editor," and click "Reload Right."
Low and behold, the "Lights" parameter is there.
Now select your light. You actually need the light SHAPE selected.
If you have a light called pointLight1, it would be pointLightShape1.
Probably the easiest way to access this is to select your light, open the "Attribute Editor," then click the "Select" button at the bottom of the "Attribute Editor." This will select the light "shape."
So once that is selected, click "Reload Left."
Scroll down the left side (the light paramaters) until you find various "Mi" paramaters. There are a few of them, namely "Mi Export Mr Light," "Mi Light Shader," and "Mi Photon Emitter."
It really doesn't make too much difference what you use here, since all of them (and other attributes in the light) can connect to the DGS and allow it to be illuminated, but for simplicity's sake and to keep things consistant, I always use "Mi Export Mr Light."
With that highlighted, click on the "Lights" paramater on the right (your DGS) and the light will now be connected to your DGS.
Click render again and you actually see an image.
Good : )
For connecting additional lights, things get slightly trickier (and this is really where things start to slow down, and where having the "Lights" paramater right in the "Attribute Editor" would be pleasant).
You may have noticed that as soon as you connected the light to your DGS shader, the "Lights paramater got an intriguing little [0] next to it.
Thats because it has one light connected to it. If we wanted another light connected to our DGS shader, we would need another "Lights" paramater, this time with a [1] next to it. For a 3rd light, we'd need a "Lights[2]" and so on.
So how does one get extra Lights paramaters?
There are multiple ways.
The first way, using the Hypershade, is far more complex than its worth, but I will explain anyway, since the other way requires the use of a MEL script, and I know there are many people out there who are script-o-phobic : P
Ok, open Hypershade. Click on the "Materials" tab to show all of your materials (including your DGS materials).
Right click the DGS you want to connect to multiple lights and select "Graph Network." Your DGS will now appear in your work area.
Now click on the "Lights" tab.
Locate the second light you want to connect to your DGS at the top of the Hypershade, hold control, and middle-mouse drag it to your DGS node at the bottom of the Hypershade window (Yes, you can also do this with the light on the bottom of the Hypershade window and the materials at the top... either way ; )
If you still have your connection editor open with your DGS loaded into it, you will see that this created a second "Lights" parameter in your DGS node, called "Lights[1]"
You're not out of the woods yet, though.
Ya see, though this DID connect the second light to the DGS, it did not connect it 100% properly.
It will render fine if you are just using, say, a straight point light, but as soon as you try to turn said point light into a Mental Ray area light it will FLIP OUT (yes, "flip out" is a technical term ; )
Why, you may ask?
Well, I am the first person to admit when I don't know something... and in this case, I am pretty much clueless ; )
BUT, I do know how to fix it.
Now that you have a second lights parameter, all you need to do is load the light and the DGS material into the connection editor, as we did with the first light, and connect the "Mi Export Mr Light" to the second "Lights" parameter of the DGS.
All is now well ; )
Now for the much easier way, using a simple MEL script.
When you connect the first light to the first (and at this point, only) "Lights" parameter of your DGS material, and then look in your script editor, you will see a line which will look similar to this:
connectAttr -f pointLightShape1.miExportMrLight dgs_material1.lights[0];
All we need to do is take that and edit it slightly to add more lights. So, if we wanted to add a second light, named pointLight2, to our DGS material, we would type this into our MEL command line:
connectAttr -f pointLightShape2.miExportMrLight dgs_material1.lights[1];
All we did was change the name of the light to the new light, and increased the "lights" value of our DGS by 1.
So, if we wanted to add a third light, named pointLight3, we would type this:
connectAttr -f pointLightShape3.miExportMrLight dgs_material1.lights[2];
If we had a 3 lights named Larry, Moe, and Curly and a DGS material named Shemp, our scripts would look like this:
connectAttr -f LarryShape.miExportMrLight Shemp.lights[0];
connectAttr -f MoeShape.miExportMrLight Shemp.lights[1];
connectAttr -f CurlyShape.miExportMrLight Shemp.lights[2];
We would now have our 3 lights connected to 3 "Lights" attributes of our DGS shader.
Simple, no?
Right, so now if we render, with the lights connected, everything looks as planned.
Everyone give yourselves a big round of applause before we continue ; )
All right, now that we have our lights connected to our DGS shader, we can move on.
If you are planning on using GI, Caustics, and/or FG (and if you're not, why bother using DGS ; ) the next step is to create a DGS_material_photon shader.
Go back to the shading group window of your shader (where we attached the DGS shader in the Attribute Editor) and click on the create texture button next to the "Photon Shader" field.
Once again a "Create Render Node" window will open.
In the "mental ray" tab, scroll down to the "Photonic Materials" section and click on "DGS_material_photon."
Again, your "Attribute Editor" will display DGS settings, however, this time its for your photon material.
All of the settings here work exactly the same way as your standard (non-photonic) DGS shader, with one relatively huge difference:
The DGS_material_photon shader only affects indirect illumination (GI, Caustics, FG), not direct illumination (standard raytracing).
Basically, what it is doing is telling the photons emitted by your light how to behave once they strike your surface.
To achieve the utmost in physical accuracy, your DGS photon shader needs to match the settings of your regular DGS shader.
However, having these two as separate entities can give you greater artistic control. For example, you can have a light strike a non-transparent, diffuse red object and have the photons react as if they were striking/passing through a semi-transparent, refractive, specular blue object.
You'd have a caustic blue effect in the shadow of a red diffuse ball... wacky effects, indeed ; )
But I digress.
Mental Ray standalone defaults at having your DGS photon material match your standard DGS material, unless you tell it to behave otherwise. Mental Ray for Maya, however, does not. It defaults at standard "blank" DGS settings. Yet another implementation issue that slows down workflow. This one, at least, isn't such a huge deal.
Now, unlike the standard DGS material, the DGS photon material does NOT need to be connected to a light. This is because the photon material does not affect direct illumination at all, only indirect illumination (GI/Caustics/FG), and connecting lights only dictates how the direct illumination behaves.
In fact, if you have an object with both a DGS material and a DGS photon material attached to it and do a GI render without connecting your light to your DGS material, you will see the Global Illumination results without any of the direct illumination.
Its an odd thing, to say the least.
Also, Final Gathering is not dependant on having your lights connected, since it also does not work on direct illumination.
Side story: a while ago I was going insane trying to figure out why the shadows from my lights were not being displayed in an FG render using DGS shaders. Once I learned you had to connect the lights to get direct illumination effects (like shadows) I stopped going insane over that and was free to find other, non-DGS related things to go insane about. - End Side story.
But, once again, I digress.
If you do happen to connect your DGS photon materials, though, don't worry. Just know that it won't affect the way your render looks. Its a needless step and adds extra work ; )
Two side notes regarding DGS photon shaders:
- When using GI, Caustics, or FG, it is possible, and in fact recommended, to use DGS photon materials even if you are not using DGS shaders.
You would simply connect the DGS photon material to its appropriate slot without connecting a regular DGS material shader. Be sure to NOT check "Suppress all Maya shaders" if you are doing this, however.
The purpose for this is to allow for significantly more predictable photon behavior. The trick is to adjust the DGS photon settings to as closely match your material shader (phong, blinn, lambert, etc) as possible.
So, if you had, say, a red lambert, you'd attach a DGS photon shader with a red diffuse set, or if you had a 100% reflective chrome blinn, you'd set a DGS photon shader with a white specular. Etc., etc.
Since you don't need to connect the DGS photon material to any lights, adding them to your traditional shaders is not a terribly time consuming step.
- Caustics seem to have issues with DGS photon shaders with a Glossy attribute set, especially a Glossy set with a very low (and thus very blurry) Shiny value.
You will often get error messages of "no photons stored after emitting 10000 photons" when you use a Glossy photon shader. This usually results in incredibly slow renders, and, more often, aborted renders.
This is essentially because a glossy attribute scatters the Caustics photons to such a degree that they never reach the expected "catcher" of the photons. Thus the photons aren't stored.
Because of this I almost always use specular instead of glossy in my photon shaders. While this does decrease the physical accuracy of the render (if you are using a glossy standard DGS), the difference is negligible. Believe me, it saves a lot of hassle trying to tweak photon shader settings to avoid the "no photons stored" messages ; )
All right, so now you know how to create and connect DGS materials and DGS photon materials.
However, if you want to achieve completely physically accurate results, there's still one more thing you need to learn about: physical area lights.
This is where the physical_light node (mentioned towards the beginning of this already insanely-long post ; ) comes into play.
All right, first a brief explanation of what the physical_light node does. Well, in the same vein as DGS, the physical_light node attempts to simulate real light properties, which only really means 2 things:
It has a natural inverse-square falloff
It has no separation between color and intensity
First, the fall off.
Fall off, as many of you probably know, is the rate at which light decays. In the real world, light does not remain at constant intensity as it travels.
Natural light falloff is based on the inverse-square law, which "states that as a light source is moved away from a surface it illuminates, the illumination decreases in an amount inversely proportional to the square of the distance."
(quote taken from http://www.mvpny.com/LightFalloff.html - ignore the fact that this page is for Cinema 4D, the principle behind it is a real-world principle)
Mental Ray's physical light shader ensures correct use of the inverse-square law.
To attach a "physical_light" node, first create a light.
Simple enough : )
Point lights and spot lights are the two types of lights with which the physical_light node will work.
Distance lights are not capable of falloff, since all light rays are parallel and thus don't disperse.
Ambient lights are also not capable of falloff, because ambient lights have neither an origin nor a direction. Also they don't even have a Mental Ray section in their attributes.
Maya's area lights can't use physical lights, because they also don't have a Mental Ray section.
That's ok, though, since Maya's area lights are pointless when using Mental Ray.
Mental Ray's own area lights are far, far superior (I will explain how to make a Mental Ray area light shortly).
All right, so now you have either your point or your spot light.
Select your light and scroll down until you see the "mental ray" section. Expand it and find the "Export Options."
Here you will see three things: a checkbox for "Suppress all Maya shaders," a field for "Light Shader," and a field for "Photon Emitter."
Generally speaking, only two of those things concern you.
First is the "Suppress all Maya shaders" box, which, once checked, suppresses Maya's light shader information (color, intensity, etc) and forces the renderer to look only at the Mental Ray light shader.
The second is "Light Shader," where we are going to attach our physical_light node.
"Photon Emitter" can be ignored since we can turn on photon emission under the "Caustic and Global Illumination" section beneath the "Export Options."
Mental Ray's Photon Emitter shaders simply allow the user to define a very specialized, controlled manner of photon emission, which is often times unnecessary and actually unwanted in physical simulations. As a matter of fact, Mental Ray for Maya does not even include Photon Emitter shaders by default.
Trust me, by and large they aren't necessary.
Right, so moving back to our "Light Shader" field.
Before we do anything, make sure you've checked on the "Suppress all Maya shaders" box to cancel out whatever settings the Maya light may have. Like DGS, the Physical_light will handle all of the light information.
Now click on the add texture button next to the "Light Shader" field.
A "Create Render Node" window will appear (hopefully in the "mental ray" section, if not, then click on the "mental ray" tab). When it does, scroll down to the "Lights" section.
There are four nodes here. Three of them are just the Mental Ray equivalents of directional (infinite), point, and spot lights. The fourth is our "Physical_light" shader. Click on that.
Once you select the Physical_light node, your "Attribute Editor" should automatically switch to display your "Physical_light" settings.
The first thing you may notice is that there is no separate settings for color and intensity. That's because the "Physical_light" node bases its color and intensity off of one value. Well, more specifically, three values (RGB). More on that in a moment.
All right, let me go over the individual attributes of the "Physical_light" node.
The "Caching" and "Node State" options are back... once again, ignore them.
Next is Color, where we define both our color and intensity.
The thing to note here is that since the Physical light uses an inverse-square fall off, your RGB values are pretty much never in the range of 0-1. In fact, values above 100 (often in the 1000s) are quite common.
Its not unheard of (and in fact commonplace) to have, for example, a bluish light with an RGB value of 50 100 2000... or something similar.
These RGB values can be set either via the channel box on the right of your screen or right in the color chooser.
Next is "Cone." Cone essentially acts like the "cone angle" of a Maya spot light. It only applies if the physical light is attached to a spot light.
After that is "Threshold" which is used for optimization of the light. To quote the Mental Ray "bible," Rendering With Mental Ray: "if the illumination is less than threshold, the illumination can be discarded and no shadow rays need to be cast. The default is 0."
To the best of my understanding, this means that if the light intensity falls past your threshold level before striking an object, the light information is discarded, and no shadows are rendered.
This would speed up render times.
I never use it ; )
The default is 0, though, which deactivates the threshold (since intensity falling past 0 would be non-existent, anyway)
Finally, we have "Cos_exp" which is only used if the physical light is attached to an area light. Essentially, it narrows the distribution of light samples along the area of the area light (more on samples later). Once again, I never use it.
The main attribute you will mostly deal with is "Color," which, as stated above, will often have very high values to counteract the inverse-square falloff of the light.
All right, so now that we have our physical light shader connected, we can focus on the other Mental Ray specific attributes of our lights, namely the area light section and the photon emission section.
So, area lights. I have mentioned in this tutorial that Mental Ray's area lights are far better than Maya's own area lights. And That's true : )
You can turn any Maya light into a Mental Ray area light... well, That's not entirely true. Same as the physical light node, only spot lights and point lights can be turned into area lights.
To do this, go back into your light attributes (same display where we connected the Light Shader).
Scroll down to the "Area Light" section. This is where you can turn your light into a Mental Ray area light.
The only thing not greyed out is a check box that says, appropriately enough, "Area Light."
Check that and your light is now an area light, and all the other settings are now un-greyed.
So, before I go any further, I should probably explain what an "Area Light" is for those that are unfamiliar with them.
An area light, like everything else I've been discussing in this tutorial, is a far more "realistic" or "physically accurate" representation of a light source.
Traditional lights (points, spots, etc) originate from an infinitely small point in space, casting light rays out in specific directions.
Area lights are "extended light sources," which is a fancy way of saying light sources with a shape.
So what's the big deal?
Well, traditional lights can't cast soft raytraced shadows. All raytraced shadows from traditional light sources have a hard edge. (Yes, I know shadow maps can produce soft shadows, but since this entire tutorial is based on "physical accuracy," and since everything else in this tutorial is based on raytracing, I won't go into shadow maps ; )
The reason why traditional light sources can only cast hard shadows with raytracing is best explained via a quote from Rendering With Mental Ray:
"Point and spot lights create shadows with hard edges because the light is infinitely small, so a point on an illuminated surface can either 'see' the light or not, so it is either wholly or not at all in shadow."
The book goes on to explain the principle behind area lights:
"In reality, there are no infinitely small light sources, so it is possible that an illuminated point 'sees' only part of the light source while the rest is hidden by some occluding shadow-casting object. This is what causes soft shadows (shadows that have soft edges)."
So, area lights have volume and are thus not infinitely small. They are "areas" which contain an "array of pseudo-randomly spaced lights (only much more efficiently)."
So, once we check the "Area Light" box on our spot or point light, our light is now an area light.
Yay : )
There are five parameters giving us options for our area light.
The first is "Type."
There are five different "types" (or shapes) of area lights in Mental Ray.
These are Rectangle, Disc, Sphere, Cylinder, and User.
The first four are fairly self explanatory (the area light has the shape of either a rectangle, disc, sphere, or cylinder), but the fourth requires some explanation.
Unfortunately, I don't have an explanation ; )
The name "User" implies that the user can create his own shape for an area light... this is an interesting idea, as one could theoretically make an area light from a box, or helix, or lettering, or even a character. Whatever the user wants.
I have never played around with trying to define user-shapes as area lights, however, so I have no idea how one would get that to work.
Rendering With Mental Ray also makes no mention of "User" area lights, though the newest version of the book was written for a slightly outdated version of Mental Ray (3.0). So, the "User" area light might be a new feature in the newest version of Mental Ray (3.2).
Any insight would be welcome : )
All right, moving on, the next attribute is "Sampling."
This controls the quality of your area light, reducing graininess. If set too high, your render times will suffer.
Going back to the "array of pseudo-randomly spaced lights" idea stated earlier, think of increasing the sampling as adding more "lights" into the "area" of your light. The more "lights" casting rays, the cleaner the shadows will be and the slower your renders will go.
The two numbers are for the U and V axis of your area light.
The default, 3 3, usually works all right for me (some slight grain, nothing too bad). 5 5 is probably the highest I'd recommend, though I haven't really done extensive testing with sampling of area lights.
The next attribute is "Low Level." This is where it gets slightly complicated.
If you set a value in the "Low Level" area, Mental Ray will look at the sum of the reflection and refraction trace level. If this level exceeds the "Low Level" value, then the next attribute, "Low Sampling," will override the numbers in the "Sampling" field.
For example, if you have a "Sampling" of 5 5, a "Low Level" value of 3, and a "Low Sampling" value of 2 2, once the combined reflection and refraction rays exceed 3 (say, 2 reflection bounces and 1 refraction), the reflections and refractions of the shadow are sampled at your lower value of 2 2.
This can greatly increase performance.
The default for these attributes are 0 for "Low Level" and "2 2" for "Low Sampling."
O for "Low Level" deactivates it entirely, so if you want this feature to be on, you need to set a value in that field.
The final area light attribute is "Visible." If checked on, your area light is Visible as a solid white (or whatever other color) shape, and thus can be seen in reflections/refractions.
The only problem with this is that when you use the physical light shader for your light, any value you put over the traditional 0-1 will make your area light appear as a solid white... so in the above example of a 50 100 2000 bluish light, the visible area light would look white, even though the light is bluish.
Obviously, since one just about never uses values of 0-1 with one's physical lights, this is a problem.
My solution is to create a "stand-in" object for your area light (flat plane, flat disc, sphere, or cylinder), put it in the same spot as your area light (only slightly smaller or right behind so as to not block the light/photons), give it the appropriate color (preferably using diffuse DGS shaders/photon materials so it retains physical accuracy), and leave the "Visible" parameter of your area light unchecked.
However, if your light color is essentially white, or if you aren't using values above 1 for intensity (i.e. not using physical lights) checking this visible is not a problem.
The visible area light will assume the color of your light, given that your light does not exceed an intensity of 1.
Side Note on area lights: Rendering With Mental Ray suggests that wherever possible you use point lights as area lights, rather than Spot Lights. The explanation is as follows:
"Very soft shadows tend to require large subdivision parameters to reduce graininess. Since a spot light is conceptually a point light with a housing that blocks light except in a certain direction, and since the light-blocking housing is equivalent to an occluding object close to the light (even if no geometry for it exists in the scene), area spot lights generally require much larger subdivision parameters than area point lights. If possible, area spot lights should be avoided and replaced with non-area spot lights or area point lights if possible to improve quality and performance."
All right, the final subject of discussion in this tutorial is photon emission, and how to ensure physical accuracy with your photons.
I already explained that photon shaders are required for physically accurate behavior of photons when striking objects, but there are a couple of key issues with setting up your photon parameters in your light to make sure that they are emitted in a physically accurate manner.
First, how to activate photon emission in your light.
Back in your light's attribute (same place we attached the physical light node and activated the area light) scroll to where it says "Caustics and Global Illumination" (its right under the "Export Options" where we connected the physical light node).
Click on the "Emit Photons" checkbox, and your light is now set to emit photons. We're not done, yet, though.
There are three other parameters under there which need to be addressed.
The first is "Energy." These three values correspond to RGB, and, like the physical light "Color" attribute, control both the color and the intensity of your photons.
For physical accuracy, the "Energy" values need to match the "Color" values in your physical light node. So, using our previous example of a 50 100 2000 physical light, the "Energy" of the photons would also need to be set at 50 100 2000 for physical accuracy.
Next is "Exponent." By default, this is set at 2... and That's a good thing, since 2 is physically accurate.
"Exponent" refers to the intensity fall off of the photons. Since Mental Ray's Global Illumination is designed to be physically accurate, the photons inherently have a falloff, and by default it is physically accurate.
A value of 2, as I said, indicates a natural "inverse-square" falloff. Lower values mean less falloff (the photons retain more energy over longer distances, and the render appears brighter) and higher values increase the falloff (photons loose energy faster over distance, and the render appears darker). A value of 0 deactivates falloff (and is never recommended, as your renders will blow-out).
The "Exponent" parameter is included so that in cases where physical accuracy isn't a main concern (like when you are just going for a "look" to match the art direction in a film or other production) the user has more control over how photons behave.
Side note: Without falloff, light and photons actually appear to GAIN intensity over time in the CG arena. For more information on this, refer to page 206 of Rendering With Mental Ray if you have it (its too much to type here, though if people are curious I could make a separate post transcribing it... hopefully without getting sued for plagiarism ; )
The final parameter in the photon section is "Physical."
Now, you may see this and go "ok, Mr. Physically Accurate over there (That's me) is going to tell us to check that on."
Well, you'd be wrong ; )
The "Physical" checkbox is, for our purposes, completely pointless. When you have a physical light shader connected to your light, and when you have the appropriate exponent set for your photons (2), this check box does nothing.
When you are not using a physical light node and you check the "Physical" box on, however, to the best of my understanding it tries to force a falloff on your Maya light, even if you don't set any falloff yourself. It doesn't work terribly well, to be honest.
As a matter of fact, I can't even find the "Physical" parameter mentioned anywhere in Rendering With Mental Ray, leading me to believe its just a Mental Ray for Maya thing (of course, I might just not be looking hard enough).
Actually, does anyone who uses XSI know if the "Physical" option is available in your photon settings?
Moving on.
There are two more fields in the "Caustics and Global Illumination" section which will remain greyed out until you turn on Caustics or Global Illumination in your Mental Ray Render Globals.
These are the aptly named "Caustic Photons" and "Global Illum Photons."
As you might expect, they controls the number of photons emitted by your light. Generally speaking, you need to emit less caustic photons than GI photons, since caustics tend to be more localized and focused.
All right, I think that is all the information I have to give on DGS and physical correctness.
You should now be able to set up DGS shaders, DGS photon shaders, and Photon Emitting Physical Area Lights.
I realize this post was long and wordy, and I hope I have included everything in here that I wished to say... and I also hope that everyone was able to sit through it ; )
If anyone has any questions whatsoever, feel free to reply or contact me.
Oh, and if anyone wants I can post a step-by-step to creating a simple scene using DGS and physical lights, minus the explanations on what they do. Just ask : )
Have fun DGS-ing! ; )
-Steve