I need to load 6 cubemap images each "frame" and apply them to a cube and render that as equirectangular panorama frames via Cycles (camera inside cube, nothing else in the scene).
How would you do it?
Try this [Modified according to comments].
It assumes that:
import bpy from os import listdir from os.path import join, isdir, isfile # Root folder which contains a subfolder for each environment map imgFolder = 'C:/ReplaceMe1' # Subfolders, each containing 6 images - 1 per side of the cube mapSubFolders = [ d for d in listdir( imgFolder ) if isdir( join( imgFolder, d ) ) ] # Output Path (where your renders will be saved) outputPath = 'C:/ReplaceMe2' S = bpy.context.scene sides = [ 'top', 'bottom', 'left', 'right', 'front', 'back' ] # Object names for d in mapSubFolders: folderPath = join( imgFolder, d ) imgFiles = [ f for f in listdir( folderPath ) if isfile( join( folderPath, f ) ) ] for s in sides: # This line will crash the script if this folder doesn't contain an image # for each side, with the same name (for example: 'bottom.jpg'; format doesn't matter) sideImg = [ f for f in imgFiles if s in f ] imgPath = join( folderPath, sideImg ) # Open image file or apply the relevant image path to an existing image object with the same name if sideImg not in bpy.data.images: bpy.ops.image.open( filepath = imgPath ) else: bpy.data.images[ sideImg ].filepath = imgPath img = bpy.data.images[ sideImg ] sideObj = S.objects[ s ] t = sideObj.active_material.node_tree t.nodes['Image Texture'].image = img # Apply current side's image to image texture node outputFile = d + "_" + s + S.render.file_extension S.render.filepath = join( outputPath, outputFile ) # Set render output path bpy.ops.render.render( write_still = True )