-
Notifications
You must be signed in to change notification settings - Fork 3
prman_20.Overrides
Shaders and their parameters can be overridden in several ways. In the case of Effectors (a.k.a. Light Blockers), each has an Enable parameter that can directly control how much effect they will have. Lights and Effectors both have Appearance Overrides that let you control their effect on the appearance(s) you choose. And all our Light, Effector, Shading Component, and some Templates are implemented with a parameter override mechanism built in that lets you alter the values of individual parameters.
Every Light Effector (a.k.a. Light Blocker) has an Enable parameter that directly controls the effect the Effector will have. Its value is a simple 0 to 1 range that determines the percentage of influence it has. It's like a fade control. By connecting the Enable parameter to a spatially varying function, you can alter its effect within the scene beyond what its built-in controls will do on their own.
Every Effector and Light has an Add Appearance Override button. An Appearance Override is like an Enable Parameter, but its effect is limited only to the Appearance (a.k.a. shader) you specify. The Appearance is referred to by its Appearance Name as shown in the Appearance Information area of the Slim Appearance View. Once you've added an Appearance Override and specified its Name, the Override's Enable parameter can be used to adjust the effect the overridden shader will have on that particular Appearance. You can add as many Appearance Overrides as you like, or remove them as needed. Of particular note is that you can use Regular Expression pattern matching in the Appearance Name: the Apperance Name parameter value is actually a pattern that is matched against the shader's Appearance Name. Note that the square-bracket characters, [ and ], must be escaped with \, as in Material_\[0|2\], which will match Material_0 or Material_2. Coupled with a consistent appearance naming and shader attachment convention, this provides you with a powerful system of controlling the effects of Lights and Effectors within the scene.
An Override Coshader is used to override the value of an individual parameter in another shader or template. There are three Override Coshaders: OverrideLight, OverrideSurface, and OverrideEffector. Not surprisingly, OverrideLight allows you to override a parameter in a light shader (or template that's part of a light's shading network). OverrideSurface does the same for surface shaders, and OverrideEffector overrides parameters in Light Blocker coshaders. The parameter is identified by its ParamName. Any shaders or templates with overridable parameters will have the (ParamName) value in parenthesis at the beginning of the parameter's description. If the parameter's description does not have a (ParamName) at the beginning of its description, it is not overridable using this mechanism. The ParamName to override is specified the Override Coshader's Param Name parameter. Its type is selected with the Param Type parameter, and its value is set by the Param Value parameter. The Override Coshaders are extremely powerful and flexible. Not only are they able to alter the value of an individual parameter, but their effect is controlled first through the object(s) they're attached to, and then by a range of pattern matching parameters based on Maya Shape, the Shader appearance name, the individual Template name, and finally the shader category. Any combination of these patterns can be used, including none at all. All specified patterns must match before the Override Coshader will override the parameter. The patterns are based on the same Regular Expression pattern matching as is used in the Appearance Overrides. Note that the square-bracket characters, [ and ], must be escaped with \, as in GCL_\[3|4\], which will match GCL_3 or GCL_4.
The Override Templates allow you to add a float, color, point, vector, or string overridable connection to a parameter of any template or shader. This allows you to make a parameter that isn't specifically overridable into one that can be. They can be found in the Laika Subordinate:Override smart palette. Once you've connected an Override template to a parameter, the value can then be overridden by one of the Override Coshaders.
While not strictly an override mechanism, the Selector templates can give you much of the same control, but through an explicit connection to the parameter. One way of controlling their switching behavior is through a string Primitive Variable (a.k.a. primvar) that's applied directly to the object(s) or sets of objects in the Maya scene. By connecting the primvar's value to the Selector's Choice parameter, and altering the value of the primvar per object, you can control the parameter's value on a per object basis. The string primvar can be accessed through the PrimAttrOpt template. An especially powerful way of controlling the Selector's Choice parameter is through an Override Coshader. This gives you the ability to explicitly specify a set of possible parameter values, but with the Override Coshader's power and flexibility of determining what value is used.