Digital Tutors - Introduction to mental ray in Maya 2014

02_Using_the_mental_ray_architectural_material_in_Maya

Mia_material_x - atrributes: roughness controls spread of light. Glosiness controls bluriness of reflections.

Refraction index of glass is about 1.5 and water is 1.3. BRDF controls amount of reflection we are seeing on parts of surface looking directly at us or versus surfaces pointing away from the camera.

The Fresnel Reflection is based on a real world function describing how the more directly we look at a surface the more the reflectivity falls off. Most objects in real world obey fresnel reflection.

03_The_importance_of_object_scale_when_rendering

Scene scale influences light fall off. Light energy decays as it goes through space. Turning on quadratic decay requires a high light intensity.

10:28mins

Distance of light from object will also effect intensity - like real world. Obey real world scale and real world light decay/fall off.

Final gather on/off:

04_Rendering_with_Unified_Sampling_in_Maya

How to reduce noise: change quality of unified sampling under ‘quality’ tab of global render settings. The old legacy sampling attribute would also require an increase in raytrace shadow rays to eliminate noise. ‘Use light shape’ also increases render quality - more important in older versions of Maya.

05_Rendering_with_the_Physical_Sun_and_Sky

Textures become washed out. See sun direction in outliner. Direction of sun influence time of day light - colour and light height. Haze desaturates colour and affects illumination. Red/Blue shift effects warmth/cold. The textures become washed out from the physical sun and sky - this will be fixed next lesson.

06_The_importance_of_color_space_in_3D_rendering

The computer isn’t capable of displaying amount of luminance values that human eye can perceive, so it applies a trick - a gamma response curve of 2.2 (sRGB colour space). Linear colour space is usually for more special file types e.g. Hdr images, 32bit .tif, .exr (32bit images) (gamma 1.0).

Maya displays images in a linear colour space - light is typically blown out and shadows are very dark. When corrected to an sRGB colour space the textures become washed out as they already existed in an sRGB colour space. Remove gamma encoding from textures (to linear) and then correct rendered image to sRGB.

The PS&S auto corrects gamma (adds node to camera). Break connection on lens shader. Reduce PS&S ‘multiplier’ to 0.2.

07_Using_the_Color_Management_tools_in_Maya

Enable colour management under global render settings. We want our textures to exist in same linear colour space as our lighting. Can change in global render settings - open render window>display>colour managment. In global render settings, the output format depends on what extension you want to encode - linear for 32bit and sRGB for e.g. Jpeg.

Under ‘colour profile’ of textures - some may need to be changed.

Colour management only effects normal maps and not procedural textures e.g. Mia_material_x. We need to manually gamma correct these. Plug in a gamma correct (from utilities nodes) into the colour. Use reciprocal of 2.2 to cancel out previous gamma (.45).

Linear workflow rendering strategies is covered more in another course.

Workflow: plug gamma correct node into procedural textures e.g. Mia_material_x and correct by 0.45. Enable colour management under global render settings. Default input is sRGB and output is linear.

08_Rendering_with_Global_Illumination_in_Maya

Global illumination relies on photons to simulate indirect illumination/bounced light and resulting colour bleed. Once GI is turned on in the global render settings, photons need to be turned on in the lights in order for calculations to occur. Photons obey real world physics so scene scale is important in order to simulate real photon energy/intensity behaviour.

‘Exponent’ value describes how long photons retain energy through space. A lower value = longer held. Visualize photons under photon map in order to see if the amount/coverage is enough.

 The quality of global illumination can be changed under global render settings.The quality achievable isn’t great and therefore should be combined with other methods e.g. Final gather. The drawing overrides of walls (that need to be seen through) can be set to ‘bounding box’ and ‘double sided’ can be disabled.

09_Rendering_with_Final_Gather_in_Maya

Points are shot out from the camera. These points shoot out rays which are then bounced back to the point again. This happens at every point.

These rays calculate what the surrounding environment looks like - how much illumination is reaching a surface, how far away is the surface. The points share information with their neighbours in order to simulate a smooth result.

This method doesn’t simulate real world illumination but fakes it. For increasing quality under global render settings - accuracy increases accuracy of light, point density will give more lighting detail on your geometry. Set filter to 2- filter averages lightest and darkest areas to tone down splotchy results.

Rays are shot out at random and therefore each frame can differ causing a flicker in animation. This is covered in another course - rendering flicker free final gather. Mia_material_x has ambient occlusion.

Points that cast out rays and trace that information back. Attributes can be edited simultaneously on >general editors>attribute spread sheet.

10_Using_Final_gather_and_Global_Illumination_together

Global illumination blotchiness can be reduced by increasing amount of photons (by 100,000? Each time) and photon accuracy. Doing this too much will increase render time - therefore combine with other methods for more effectiveness.

11_Rendering_displacement_maps_in_mental_ray

You can generate a high dynamic range .exr file from your zbrush sculpt and set it as a displacement map to add detail to your low resolution mesh in Maya. Zbrush reads displacement maps differently to Maya - black vs 50% grey. Set the alpha offset to x-0.5 of whatever the alpha gain is e.g. Alpha gain is 1, alpha offset is -0.5. Remember, displacement creates geometry/triangles to add detail.

To fix black sharp edges >rendeing editors>mental ray approximation editor>create subdivision approximation. This controls how many times the faces will be subdivided during rendering. Initially this is set at 2 resulting in low detail.

Try the ‘spatial’ approx method. The max sub divisions and max length represent the conditions at which subdivision stops if either conditions are met.  Turning on ‘view dependant’ turns the ‘length’ units into pixels. E.g. 1 = subdivsions 1 pixel length. Therefore zooming out will cause less subdivision. Subdivisions change dynamically as object nears the screen - good for render time.

12_Image-based_lighting_in_mental_ray

Created under the indirect lighting tab - image based lighting uses a hdr image which contains more luminance and colour information than a normal image. Final gathering needs to be enabled. Disable default lights under the common tab.

This hdr is a 32bit image, therefore we need to use linear work flow for gamma correction - Enable color management and tell Maya that this is a linear image that we want to correct back to sRGB colour space. Remember to tell Maya to read procedurally generated textures as a ‘linear sRGB image’ for their colour profile. Remember to gamma correct maya materials by plugging in the gamma correct node from utilities and setting the reciprocal value - .45 (and set value to what the colour was previously). The image can be made brighter by increasing final gather ‘primary diffuse scale’.

13_Rendering_realistic_caustic_patterns_in_mental_ray

Caustics uses photons, the same photons as in GI. Cast caustic photons from a spotlight. We only need photons focused onto a small area of caustic pattern and therefore it would be a waste to cast them out at 360 degrees. Focus the light where you want caustics to be. Remember, caustic photon intensity will need to be increased depending on how far away the object you want to illuminate is - i.e. Scene scale. Increase number of caustic photons to increase detail of caustics. You can turn off spotlight visibility by unchecking emit diffuse and emit specular. The photons still exist even though the spotlight rim isn’t visible.

In mia_material_x we need to change ‘transparent shadow’ to ‘caustic shadow’. The photon intensity will probably need to be adjusted. Remember photons can be visualised with photon map.

14_Subsurface_scattering_materials_in_mental_ray

Misss_fast_skin_maya material. The sub surface scattering layer attributes are based on real world mm values. However, Maya units are probably set to cm. Therefore divide the values by 10 (but not weights). Alternatively, adjust the scale conversion under algorithm control. Set conversion to 10 for cm. Plug a texture/colour map into epidermal colour and diffuse colour.

Plug redder values map into subderma colour.

Plug in a specular weight map for area of higher vs lower specularity. Check alpha is luminence. Reduce weight of primary and secondary highlights if they are too strong.

The flesh will render out very smooth at this point so plug in a bump map to add some scar and wrinkle details for realism. In summary - keep default values and plug in maps.

15_Using_Render_Layers_in_Maya

Select all objects you want included and make a new render layer with selection. For example make layers for colour pass and ambient occlusion pass.

For ambient occlusion: Create a ‘surface shader’. Plug an mib_amb_ocl into the out colour of the surface shader. Right click on material and assign material as an override for the layer. Remember to gamma correct the surface shader. Amb_ocl--->gamm_correct--->shader

For making selectable masks we can make a new render layer eg matt pass, shade everything with a black surface shader and then selectively shade things white depending on what you want to mask.’assign’ material to selection.If you want to turn off eg final gather for a single render layer, right click on final gather in grender settings and select ‘create layer override’. Any attributes can be adjusted this way. You can even output the batch render of different layers as different formats. When naming files in the output settings, we can right click on naming box and select <render layer name>.

16_Multi-pass_rendering_in_mental_ray

Choose what passes you want to set up and then associate them with render layers. There’s an option for upgrading the mia_material_x to the passes version.

Make sure to render out passes as a 32 bit format e.g. open exr or an hdr image. Set default output to linear. This is important for compositing them together later. Turn ambient occlusion on in the indirect lighting tab also. Passes seperate out information that is usually composited together automatically. Eg. Render passes of reflections, direct, indirect, specular, shadows, occlusion shadows.

Compositing in photoshop; use linear dodge to add the indirect and reflection passes on top of the direct pass. Add occlusion shadows with multiply.