INNER CODE UNIT · Python
randomize_lighting
VITA-Group/Diffusion4D · rendering/blender.py:214
def randomize_lighting() -> Dict[str, bpy.types.Object]:
"""Randomizes the lighting in the scene.
Returns:
Dict[str, bpy.types.Object]: Dictionary of the lights in the scene. The keys are
"key_light", "fill_light", "rim_light", and "bottom_light".
"""
# Clear existing lights
bpy.ops.object.select_all(action="DESELECT")
bpy.ops.object.select_by_type(type="LIGHT")
bpy.ops.object.delete()
# Create key light
key_light = _create_light(
name="Key_Light",
light_type="SUN",
location=(0, 0, 0),