.. _bsdf-selectbsdf:

Selector material (:monosp:`selectbsdf`)
----------------------------------------

.. pluginparameters::

 * - indices
   - |texture|
   - A texture of integer indices indicating which underlying BSDF is active as
     a function of space coordinates.
   - |exposed|

 * - (Nested plugin)
   - |bsdf|
   - At least two nested BSDF instances that are selected based on selection
     indices.
   - |exposed|, |differentiable|

This plugin implements a *selector* material, which uses a texture to select
one of an arbitrary number of nested BSDF plugins. The index texture should take
discrete integer values (even if it is internally stored using floating-point
numbers).

The index texture should be initialized carefully when using a ``bitmap``
plugin:

* set the ``raw`` parameter to ``True`` to prevent spectral pre-processing;
* use a ``nearest`` filter type to avoid interpolation between pixels;
* it is more efficient to use a single-channel storage.