Light filters are arbitrary shaders that can modify, or filter, the incoming illumination from a given light. Light filters are just regular shaders attached to a light's "filters" parameter. Compared to an old-style RenderMan light shader, the only thing that an Arnold light filter cannot do is modify the light-emitting geometry and its associated sampling.
image { name myimage filename polkadots.jpg } gobo { name mygobo slidemap mytexture rotate 30 scale_s 2 scale_t 2 } spot_light { name myspot ... filters mygobo # you can also attach a stack of filters: # filters 3 1 NODE gobo1 gobo2 gobo3 }
But you can also write your own light filter. Basically you can use some shaderglobals inputs (such as the light direction sg->Ld,
the distance sg->Ldist
, or, for a spot light, sg->u/v
) and overwrite the unoccluded light intensity sg->Liu
in-place. Below is a simple example that modulates the light intensity with a Perlin noise procedural texture:
#include <ai.h> #include <strings.h> AI_SHADER_NODE_EXPORT_METHODS(SimpleLightFilterMethods); node_parameters { } node_initialize { } node_update { } node_finish { } shader_evaluate { AtPoint2 p = {sg->u, sg->v}; sg->Liu *= (AiPerlin2(p * 50) + 0.5f); } node_loader { if (i > 0) return false; node->methods = SimpleLightFilterMethods; node->output_type = AI_TYPE_RGB; node->name = "simple_light_filter"; node->node_type = AI_NODE_SHADER; strcpy(node->version, AI_VERSION); return true; }
The above example produces the following image:
![]() |
![]() |
Without simple light filter
|
With simple light filter
|