fiftyone.core.threed.lights#

Lights definition for 3D visualization.

Copyright 2017-2025, Voxel51, Inc.

Classes:

Light([name, color, intensity, visible, ...])

Base class for 3D lights.

AmbientLight([name, intensity, color, ...])

Represents an ambient light.

DirectionalLight([name, target, color, ...])

Represents a directional light.

PointLight([name, distance, decay, color, ...])

Represents a point light.

SpotLight([name, target, distance, decay, ...])

Represents a spot light.

class fiftyone.core.threed.lights.Light(name: str | None = None, color: str = '#ffffff', intensity: float = 1.0, visible=True, position: Vector3 | List[float] | Tuple[float] | array | None = None, scale: Vector3 | List[float] | Tuple[float] | array | None = None, quaternion: Quaternion | None = None)#

Bases: Object3D

Base class for 3D lights.

Parameters:
  • color ("#ffffff") – the color of the light

  • intensity (1.0) – the intensity of the light in the range [0, 1]

  • visible (True) – default visibility of the object in the scene

  • position (None) – the position of the light in object space

  • quaternion (None) – the quaternion of the light in object space

  • scale (None) – the scale of the light in object space

Methods:

add(*objs)

Add one or more objects as children of this one.

as_dict()

Converts the object to a dict.

clear()

Remove all children from this object.

find_and_execute(node, predicate, on_match)

Recursively search the scene graph and execute an action on matching nodes.

remove(*objs)

Remove one or more objects from the scene graph recursively.

remove_by_name(name)

Remove all objects with the given name from the scene graph recursively.

remove_by_uuid(target_uuid)

Remove the object with the given UUID from the scene graph recursively.

traverse([include_self])

Traverse the scene graph.

Attributes:

local_transform_matrix

The local transform matrix of the object.

position

The position of the object in object space.

quaternion

The quaternion of the object in object space.

rotation

The rotation of the object in object space.

scale

The scale of the object in object space.

uuid

The unique ID of the object.

add(*objs: Object3D) None#

Add one or more objects as children of this one.

as_dict()#

Converts the object to a dict.

clear() None#

Remove all children from this object.

find_and_execute(node: Object3D, predicate, on_match, stop_on_first_match: bool = False) bool#

Recursively search the scene graph and execute an action on matching nodes.

This is a generic method for traversing the scene graph and performing operations on nodes that match a given predicate. It can be used for finding and removing nodes, collecting nodes, updating nodes, etc.

The traversal continues into the subtrees of both matching and non-matching nodes. For matching nodes, the subtree is traversed when on_match returns True and stop_on_first_match is False.

Parameters:
  • node – the node to start searching from

  • predicate – a function that takes a child Object3D and returns

  • criteria (True if it matches the search)

  • on_match – a function called when a match is found, takes

  • (parent

  • searching (child) and returns True to continue)

  • to (False)

  • stop

  • stop_on_first_match – if True, stop searching after first match

  • processed (is)

Returns:

True if a match was found and we should stop, False otherwise

Example

# Find all nodes with a specific name and collect them matches = [] def predicate(child):

return child.name == “target”

def on_match(parent, child):

matches.append(child) return True # continue searching

scene.find_and_execute(scene, predicate, on_match)

property local_transform_matrix#

The local transform matrix of the object.

Setting this property also decomposes the matrix into its constituent position, quaternion, and scale components. However, decomposition of matrices with skew / shear components (non-uniform scaling) might have unexpected results.

property position#

The position of the object in object space.

property quaternion#

The quaternion of the object in object space.

remove(*objs: Object3D) None#

Remove one or more objects from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes any matching objects from their parent’s children list.

Parameters:

*objs – one or more Object3D instances to remove

Raises:
  • ValueError – if any of the objects to remove is this object itself

  • ValueError – if any of the objects is not found in the scene graph

remove_by_name(name: str) None#

Remove all objects with the given name from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes all objects matching the given name from their parent’s children lists.

Parameters:

name – the name of the objects to remove

Raises:
  • ValueError – if attempting to remove this object itself by name

  • ValueError – if no objects with the given name are found

remove_by_uuid(target_uuid: str) None#

Remove the object with the given UUID from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes the object matching the given UUID from its parent’s children list. UUIDs should be unique, so only one match is expected.

Parameters:

target_uuid – the UUID of the object to remove

Raises:
  • ValueError – if attempting to remove this object itself by UUID

  • ValueError – if no object with the given UUID is found

property rotation#

The rotation of the object in object space.

property scale#

The scale of the object in object space.

traverse(include_self=True)#

Traverse the scene graph.

property uuid#

The unique ID of the object.

class fiftyone.core.threed.lights.AmbientLight(name: str = 'AmbientLight', intensity: float = 0.1, color: str = '#ffffff', visible=True, position: Vector3 | List[float] | Tuple[float] | array | None = None, scale: Vector3 | List[float] | Tuple[float] | array | None = None, quaternion: Quaternion | None = None)#

Bases: Light

Represents an ambient light.

This light globally illuminates all objects in the scene equally.

Parameters:
  • name ("AmbientLight") – the name of the light

  • intensity (0.1) – the intensity of the light in the range [0, 1]

  • color ("#ffffff") – the color of the light

  • visible (True) – default visibility of the object in the scene

  • position (None) – the position of the light in object space

  • quaternion (None) – the quaternion of the light in object space

  • scale (None) – the scale of the light in object space

Methods:

add(*objs)

Add one or more objects as children of this one.

as_dict()

Converts the object to a dict.

clear()

Remove all children from this object.

find_and_execute(node, predicate, on_match)

Recursively search the scene graph and execute an action on matching nodes.

remove(*objs)

Remove one or more objects from the scene graph recursively.

remove_by_name(name)

Remove all objects with the given name from the scene graph recursively.

remove_by_uuid(target_uuid)

Remove the object with the given UUID from the scene graph recursively.

traverse([include_self])

Traverse the scene graph.

Attributes:

local_transform_matrix

The local transform matrix of the object.

position

The position of the object in object space.

quaternion

The quaternion of the object in object space.

rotation

The rotation of the object in object space.

scale

The scale of the object in object space.

uuid

The unique ID of the object.

add(*objs: Object3D) None#

Add one or more objects as children of this one.

as_dict()#

Converts the object to a dict.

clear() None#

Remove all children from this object.

find_and_execute(node: Object3D, predicate, on_match, stop_on_first_match: bool = False) bool#

Recursively search the scene graph and execute an action on matching nodes.

This is a generic method for traversing the scene graph and performing operations on nodes that match a given predicate. It can be used for finding and removing nodes, collecting nodes, updating nodes, etc.

The traversal continues into the subtrees of both matching and non-matching nodes. For matching nodes, the subtree is traversed when on_match returns True and stop_on_first_match is False.

Parameters:
  • node – the node to start searching from

  • predicate – a function that takes a child Object3D and returns

  • criteria (True if it matches the search)

  • on_match – a function called when a match is found, takes

  • (parent

  • searching (child) and returns True to continue)

  • to (False)

  • stop

  • stop_on_first_match – if True, stop searching after first match

  • processed (is)

Returns:

True if a match was found and we should stop, False otherwise

Example

# Find all nodes with a specific name and collect them matches = [] def predicate(child):

return child.name == “target”

def on_match(parent, child):

matches.append(child) return True # continue searching

scene.find_and_execute(scene, predicate, on_match)

property local_transform_matrix#

The local transform matrix of the object.

Setting this property also decomposes the matrix into its constituent position, quaternion, and scale components. However, decomposition of matrices with skew / shear components (non-uniform scaling) might have unexpected results.

property position#

The position of the object in object space.

property quaternion#

The quaternion of the object in object space.

remove(*objs: Object3D) None#

Remove one or more objects from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes any matching objects from their parent’s children list.

Parameters:

*objs – one or more Object3D instances to remove

Raises:
  • ValueError – if any of the objects to remove is this object itself

  • ValueError – if any of the objects is not found in the scene graph

remove_by_name(name: str) None#

Remove all objects with the given name from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes all objects matching the given name from their parent’s children lists.

Parameters:

name – the name of the objects to remove

Raises:
  • ValueError – if attempting to remove this object itself by name

  • ValueError – if no objects with the given name are found

remove_by_uuid(target_uuid: str) None#

Remove the object with the given UUID from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes the object matching the given UUID from its parent’s children list. UUIDs should be unique, so only one match is expected.

Parameters:

target_uuid – the UUID of the object to remove

Raises:
  • ValueError – if attempting to remove this object itself by UUID

  • ValueError – if no object with the given UUID is found

property rotation#

The rotation of the object in object space.

property scale#

The scale of the object in object space.

traverse(include_self=True)#

Traverse the scene graph.

property uuid#

The unique ID of the object.

class fiftyone.core.threed.lights.DirectionalLight(name: str = 'DirectionalLight', target: Vector3 | List[float] | Tuple[float] | array = Vector3(x=0.0, y=0.0, z=0.0), color: str = '#ffffff', intensity: float = 1.0, visible=True, position: Vector3 | List[float] | Tuple[float] | array | None = None, scale: Vector3 | List[float] | Tuple[float] | array | None = None, quaternion: Quaternion | None = None)#

Bases: Light

Represents a directional light.

A light that gets emitted in a specific direction. This light will behave as though it is infinitely far away and the rays produced from it are all parallel.

Parameters:
  • name ("DirectionalLight") – the name of the light

  • target ([0,0,0]) – the target of the light

  • color ("#ffffff") – the color of the light

  • intensity (1.0) – the intensity of the light in the range [0, 1]

  • visible (True) – default visibility of the object in the scene

  • position (None) – the position of the light in object space

  • quaternion (None) – the quaternion of the light in object space

  • scale (None) – the scale of the light in object space

Attributes:

target

local_transform_matrix

The local transform matrix of the object.

position

The position of the object in object space.

quaternion

The quaternion of the object in object space.

rotation

The rotation of the object in object space.

scale

The scale of the object in object space.

uuid

The unique ID of the object.

Methods:

add(*objs)

Add one or more objects as children of this one.

as_dict()

Converts the object to a dict.

clear()

Remove all children from this object.

find_and_execute(node, predicate, on_match)

Recursively search the scene graph and execute an action on matching nodes.

remove(*objs)

Remove one or more objects from the scene graph recursively.

remove_by_name(name)

Remove all objects with the given name from the scene graph recursively.

remove_by_uuid(target_uuid)

Remove the object with the given UUID from the scene graph recursively.

traverse([include_self])

Traverse the scene graph.

target: Vector3 | List[float] | Tuple[float] | array = Vector3(x=0.0, y=0.0, z=0.0)#
add(*objs: Object3D) None#

Add one or more objects as children of this one.

as_dict()#

Converts the object to a dict.

clear() None#

Remove all children from this object.

find_and_execute(node: Object3D, predicate, on_match, stop_on_first_match: bool = False) bool#

Recursively search the scene graph and execute an action on matching nodes.

This is a generic method for traversing the scene graph and performing operations on nodes that match a given predicate. It can be used for finding and removing nodes, collecting nodes, updating nodes, etc.

The traversal continues into the subtrees of both matching and non-matching nodes. For matching nodes, the subtree is traversed when on_match returns True and stop_on_first_match is False.

Parameters:
  • node – the node to start searching from

  • predicate – a function that takes a child Object3D and returns

  • criteria (True if it matches the search)

  • on_match – a function called when a match is found, takes

  • (parent

  • searching (child) and returns True to continue)

  • to (False)

  • stop

  • stop_on_first_match – if True, stop searching after first match

  • processed (is)

Returns:

True if a match was found and we should stop, False otherwise

Example

# Find all nodes with a specific name and collect them matches = [] def predicate(child):

return child.name == “target”

def on_match(parent, child):

matches.append(child) return True # continue searching

scene.find_and_execute(scene, predicate, on_match)

property local_transform_matrix#

The local transform matrix of the object.

Setting this property also decomposes the matrix into its constituent position, quaternion, and scale components. However, decomposition of matrices with skew / shear components (non-uniform scaling) might have unexpected results.

property position#

The position of the object in object space.

property quaternion#

The quaternion of the object in object space.

remove(*objs: Object3D) None#

Remove one or more objects from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes any matching objects from their parent’s children list.

Parameters:

*objs – one or more Object3D instances to remove

Raises:
  • ValueError – if any of the objects to remove is this object itself

  • ValueError – if any of the objects is not found in the scene graph

remove_by_name(name: str) None#

Remove all objects with the given name from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes all objects matching the given name from their parent’s children lists.

Parameters:

name – the name of the objects to remove

Raises:
  • ValueError – if attempting to remove this object itself by name

  • ValueError – if no objects with the given name are found

remove_by_uuid(target_uuid: str) None#

Remove the object with the given UUID from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes the object matching the given UUID from its parent’s children list. UUIDs should be unique, so only one match is expected.

Parameters:

target_uuid – the UUID of the object to remove

Raises:
  • ValueError – if attempting to remove this object itself by UUID

  • ValueError – if no object with the given UUID is found

property rotation#

The rotation of the object in object space.

property scale#

The scale of the object in object space.

traverse(include_self=True)#

Traverse the scene graph.

property uuid#

The unique ID of the object.

class fiftyone.core.threed.lights.PointLight(name: str = 'PointLight', distance: float = 0.0, decay: float = 2.0, color: str = '#ffffff', intensity: float = 1.0, visible=True, position: Vector3 | List[float] | Tuple[float] | array | None = None, scale: Vector3 | List[float] | Tuple[float] | array | None = None, quaternion: Quaternion | None = None)#

Bases: Light

Represents a point light.

Parameters:
  • name ("PointLight") – the name of the light

  • distance (0.0) – the distance at which the light’s intensity is zero

  • decay (2.0) – the amount the light dims along the distance of the light

  • color ("#ffffff") – the color of the light

  • intensity (1.0) – the intensity of the light in the range [0, 1]

  • visible (True) – default visibility of the object in the scene

  • position (None) – the position of the light in object space

  • quaternion (None) – the quaternion of the light in object space

  • scale (None) – the scale of the light in object space

Methods:

add(*objs)

Add one or more objects as children of this one.

as_dict()

Converts the object to a dict.

clear()

Remove all children from this object.

find_and_execute(node, predicate, on_match)

Recursively search the scene graph and execute an action on matching nodes.

remove(*objs)

Remove one or more objects from the scene graph recursively.

remove_by_name(name)

Remove all objects with the given name from the scene graph recursively.

remove_by_uuid(target_uuid)

Remove the object with the given UUID from the scene graph recursively.

traverse([include_self])

Traverse the scene graph.

Attributes:

local_transform_matrix

The local transform matrix of the object.

position

The position of the object in object space.

quaternion

The quaternion of the object in object space.

rotation

The rotation of the object in object space.

scale

The scale of the object in object space.

uuid

The unique ID of the object.

add(*objs: Object3D) None#

Add one or more objects as children of this one.

as_dict()#

Converts the object to a dict.

clear() None#

Remove all children from this object.

find_and_execute(node: Object3D, predicate, on_match, stop_on_first_match: bool = False) bool#

Recursively search the scene graph and execute an action on matching nodes.

This is a generic method for traversing the scene graph and performing operations on nodes that match a given predicate. It can be used for finding and removing nodes, collecting nodes, updating nodes, etc.

The traversal continues into the subtrees of both matching and non-matching nodes. For matching nodes, the subtree is traversed when on_match returns True and stop_on_first_match is False.

Parameters:
  • node – the node to start searching from

  • predicate – a function that takes a child Object3D and returns

  • criteria (True if it matches the search)

  • on_match – a function called when a match is found, takes

  • (parent

  • searching (child) and returns True to continue)

  • to (False)

  • stop

  • stop_on_first_match – if True, stop searching after first match

  • processed (is)

Returns:

True if a match was found and we should stop, False otherwise

Example

# Find all nodes with a specific name and collect them matches = [] def predicate(child):

return child.name == “target”

def on_match(parent, child):

matches.append(child) return True # continue searching

scene.find_and_execute(scene, predicate, on_match)

property local_transform_matrix#

The local transform matrix of the object.

Setting this property also decomposes the matrix into its constituent position, quaternion, and scale components. However, decomposition of matrices with skew / shear components (non-uniform scaling) might have unexpected results.

property position#

The position of the object in object space.

property quaternion#

The quaternion of the object in object space.

remove(*objs: Object3D) None#

Remove one or more objects from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes any matching objects from their parent’s children list.

Parameters:

*objs – one or more Object3D instances to remove

Raises:
  • ValueError – if any of the objects to remove is this object itself

  • ValueError – if any of the objects is not found in the scene graph

remove_by_name(name: str) None#

Remove all objects with the given name from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes all objects matching the given name from their parent’s children lists.

Parameters:

name – the name of the objects to remove

Raises:
  • ValueError – if attempting to remove this object itself by name

  • ValueError – if no objects with the given name are found

remove_by_uuid(target_uuid: str) None#

Remove the object with the given UUID from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes the object matching the given UUID from its parent’s children list. UUIDs should be unique, so only one match is expected.

Parameters:

target_uuid – the UUID of the object to remove

Raises:
  • ValueError – if attempting to remove this object itself by UUID

  • ValueError – if no object with the given UUID is found

property rotation#

The rotation of the object in object space.

property scale#

The scale of the object in object space.

traverse(include_self=True)#

Traverse the scene graph.

property uuid#

The unique ID of the object.

class fiftyone.core.threed.lights.SpotLight(name: str = 'SpotLight', target: Vector3 | List[float] | Tuple[float] | array = None, distance: float = 0.0, decay: float = 2.0, angle: float = 1.0471975511965976, penumbra: float = 0.0, color: str = '#ffffff', intensity: float = 1.0, visible=True, position: Vector3 | List[float] | Tuple[float] | array | None = None, scale: Vector3 | List[float] | Tuple[float] | array | None = None, quaternion: Quaternion | None = None)#

Bases: Light

Represents a spot light.

Parameters:
  • name ("SpotLight") – the name of the light

  • target ([0,0,0]) – the target of the light

  • distance (0.0) – the distance at which the light’s intensity is zero

  • decay (2.0) – the amount the light dims along the distance of the light

  • angle (PI / 3) – the angle of the light’s spotlight, in radians

  • penumbra (0.0) – the angle of the penumbra of the light’s spotlight, in radians

  • color ("#ffffff") – the color of the light

  • intensity (1.0) – the intensity of the light in the range [0, 1]

  • visible (True) – default visibility of the object in the scene

  • position (None) – the position of the light in object space

  • quaternion (None) – the quaternion of the light in object space

  • scale (None) – the scale of the light in object space

Methods:

add(*objs)

Add one or more objects as children of this one.

as_dict()

Converts the object to a dict.

clear()

Remove all children from this object.

find_and_execute(node, predicate, on_match)

Recursively search the scene graph and execute an action on matching nodes.

remove(*objs)

Remove one or more objects from the scene graph recursively.

remove_by_name(name)

Remove all objects with the given name from the scene graph recursively.

remove_by_uuid(target_uuid)

Remove the object with the given UUID from the scene graph recursively.

traverse([include_self])

Traverse the scene graph.

Attributes:

local_transform_matrix

The local transform matrix of the object.

position

The position of the object in object space.

quaternion

The quaternion of the object in object space.

rotation

The rotation of the object in object space.

scale

The scale of the object in object space.

uuid

The unique ID of the object.

add(*objs: Object3D) None#

Add one or more objects as children of this one.

as_dict()#

Converts the object to a dict.

clear() None#

Remove all children from this object.

find_and_execute(node: Object3D, predicate, on_match, stop_on_first_match: bool = False) bool#

Recursively search the scene graph and execute an action on matching nodes.

This is a generic method for traversing the scene graph and performing operations on nodes that match a given predicate. It can be used for finding and removing nodes, collecting nodes, updating nodes, etc.

The traversal continues into the subtrees of both matching and non-matching nodes. For matching nodes, the subtree is traversed when on_match returns True and stop_on_first_match is False.

Parameters:
  • node – the node to start searching from

  • predicate – a function that takes a child Object3D and returns

  • criteria (True if it matches the search)

  • on_match – a function called when a match is found, takes

  • (parent

  • searching (child) and returns True to continue)

  • to (False)

  • stop

  • stop_on_first_match – if True, stop searching after first match

  • processed (is)

Returns:

True if a match was found and we should stop, False otherwise

Example

# Find all nodes with a specific name and collect them matches = [] def predicate(child):

return child.name == “target”

def on_match(parent, child):

matches.append(child) return True # continue searching

scene.find_and_execute(scene, predicate, on_match)

property local_transform_matrix#

The local transform matrix of the object.

Setting this property also decomposes the matrix into its constituent position, quaternion, and scale components. However, decomposition of matrices with skew / shear components (non-uniform scaling) might have unexpected results.

property position#

The position of the object in object space.

property quaternion#

The quaternion of the object in object space.

remove(*objs: Object3D) None#

Remove one or more objects from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes any matching objects from their parent’s children list.

Parameters:

*objs – one or more Object3D instances to remove

Raises:
  • ValueError – if any of the objects to remove is this object itself

  • ValueError – if any of the objects is not found in the scene graph

remove_by_name(name: str) None#

Remove all objects with the given name from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes all objects matching the given name from their parent’s children lists.

Parameters:

name – the name of the objects to remove

Raises:
  • ValueError – if attempting to remove this object itself by name

  • ValueError – if no objects with the given name are found

remove_by_uuid(target_uuid: str) None#

Remove the object with the given UUID from the scene graph recursively.

This method searches recursively through the entire scene graph starting from this object and removes the object matching the given UUID from its parent’s children list. UUIDs should be unique, so only one match is expected.

Parameters:

target_uuid – the UUID of the object to remove

Raises:
  • ValueError – if attempting to remove this object itself by UUID

  • ValueError – if no object with the given UUID is found

property rotation#

The rotation of the object in object space.

property scale#

The scale of the object in object space.

traverse(include_self=True)#

Traverse the scene graph.

property uuid#

The unique ID of the object.