Connect advanced materials to an implementation in OSPRay's path tracer
Now, when we see a material name (a nickname really) in vtkProperty we draw by first looking up implementation details for the nickname in a global vtkOSPRayMaterialLibrary singleton. The singleton holds a catalog of implementation details for various nicknames, starting with a material implementation name that refers to a specific OSPRay material class and optionally including tuning parameters and supporting textures.
The material library can load definitions from json files or you can programmatically add definitions to it. You can also call Fire() on it to make it emit a modified signal. Observers can watch that to be notified whenever new definitions are loaded for example.
A sample json file for material definitions is as follows: { "family" : "OSPRay", "version" : "0.0", "materials" : { "Silver" : { "type": "Metal" }, "Copper" : { "type" : "Metal", "doubles" : { "color" : [0.42,0.0], "eta" : [0.42] } }, "BumpMap" : { "type": "OBJMaterial", "textures" : { "map_bump" : "relative/path/to/bumpy.jpg" } } } }
We support actor, block and cell level selection of materials. Block and cell levels come into play when the property's material name is "MultMaterial". When this happens each cell gets a specific material via its value in an indexed (categorical) color map.
To make the tests better I threw progressive rendering into the OSPRay test interactor style. It now serves as an example as well.