Hey. When I learn new stuff I take pretty detailed notes to remind myself of what I learned from all the sources I will never be able to find again. I also prepare these notes to teach my co-workers what I have learned so the notes are pretty readable.
As you probably have found out for yourself maya’s documentation of mental ray, is… well … inconsistent. And since CG talk doesn't have a Mental Ray forum (ah hum, cough chough), I'm posting my notes;
They are written as I learn what I am doing so they will have both advanced and rudimentary information. I will be updating them as I learn more. Let me know if anything is unclear or needs more info Email Me.
Enjoy the fruits of my labor you thankless bastards.
Mental Ray Notes For Maya:
Baking Mental Ray Information
Lighting/Shading menu Batch Bake (mental ray)
Bake Shadows and Use Face Normals
What this does is just create a new shading network that has all of the light info copied into the image file. You may need to create a 2d placement node and adjust the mapping
Mental Ray Render Global Menu:
General Notes:For render verbosity, or to get progress reports on your render you need to go into the Render Globals (mental ray) and under translation change from “warning messages” to “progress messages”.
Diagnostics tab
The purpose of this is to get a visual representation of just what Mental Ray is thinking.
Anti-Aliasing Quality Tab
Sampling Quality: This effects not just the antialiasing of an image, but all things that must be calculated to create your render. Mental Ray has the ability to adaptively sample an image to save time on rendering. That is to say that in areas of less detail or contrast the image will be sampled less because Mental Ray Recognizes that the area has little variation and so it will sample it less. In areas of higher detail and contrast Mental Ray recognizes that there needs to be more sampling so it will up the amount of sampling.
The values in the Number of Samples tab control the minimum amount of times and the area of the image that is sampled. So what the values do is define the bracket that Mental Ray can span during the sampling process. If Mental Ray looks at an area and decides it has little contrast (defined by the contrast value*) then it will use the Min sample level. If Mental Ray looks at an area and decides that the area is of high detail and contrast then it will sample at the next higher value and again and again until it get to the Max sample level.
What is Sampling?
Sampling is the process of looking at the scene as the image is drawn during render.
Think of it like taking tiny photographs of a little portion of your scene and then laying the photographs next to each other.
What do the Sampling Values do?
In order to understand sampling values we must understand sampling blocks.
Sampling Blocks are simply the regions that are being sampled. Think of it as the framing of a photograph that is taking the picture of a small region of your scene.
The sampling value defines the size of the region that is sampled. Positive values translate to mean that a single pixel is sampled numerous times. The value that you give Mental Ray will define the amount of samples as the inverse of the given value squared. Negative numbers translate to mean that more than one pixel is sampled with a single sample. This region can range from 256 pixels per sample (-4) to 256 samples per pixel (4).
This expression looks like this: if X is the value that you give Mental ray and Y is the number of samples (remember that negative values for Y will mean a broader frame or multiple pixels)
Y = - X2
So lets say that the value that Mental Ray is using is -2
So X = -2
So enter that into the function: Y = -(-2)2
Y = - (4)
Y = -4 Here the negative value will have the effect of reducing the amount of times a single pixel is sampled below 1. This translates into sampling a block of pixels that is 4X4 pixels. If that didn’t make sense, don’t worry, you’re stupid, but that doesn’t mean you can’t use mental ray because the following is a breakdown of this concept.
The upshot is that your image will be smoother the higher this value is but will take longer to render. You should try to keep the min and max values as low as possible. A good way to find the optimal setting for your scene is to start low, put your min sample at -4 and you max to 0. Shoot a render. If banding occurs in areas that should be smooth gradients you need to increase your min value, just go up until those areas are smooth. Then look at areas that are high in detail and contrast, if you see jagged edges up your max value till they become smooth. (dua)
Contrast Threshold tab
are values that dictate at what level the image is sampled within the bracket of the Min and Max sample levels. This process works by looking at the corners of the sampling block and comparing their color values with that of the surrounding blocks and if the difference between their values exceeds the threshold then the block is sampled at the next level and again and again until either the threshold is satisfied or the sampling reaches the Max sample level.
The higher this value the less likely a resampling is to occur. If you find that your image does not seem to be dividing enough in places of high contrast then lower this value. If your render is taking too long you may be able to cut time by increasing these values.
Shadows:
Raytraced shadows
Simple: This samples the objects and just applies a simple shadow to them, if overlapping shadows are present they will not be differentiated
Sort: This will calculate objects closer to the light source first, overlapping will be considered
Segment: This will calculate volume and particles as well as the sort features
Soft Ray Traced Shadows in Mental Ray:
There are a few ways to soften your raytraced shadows in MR.
Light Radius:
On the light you can specify a light radius, the larger the radius the more falloff you will have in the shadow. If the shadow is grainy you can increase the shadow rays. This does not significantly increase render time and higher values definitely look better, you want to just go to the value that the image looks good at though, don’t go overboard for no reason. Getting values up around 50 will yield some really great results, and by that time you will be looking at render times that near the following option, Area Lights:
Mental Ray Area Lights:
You can also use the mental ray area light option, you will take an immediate render hit when you check this, but your shadows will look pretty good with just the default settings and your object will be illuminated softly. Increase the high samples to loose graininess. You will basically double your render time with area lights and then increasing the samples will be a noticeable increase in render time each time you bump it. You can drop it again by playing with the low samples and the high sample limit. Putting a value of one in the High Sample Limit box will drop your render time a lot, however, putting it to two brings it back up. Dropping your low samples will take a bit more time off your render. I have no fucking clue what this is really about. Go ahead and read the documentation on it, maybe you can understand what the hell they’re talking about, but I read it like 5 times and still don’t get it. What I do get (by shear experimentation) is that if you have refractions in your material and your shadow is being cast back through it then having the low samples down will decrease the detail for the refracted shadow, but not to such a degree that you wouldn’t want to have low-low samples.
Other things about the Area Light. You can choose your shape, but I just use the rectangle. The sphere has a noticeable effect, it seems to tighten your shadows a bit aside from that there’s really no difference between the shapes. You can check visibility on, which in my experience just turns on a big black shape in your scene and you see it in the reflections, No real use there, you would be better off making a fake light box and just putting it behind your light. The main adjustments to be made with this kind of light are done with the size of the light and it's proximity to your illumitated object. You will see things like Cone Angle and penumbra as functional values in this light. You will find that you get a pattern on your objects as a result of shadows cast with an area light, you can loose this by increasing your antialiasing samples and bumping your light samples up. (Specific to maya 8.5, I have found that adaptive sampling will not give you enough samples to rid you of the pattern that you get with arealight shadows. set your antialiasing to custom and play with the values to get rid of the artifacting, curiously I have noticed a drop in render time when I do this and the image looks better.)
You can also use light radius and area lights together, but that’s just sort of making it more complex than it needs to be because you can get the same results with one or the other. Combining them increases render time too.
I've used these both now for a while and really, I think that given the time it takes to get the area lights looking good and the render hit that you get with them that the light radius is really the best solution for soft shadows. However if you want to diffuse your specular highlights and get some nice soft shadows in the same render then the area light is your option.
Reflections and Refractions:
Global Illumination:
GI is all about casting light beams around in your scene to get caustics and other light effects.
Settings for the Light:
Check Emit Photons on
Photon Intensity: The initial energy emitted by the light. The larger this number the more render time, cut render time by decreasing this number. You don’t need to worry about subtle changes here. Depending on your scene you can drop this value to a whole lot. The default is 8000, I have had great results with values around 200.
Exponent: The falloff of the energy emitted by the light, the higher the number the greater the falloff. If you have a low value in photon intensity you will need to reduce this to get enough light casting through your object.
Render Global Settings-
Global Illum Accuracy and Global Illum Radius are smoothing agents for the photons, if you have blotchy light increase these.
Final Gather-
Render Global Settings-
Turn enable default light off, Default light is the Light that is automatically placed in scene when there are no lights present.
The camera background color has an effect on the light absorption in the scene. Turn the bg color up or down to get more ambient light in your scene.
Irradiance: In the material of the object that is illuminating, in the mental ray tab increase irradiance
Final Gather Rays: The more rays you have the smoother the shading will be.
The more rays you have the more time it takes to calculate.
Min Radius: should be 10% of your max radius
Max Radius: Should be 10% the size of the largest item in your scene.
Min and Max settings cut render time. Min and Max radius are filters that tell Maya to bracket the rays in your scene and only calculate the rays in that bracket.
For Spill light, create a light, turn off illuminates by default, but turn on emit photons.
HDR images-
High Dynamic Range Images. These images contain light data that will actually simulate directional light emitted from the position of the hotspots in the image.. This effect will not work with a normal image.
You can create HDR images with a program called HDR Shop, lots of tutorials on this program’s website
Contour Rendering-
Ramp Shader- (makes a good toon shader)
Caustics-
Render Global settings:
Caustic Filter Type to cone will soften the edges of your caustics
Ray tracing and refractions obviously need to be turned on
The refraction number needs to be as high as the number of surfaces that the ray needs to penetrate the max trace depth is apparently whatever the refraction number is plus two.
Light; emit photons has to be on, caustics has to be on
Material Settings: Under the material-mental ray tab there are settings for the photon attributes. Derive from Maya is default. You will want to change these settings. Absorbs is a key feature here
Mentalray Materials
Dielectric materials, getting good reflections and refractions:
I usually create a blinn or phong and quickly get its settings to be the best estimate of what I am going for in Mental Ray, and then use this (phong or blinn's) shader group to plug my Mental Ray shaders in. In this way if you ever render in Maya you will at least have something that resembles your Mental Ray Shader.
Create a blinn and graph it in the hypershade. Under the mental ray tab of a material shading group you will find a custom shaders tab.
Material Shader: This is a box in which you can plug any mental ray shader. This will nullify the attributes of the blinn (or whatever material) as long as your rendering in mental ray.
plug the mr dielectric material into your material shader box you will find some somewhat abstract material attributes in the dielectric material:
Dielectric Material:
Coll: This value is represented as a color, now the hue and saturation of this color tell the material what color it is, but the value tells the material how much light it absorbs or how transparent it is depending on how you want to think of it. So if you shoot a render of your object and it looks black this value is too low. A Good range for a clear object is .9 and above. The closer you get to a value of 1 the more transparent the material is.
Ior stands for index of refraction, which is how much the light is distorted by the material, however this value controls more than that, it is apparently responsible for the size of the specular highlight as well, a higher value intensifies the refraction of the light, but creates a more intense bounce back of unrefracted specular light as well. The higher this value the more light will be distorted. 1 is no distortion, 1.65 is standard glass is so you can probably figure out what your material is from there.
Col_out is inappropriately named because it is in fact the color of the refractions within the object
Ior_out is apparently associated with Col_out, but has no apparent effect on anything that I can see.
phong_coef is how diffused the specular highlight will be.
Photon Shader: This is a shader that works with your lights to project caustic light out from the object.
Under Photonic Materials create a dielectic_material_photon plug this into the SG’s Photon Shader box.
Col is the Hue of the caustic light that will be projected out onto other surfaces from the light source.
Ior stands for index of refraction, which is how much the light is distorted by the material. The higher this value the more diffused the light cast from the object will be.
Col_out is the intensity of the light that is cast from the object
Ior_out is apparently associated with Col_out, but has no apparent effect on anything that I can see.
Displacements:
Approximation Editor Settings:
Presets:
Regular Grid settings just subdivide the whole mesh equally.
Angle Feature only divides the surface where it finds it necessary
You can drop the displacement image into the Mental Ray tab, displacement shader this will sharpen the displacement, however, alpha gain is no longer the value you need to adjust, the color gain is now the node you need to use.
Mental Ray Lights:
Area Lights: to make a light a area light, just make it an area light in the light type, then go down to the Mental Ray tab on your light and click area light on, increase sampling if you have a grainy shadow.
Physical Lights:
This light automatically falls off, It looks great with shiny materials.
under the mental ray tab on a light you will find Light Shader load a physical light in. Change the value for this light in the color channel values.
Volume Rendering
Volume Shader:
In the shading group, connect a volume shader, there are three types
The Particle Volume: Scatter is the color of the cloud, the extinction is Min_step_length should be 10% of the Max_step_length these settings control the accuracy of the light.
Photon Volume Shader:
Put the same type of volume in the photon volume shader that you did in the volume shader,
3rd Party Custom Shaders for Mental Ray
The mix8
Bump Mapping For MR Shaders
There are a few ways to get Bump Maps for Mental Ray: I'll discuss all the ones I have run across, but the easiest one is :
The mix8layer or mix20layer method.
You will have to install one of these shaders, you can find the mix8layer by code goddess Fransica at High End 3d and the mix20layer can be found at www.pixero.com. Although Pixaro claims that the mix20 is the same thing as the mix8* with more inputs I'm not so sure. I have been able to successfuly place transparency in the mix8, and cannot find the appropriate input for transparency in the mix20.
make a maya material create your bump in the ususal way and put this material in the base color box for the mix20layer or mix8layer.
You can also get bump using the bumpCombiner shader, which works similar to the mix layers. I'm not going to go into how to do this because there is a great tutorial on how to use this and so much more to be found here bumpCombiner tutorial
You can create a bump for a mr shader without installing anything new by using this method:
Bumpmapping with custom mental ray nodes is a problem. You have to create a network for them.
Create the following Nodes:
Mib_color_mix (under data conversion)
mib_passthrough_bump_map (under textures)
mib_bump_basis (under textures)
mib_texture_remap (under textures)
mib_texture_vector (under textures)
Make these connections and settings:
Mib_color_mix.outValue into the spec channel of your DGS;
(Color Mix node is essentially the layered texture in maya shading terms.) Values Number of files to 1 and mode to 1. Put this node into the spec of the material.
mib_texture_vector.outValue into mib_passthrough_bump_map.coord;
mib_passthrough_bump_map.outValue to Mib_color_mix.colorBase;
mib_bump_basis.u and.v to mib_passthrough_bump_map.u and .v
Mib_passthrough_bump Mental ray Texture tab, load your image into this node connect it to the color mix node out value to color base. Values; factor will increase the bump.
Subsurface Scatter
The overall color is the color of the surface
The front and back SSS colors are mixed in with the overall color to get the final look
Create a SSS shader, you will need to create a Lightmap shader that corresponds to the shader that you have made, drop the lightmap into the lightmap shader tab under your shading group
In your lightmap or your shader you will have an input for lightmap, hit the texture button, it will automatically create a MR texture, make sure it is plugged into both of these inputs. Make the lightmap writeable, 32 bit, 800x800 is a good size and put a path into image name (make it an absolute path). Sampling is something you will adjust if you find that your sss is grainy, bump up if grainy.
Unscattered Diffuse Layer is the actual surface quality that you are used to in regular shaders. The diffuse weight is how much the diffuse will override the front and back sss settings. 1 will all but hide the sss colors. 0 will remove the diffuse layer all together and just render the sss effect. The Radius is the color bleed across the normals of the surface. SSS Depth Is how deep light penetrates into the surface
Specular Layer
The specular color is the intensity of the highlight, Shinyness is how tight the highlight is, the larger the number the tighter the highlight
SSS attributes. The recommended workflow is to turn the weight for both front and back to 0 then find the front then find the back.
If you find that you have to put huge values in your sss shader bump your scale conversion under algorithm control
To get alphas in you sss turn on your pass custom alpha in your custom entities tab in mental ray render globals.
Creating A bump map on a SSS
Create a 2D or 3D bumpmap utility (maya). And just drop the image or procedural into the bump utility default, pulg bump out normal into normal camera.
SSS Fast Skin
Diffuse Layer Tab
Ambient- same as in maya
Overall Color- This would be your normal skin color
Diffuse Color- You would normally use this for like a dirt map or something. This is a multiplyer for overall color.
*overall and diffuse color could both take your skin texture, one or the other, but not both.
Subsurface Scattering Layer Tab
Epidermal Scatter Layer
Your Radius will be lowest on this compared to all of the other radial settings.
Specularity Tab
Specularity:
The primary speculatity is for a general map, the secondary is for isolated areas of greater specularity.
|
|