Deborah R. Fowler
Houdini Lighting - Mantra and Instanced Lights
Posted Dec 12 2017
Updated Feb 11 2022
You can also instance lights in Redshift
and Karma.

TIP: Remember that with real lights you
have to enable and disable them - instancing is somewhat
different - you will be disabling your instanced light by the
node display flag.
TIP: Use instance containers for your instanced geometry
(not converted geos) when using instanced lights.
Instance container node
Create an instance container and in the Instance tab select
Point Instancing: Full point instancing
Instance Object: /obj/hlight1 (or whatever light you want to instance)
Light node
Result
You can use any light type for instancing, except distant/sun (which would not make sense)
Hipnc here MantraInstancedLightsBasics.hipnc (H19)
Vary Lights
Attribute Name: instance
Value is a String that pattern matches in this case to hlight1 and hlight2
/obj/hlight`round ( fit01 ( rand( $PT ),1 ,2 ) )`
Result
Hipnc here MantraInstancedLightsVary.hipnc (H19)
Material Override
For this to work, go into the shop network and create an ASADlight shader from the tab menu.
Add a material node with Point Attributes to your network in the instance container
(NOTE: In H19.0.383 you will want to use the render only flag - see below)
Vary Types
However, this does not account for the other attributes that are not being used on the light shader.
A few more attribute overrides are required.
Additional Overrides - the material override on the light shader worked robustly in 18.5.532 and previous. In H19 a work around allows you to still use this method. See hipnc below.
The expression for docone is based on which light is being used:
if ( round( fit01( rand($PT), 1 ,2 ) ) == 1, 0, 1 )
The use of the display and render flags resolves the issues seen in H19.
Result
Hipnc file MantraInstancedLightsColorfulH19.hipnc