Houdini Python - 02 Basic Light Setup
- Ravi Motwani
- Feb 15, 2024
- 1 min read
Updated: May 8, 2024
In this video we will be making a basic script of light-setup with the help of python in houdini.
Will go to the topics like,
what is node ?
making different types of nodes,
understanding the parameter and way to know them,
changing those parameters values,
use case of functions,
making connections and layout the nodes.
# CODE FOR REFERENCE
###################################
import hou
# creating light function with attributes
def create_houdini_light( light_name, r, g, b, rx, ry, rz, main_subnet, xform):
light main_subnet.createNode('hlight: : 2.0', light_name)
light.parm('light_colorr').set(r)
light.parm('light_colorg').set(g)
light.parm('light_colorb').set(b)
light.parm('rx').set(rx)
light.parm('ry').set(ry)
light.parm('rz').set(rz)
light.parm('light_type').set(7)
light.setInput(0, xform)
object_node = hou.node('/obj')
lightSetup_node = object_node.createNode('subnet', 'lightSetup') xform_node = lightSetup_node.createNode('null', 'main_xform')
# create lights
key_light = create_houdini_light('key', 1.0, 0.65, 0.3, -120, 0, 0, lightSetup_node, xform_node)
fill light = create_houdini_light('fill', 0.25, 0.325, 0.5, -40, 50, 0, lightSetup_node, xform_node)
rim_light = create_houdini_light ('rim', 0.175, 0.5, 0.25, 0, -80, 0, lightSetup_node, xform_node)
LightSetup_node.layoutChildren()
Hope this won't be overkilling.
Thanks!
Comments