occlusion_tutorial.pdf

(766 KB) Pobierz
occlusion_tutorial.dvi
Occlusion tutorial
Document version 1.0
April 27th, 2005
189164211.006.png
Copyright Information
Copyright c1986-2005 mental images GmbH, Berlin, Germany.
All rights reserved.
This document is protected under copyright law. The contents of this document may not be
translated, copied or duplicated in any form, in whole or in part, without the express written
permission of mental images GmbH.
The information contained in this document is subject to change without notice. mental images
GmbH and its employees shall not be responsible for incidental or consequential damages
resulting from the use of this material or liable for technical or editorial omissions made
herein.
mental images c , incremental images TM , mental ray c , mental matter c , mental ray Phenomenon
c , mental ray Phenomena TM , Phenomenon TM , Phenomena TM , Phenomenon Creator TM ,
Phenomenon Editor TM , Photon Map TM , mental ray Relay TM Library, Relay TM Library, SPM
c , Shape-By-Shading TM , Internet Rendering Platform TM , iRP TM , Reality TM , RealityServer c ,
RealityPlayer TM , RealityDesigner TM , iray c , imatter c , neuray TM , mental mill TM , MetaSL TM ,
Meta Shading Language TM , Network Rendering Manager TM , and NRM TM are trademarks or,
in some countries, registered trademarks of mental images GmbH, Berlin, Germany.
All other product names mentioned in this document may be trademarks or registered
trademarks of their respective companies and are hereby acknowledged.
189164211.007.png
Table of Contents
1 Occlusion 1
1.1 Intro . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1 Further resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 What is Occlusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Usage of Occlusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 The occlusion shaders set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4.1 Example uses of the occlusion shaders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4.1.1 Ambient (or diuse) occlusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4.1.2 Diuse, environment sampled, occlusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4.1.3 Reective, environment sampled, occlusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.4.1.4 Bent normals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.5 Using mib amb occlusion as a light shader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.6 Ambient Occlusion vs. standard Final Gathering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.6.1 Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
1.7 Ambient Occlusion using Final Gathering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
189164211.008.png
Chapter 1
Occlusion
1.1 Intro
The base shader library from mental images 1 provides a set of utility shaders helpful to gather
and control occlusion information. This document covers the practical usage of such shaders.
Please note that the shaders described in this tutorial require mental ray version 3.4.3 and
newer. The library we document here contains 2 shaders introduced in 3.4.3 mib fg occlusion
and mib bent normal env and an updated version of mib amb occlusion.
1.1.1 Further resources
If you need further information, please refer to the mental ray base shader library
documentation, which is provided in HTML form. This document includes parts of that
documentation, and tries to put its contents more in the usage perspective.
For further information about mental ray refer to its online documentation and to the two
books by Thomas Driemeyer \Rendering with mental ray" and \Programming mental ray" 2
Another useful source of information is http://www.lamrug.org LAmrUG, the Los Angeles
mental ray User Group.
1.2 What is Occlusion
Occlusion is the extent to which the area above a point is covered by other geometry and is
generally used as a simplied method to \simulate" Global Illumination. This is achieved by
1 part of mental ray and present in its OEM integrations
2 both edited by http://www.springer.at SpringerWienNewYork
189164211.009.png 189164211.001.png 189164211.002.png
2
1 Occlusion
tracing a number of \probe rays" inside the hemispherical area above the point and testing to
what extent this region is blocked. Obviously the raytracing algorithm is required to send such
rays. Our implementation is accomplished at the shading level through the mib amb occlusion
shader.
Occlusion through mib amb occlusion
Using this shader is not the only way to get an occlusion eect in mental ray. In fact, the
Final Gathering algorithm can also be used to achieve a similar, though slightly dierent, and
in some senses more \accurate" eect. In mental ray one can also calculate actual Ambient
Occlusion by using the Final Gathering algorithm.
At the end of this document you will nd a table which compares standard Ambient Occlusion
vs. Final Gathering and Ambient Occlusion through Final Gathering.
1.3 Usage of Occlusion
Occlusion does have several uses on the practical side:
Ambient Occlusion The \classic" Ambient Occlusion eect, also called diuse
occlusion, can be used to scale down the contribution of ambient light (which in turn
may come from a diuse environment map shader). For this use, the shader works
well when assigned to the ambient parameter of a material like mib illum lambert.
Ideally, Ambient Occlusion should be used with diuse illumination models such as the
lambertian one.
Ambient Occlusion shading graph
Reective Occlusion A more specic occlusion eect for reective materials simulating
reections with environment maps, allowing the shader to scale down the contribution
189164211.003.png 189164211.004.png 189164211.005.png
Zgłoś jeśli naruszono regulamin