So far, all of our mental ray API library functions have come from the library declared in the header file shader.h, like the illumination model functions in Chapter 12 to calculate the specular component—mi_phong_specular, mi_blinn_specular, and friends. Shaders can also call functions in mental ray’s
geometry shader API
, declared in geoshader.h. These functions mirror the language of the mi scene file, and can be used to define
that create geometric data. Like displacement shaders, the role of the geometry shader isn’t to “shade.” Geometry shaders add elements to the geometric component of the scene database constructed by mental ray before the actual rendering begins. Some objects lend themselves to procedural construction, either because they are based on pre-existing data (CAD data that is translated into mental ray’s object representation) or because they use quasi-random techniques to model natural phenomena, like plants and trees.