Gaffer allows scene locations to be organised into sets, and then uses a simple expression language to combine sets for use in light linking, shader assignments and the like. In this short post we’ll discuss a historical limitation of set expressions and present some useful improvements made in Gaffer 0.56.0.0.
Sets are often used to identify specific assets within a scene, as well as objects with particular material properties. The screenshots below show an example of such a setup. There are robotOne
and robotTwo
sets to identify the root locations of each robot asset, and there is a glassMaterial
set to identify all objects which should be shaded as glass.
So, it should be pretty easy to assign a glass shader only to the relevant objects in robotOne
, right? Just chuck down a ShaderAssignment and a SetFilter and you’re done!
Alas no. Our metallic friend isn’t receiving any shading. But why not? The answer lies in the details of the set expression : glassMaterial & robotOne
. It sounds like it should do what we want : select all the things that are in robotOne
and also in glassMaterial
. But there’s a problem. The asset set contains the root location of the asset hierarchy, and the material set contains the leaf locations of some objects. The &
operator works on a location-by-location basis, and no single location is present in both the asset and material set.
Gaffer 0.56.0.0 introduces a new operator, in
. Unlike &
, this is hierarchy-aware, and it picks all objects from one set which are descendants of the objects from another set. So, glassMaterial in robotOne
gives us exactly what we want.
We’ve also added a containing
operator that does the opposite : selects all the locations in one set which are ancestors of locations in another. Hopefully these two operators go a long way towards making set expressions more useful for common lookdev tasks.