Wednesday, September 23, 2009

Session 5: Raytracing


Image by Michael Blackbourn, from 3dRender

Get the class files here.

Raytracing: Reflections and Refractions



● Scanline vs. Raytrace
Raytracing is sending rays into a scene from the camera's POV for each pixel in the frame. These primary rays return the pixel's color. Secondary rays detect reflection, refraction and shadows.


  • If raytraced shadows are turned on, secondary shadow rays are fired from each surface point to each shadow-producing light. If a shadow ray intersects another object before reaching the light, the original pixel is shadowed.
  • If the surface is reflective or refractive, secondary rays are created at the original intersection point. If either ray intersects a secondary reflective or refractive surface, the ray-splitting process is repeated. This continues until the ray depth limit is reached.
  • Set the maximum number of ray-splitting iterations in Render Settings > Maya Software tab > Raytracing Quality
  • The Bias attribute serves as an adjustment for 3D motion blur: increase value to remove artifacts




● Look at refractionBottle.ma

Refractions
  • Refraction Index (set in shader’s attribute editor > Raytrace Options)
  • Refraction Limit- max. number of times a ray can be refracted
  • Light Absorbance - amount of light that is absorbed by transparent objects.
    Higher values = more light absorbed = darker surface


  • Surface Thickness - simulated thickness of a surface that possesses no model thickness
    Below is an image showing a thickness of 100 on the left, 0 on the right.


  • Shadow Attenuation - the brightening of the shadow's core and the darkening of the shadow's edge when the shadow is cast by a semitransparent object.  High attenuation = high-contrast shadows. The image below has a Shadow Attenuation of 0 on the left, 1 on the right.


  • Chromatic Aberration - replicates color shifts in refractions caused by the inability of a lens to equally focus different color wavelengths.




Refraction settings

The Refractive Index influences the direction a refraction ray travels from the original raytrace intersection point. Different materials have different refraction properties.

If you are having trouble with the refraction settings, be sure to change the Refractive Index to a number like 1.5 for glass, 1.3 for water, 2.4 for diamond, and so on. If you try to put that number in the Refraction Limit field (the next one down) it'll pop to a whole number (integer) -- this field is for limiting the number of light bounces through the material.






Index of Refraction:

Vacuum 1.0000
Air 1.0003
Ice 1.309
Water 1.33
Ethyl alcohol 1.36
Glass (fused quartz) 1.46
Glass (crown) 1.52
Sodium chloride (salt) 1.54
Zircon 1.92
Diamond 2.42

Reflection Settings


  • Reflection Limit
  • Reflection Specularity - controls contribution of specular highlights to reflections. Can set to values below 1 to reduce anti-aliasing artifacts in reflections. The image below shows Reflection Specularity set to 0 on the left, 1 on the right.





Reflection Mapping (faked reflections)

  • less computationally expensive, more control over map
  • environment textures
  • file textures
  • can be combined with raytracing (example on far right below)




Many images in this post are from Advanced Maya Texturing and Lighting 2nd Edition by Lee Lanier.


Homework: bottleCollection.ma
 


No comments:

Post a Comment