I have the following render panoramas code:
def render_panoramas(points, output_directory, rendFinFunc, low_quality=False):
subsystem = unreal.get_editor_subsystem(unreal.MoviePipelineQueueSubsystem)
queue_asset = subsystem.get_queue()
global deletedJobs
if not deletedJobs:
queue_asset.delete_all_jobs()
deletedJobs=True
for point in points:
unreal.log("Processing point: {}".format(point))
# Spawn a camera actor in the scene at each specified point
camera_location = unreal.Vector(point['x'], point['y'], point['z'])
camera_rotation = unreal.Rotator(point['pitch'], point['yaw'], 0)
camera_actor = unreal.EditorLevelLibrary.spawn_actor_from_class(unreal.CineCameraActor, camera_location, camera_rotation)
# Get the camera component
camera_component = camera_actor.get_cine_camera_component()
# Set the Auto Exposure Method to Manual
camera_component.post_process_settings.set_editor_property('auto_exposure_method', unreal.AutoExposureMethod.AEM_MANUAL)
camera_component.post_process_settings.override_auto_exposure_method=True
camera_component.post_process_settings.set_editor_property('auto_exposure_bias', 10.0)
camera_component.post_process_settings.override_auto_exposure_bias=True
# Create a new level sequence for each point
seq_asset_path = f'/Game/Sequences/{point["id"]}'
seq = unreal.LevelSequence.cast(unreal.AssetToolsHelpers.get_asset_tools().create_asset(point["id"], '/Game/Sequences', unreal.LevelSequence, unreal.LevelSequenceFactoryNew()))
# Add a camera cut track to the sequence
camera_cut_track = seq.add_track(unreal.MovieSceneCameraCutTrack)
# Create a new section in the camera cut track, setting its start and end times if necessary
camera_cut_section = camera_cut_track.add_section()
camera_cut_section.set_range(0, 1) # Example range, adjust as needed
# Create binding for the camera actor and set it on the section
binding_proxy = seq.add_possessable(camera_actor)
binding_id = seq.get_binding_id(binding_proxy)
camera_cut_section.set_camera_binding_id(binding_id)
# Convert LevelSequence to SoftObjectPath
seq_soft_object_path = unreal.SoftObjectPath(seq_asset_path)
# Setup the render job and configuration
job = queue_asset.allocate_new_job(unreal.MoviePipelineExecutorJob)
job.job_name = point["id"]
job.sequence = seq_soft_object_path # Setting sequence as a SoftObjectPath
# Get the current editor world map path
current_map_path = unreal.EditorLevelLibrary.get_editor_world().get_path_name()
map_soft_object_path = unreal.SoftObjectPath(current_map_path)
job.map = map_soft_object_path # Setting map as a SoftObjectPath
# Prepare the pipeline configuration
config = unreal.MoviePipelinePrimaryConfig()
# Configure the settings
output_setting = config.find_or_add_setting_by_class(unreal.MoviePipelineOutputSetting.static_class())
output_setting.output_directory = unreal.DirectoryPath(output_directory)
output_setting.file_name_format = point["id"]+'.{frame_number}'
image_output = config.find_or_add_setting_by_class(unreal.MoviePipelineImageSequenceOutput_PNG.static_class())
panoramic_pass = config.find_or_add_setting_by_class(unreal.MoviePipelinePanoramicPass.static_class())
panoramic_pass.num_horizontal_steps = 10
panoramic_pass.num_vertical_steps = 5
panoramic_pass.allocate_history_per_pane = True
if low_quality:
output_setting.output_resolution = unreal.IntPoint(1280, 720)
anti_aliasing_setting = config.find_or_add_setting_by_class(unreal.MoviePipelineAntiAliasingSetting.static_class())
anti_aliasing_setting.temporal_sample_count = 1
render_pass = config.find_or_add_setting_by_class(unreal.MoviePipelineDeferredPassBase.static_class())
"""
render_pass.setting_overrides = [
("r.ShadowQuality", 0),
("r.ReflectionEnvironment", 0),
("r.BloomQuality", 0),
("r.MotionBlurQuality", 0)
]
"""
job.set_configuration(config)
# Execute the render queue
executor = unreal.MoviePipelinePIEExecutor()
subsystem.render_queue_with_executor_instance(executor)
unreal.log("Render execution started")
executor.on_individual_job_work_finished_delegate.add_callable_unique(rendFinFunc)
It works, in that it produces a result, but the result only seems to capture one pane at most. What am I doing wrong?
