Run-Time Code Generation for Materials
Stephan Reiter


Typical material systems are based on a collection of properties that are set on a per-object or per-surface basis usually by evaluation of a description file at run-time. Shading of hit points is then implemented by interpreting these properties. In order to be able to support a large feature set, different code paths need to be created, e.g. for reflection and refraction effects. Conditions for the branches associated with these fragments of functionality need to be evaluated for each shaded ray, which may degrade performance considerably. Material specific optimization opportunities are also missed out by having a generic function for all material configurations. We propose the use of run-time code generation for materials.