Light

DazLight

class dazpy.DazLight(client, identifier)[source]

Bases: DazNode

Proxy for a DzLight node.

Extends DazNode with light-specific properties.

property intensity: float | None

Light intensity / brightness (read/write).

property color: dict | None

Diffuse colour as {"r", "g", "b"} (0–255 range, read-only).

Use set_color() to change.

set_color(r, g, b)[source]

Set the diffuse colour.

Parameters:
  • r (float) – Red component (0–255).

  • g (float) – Green component (0–255).

  • b (float) – Blue component (0–255).

property shadow_type: str | None

Shadow rendering mode string (read-only).

property illumination: str | None

Illumination type string (read-only).

is_on()[source]

Return True if this light is currently active.

is_directional()[source]

Return True if this is a directional (infinite) light.

is_area_light()[source]

Return True if this is an area (surface) light.

direction()[source]

Return the world-space direction vector {"x", "y", "z"}.

Returns None when the light is not directional.

dazpy.lighting

Domain-level lighting rigs, built on DazLight and DazRenderSettings.

class dazpy.ThreePointLightSetup(target, key=LightSpec(role='key', azimuth_deg=45.0, elevation_deg=30.0, distance=150.0, intensity=100.0, color=(255, 255, 255), position=None), fill=LightSpec(role='fill', azimuth_deg=-45.0, elevation_deg=15.0, distance=150.0, intensity=50.0, color=(255, 255, 255), position=None), rim=LightSpec(role='rim', azimuth_deg=180.0, elevation_deg=45.0, distance=150.0, intensity=75.0, color=(255, 255, 255), position=None), light_type='spot')[source]

Bases: object

Input spec for a three-point light rig.

Parameters:
  • target (Vec3 | DazNode) – The point to light, as a Vec3 world position or a DazNode (its position is used).

  • key (LightSpec) – Key light placement/output. Defaults to a 45deg/30deg key light.

  • fill (LightSpec) – Fill light placement/output. Defaults to a -45deg/15deg fill light.

  • rim (LightSpec) – Rim light placement/output. Defaults to a 180deg/45deg rim light.

  • light_type (str) – Forwarded to create_light() for all three lights — one of "spot", "point", "distant".

target: Vec3 | DazNode
key: LightSpec = LightSpec(role='key', azimuth_deg=45.0, elevation_deg=30.0, distance=150.0, intensity=100.0, color=(255, 255, 255), position=None)
fill: LightSpec = LightSpec(role='fill', azimuth_deg=-45.0, elevation_deg=15.0, distance=150.0, intensity=50.0, color=(255, 255, 255), position=None)
rim: LightSpec = LightSpec(role='rim', azimuth_deg=180.0, elevation_deg=45.0, distance=150.0, intensity=75.0, color=(255, 255, 255), position=None)
light_type: str = 'spot'
dazpy.apply_three_point_light_setup(scene, setup)[source]

Create and place a key/fill/rim light rig around setup.target.

Parameters:
Returns:

A ThreePointLightRig with handles to the three created lights.

Return type:

ThreePointLightRig

class dazpy.HDRIEnvironment(image_path, intensity=1.0, rotation_deg=0.0, mode='dome_only', draw_dome=False, resolution=None)[source]

Bases: object

Image-based (HDRI/dome) lighting configuration.

Parameters:
  • image_path (str) – Absolute path to an HDRI/environment map on disk. Must exist – validated by apply_hdri_environment() before any DazScript call is made.

  • intensity (float) – Passed to the Iray “Environment Intensity” property.

  • rotation_deg (float) – Passed to the Iray “Dome Rotation” property.

  • mode (str) – One of "dome_only", "dome_and_scene", "scene_only". Maps to the DazScript “Environment Mode” enum. Procedural Sun-Sky mode is intentionally not exposed here.

  • draw_dome (bool) – Whether the dome image is visible as a backdrop in the viewport/render (Iray “Draw Dome”), independent of whether it lights the scene.

  • resolution (int | None) – Iray “Environment Lighting Resolution” (IBL sampling quality). None leaves DAZ Studio’s current value untouched.

image_path: str
intensity: float = 1.0
rotation_deg: float = 0.0
mode: str = 'dome_only'
draw_dome: bool = False
resolution: int | None = None
dazpy.apply_hdri_environment(render_settings, env)[source]

Apply image-based (HDRI/dome) lighting via render_settings.

Parameters:
Raises:
  • FileNotFoundError – If env.image_path does not exist on disk. Checked before any DazScript call is made – an invalid path passed to the underlying setMap() call can hang or crash DAZ Studio via a blocking file-not-found dialog.

  • ValueError – If env.mode is not one of "dome_only", "dome_and_scene", "scene_only".

  • RenderError – If a post-apply readback of “Environment Intensity” doesn’t match env.intensity. All of this module’s environment writes go through DazRenderSettings._environment_holder(), which assumes getRenderElementObjects()[3] is always the Environment property holder – confirmed on one live DAZ Studio 4.x instance only. If that index is wrong on a different DAZ Studio version, every write above silently no-ops (matching the existing if (!holder) return; pattern) with no exception, so this readback is what actually catches it.