def write(
        self, fo3d_path: str, resolve_relative_paths=False, pprint=False
    ):
        """Export the scene to a ``.fo3d`` file.

        Args:
            fo3d_path: the path to write the scene to
            resolve_relative_paths: whether to resolve relative paths in the
                scene to absolute paths. If ``True``, all asset paths in the
                scene are resolved to absolute paths. If ``False``, asset
                paths are left as-is. Defaults to ``False``.
            pprint: whether to pretty-print the JSON output. Defaults to
                ``False``.
        """
        if not fo3d_path.endswith(".fo3d"):
            raise ValueError("Scene must be exported to a .fo3d file")

        validated_scene = self.copy()

        fo3d_path_dir = os.path.dirname(fo3d_path)

        visited_nodes = set()
        for node in validated_scene.traverse():
            if node.name in visited_nodes:
                raise ValueError(
                    f"Scene contains multiple nodes with the same name: {node.name}"
                )

            visited_nodes.add(node.name)

            # Resolve child's asset paths
            if resolve_relative_paths:
                self._resolve_node_asset_paths(node, fo3d_path_dir)

        # Now resolve any asset paths in scene background
        if resolve_relative_paths and validated_scene.background is not None:
            if validated_scene.background.image is not None:
                validated_scene.background.image = self._resolve_asset_path(
                    fo3d_path_dir, validated_scene.background.image
                )
            if validated_scene.background.cube is not None:
                validated_scene.background.cube = [
                    self._resolve_asset_path(fo3d_path_dir, ci)
                    for ci in validated_scene.background.cube
                ]

        fos.write_json(
            validated_scene.as_dict(), fo3d_path, pretty_print=pprint
        )
Export the scene to a ``.fo3d`` file.

        Args:
            fo3d_path: the path to write the scene to
            resolve_relative_paths: whether to resolve relative paths in the
                scene to absolute paths. If ``True``, all asset paths in the
                scene are resolved to absolute paths. If ``False``, asset
                paths are left as-is. Defaults to ``False``.
            pprint: whether to pretty-print the JSON output. Defaults to
                ``False``.
        
fiftyone/core/threed/scene_3d.py