Houdini Resources

Updated on June 26  2024



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

 MISSING GIF

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

MISSING IMAGE In Houdini, instanced lights are fun and easy to create! Think fireflies, street lights, lanterns ...

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

MISSING IMAGE
In your light node, after you have the settings you want, turn off Enable

Result

MISSING IMAGE
In the image show, the attenuation for a point light was also adjusted
You can use any light type for instancing, except distant/sun (which would not make sense)

Hipnc here MantraInstancedLightsBasics.hipnc (H19)

Vary Lights

MISSING IMAGE MISSING IMAGEIf you wish to use more than one light type you can define an attribute using an Attribute Create node

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

MISSING IMAGE
A white point lights and a magenta cone light were instanced on a circle with 36 points

Hipnc here MantraInstancedLightsVary.hipnc (H19)


Material Override

MISSING IMAGE You can also override the properties of the lights individually by adding a 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

MISSING IMAGE The results you see below is from changing the lightcolor per point

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.

lightcolor, doattenramp, rampend, coneangle and an expression to "docone"

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

MISSING IMAGE
Hipnc file MantraInstancedLightsColorfulH19.hipnc