Forum Moderators: nerd, RedPhantom
(Last Updated: 2024 Dec 03 11:05 am)
D3D's "Render Scenes" script shipped with Poser 11 as standard. From the readme: "'Render scenes' is a batch render[er] for several scene files". Only for images, but the script is in plain text and hackable Python, and looks at first glance like it could be made to do what you want with a little hacking.
It was not included in Poser 13. Needs WX for its UI, and I vaguely recall that Apple banned WX on Macs (along with so much else)? So perhaps, 'Windows only'?
This simple Poser script for rendering a frame from multiple mo-cap files looks like it has some interesting code ... https://gist.github.com/erfannoury/76c839b96ebd17aa2102
Learn the Secrets of Poser 11 and Line-art Filters.
Learn the Secrets of Poser 11 and Line-art Filters.
Ah, well here is D3D's 2008 "Three Poser Python scripts to set up FireFly renders and to batch render poses and scenes", posted by the man himself on Renderosity Freestuff, and flagged by him as "licensed for commercial or non-commercial use". https://www.renderosity.com/freestuff/items/51547/render-11 Includes renderscenes.py
Presumably, given the permissive licence, this could now be forked and 'tickled up a bit' to work for Poser 14 (I recall it didn't work in Poser 11)? The script itself does say simply "copyright" in the header, but presumably his later posting of the script(s) under a permissive licence voids that?
Learn the Secrets of Poser 11 and Line-art Filters.
I didn't crack the code for MP4s, but thanks to ChatGPT I did get this to work exactly as I need it to with Poser 12 for PNG sequences. Turns out this is a better solution for what I'm doing anyway, since the Preview engine can't render proper alpha channels in Silhouette mode. AfterEffects is able to import the PNGs as a PNG sequence and treat them exactly as they would an MP4, which for my purposes works precisely the way I need.
Code:
import os
import poser
import time
# Directory containing the .pz3 files
selected_directory = r"C:\Path\to\Your\Files"
# Find and process all .pz3 files in the directory
pz3_files = [f for f in os.listdir(selected_directory) if f.lower().endswith('.pz3')]
if not pz3_files:
print("No PZ3 files found in the directory.")
else:
for pz3_file in pz3_files:
pz3_path = os.path.join(selected_directory, pz3_file)
try:
# Open the PZ3 file
print(f"Attempting to open {pz3_path}")
poser.OpenDocument(pz3_path)
time.sleep(2) # Wait to ensure document loads fully
# Access the current scene
scene = poser.Scene()
if scene is None:
print(f"Warning: No scene found after opening {pz3_path}")
continue
print(f"Successfully accessed {pz3_path}")
# Set render engine to Preview using SetCurrentRenderEngine
scene.SetCurrentRenderEngine(poser.kRenderEngineCodePREVIEW)
print("Render engine set to Preview.")
# Set display style to Texture Shaded
scene.SetDisplayStyle(10) # 10 is Texture Shaded
print(f"Display style set to Texture Shaded for {pz3_file}.")
# Determine output path and base filename
base_name, _ = os.path.splitext(pz3_file)
output_folder = os.path.dirname(pz3_path)
# Render each frame in the animation sequence to PNG
num_frames = scene.NumFrames()
for frame in range(num_frames):
scene.SetFrame(frame) # Set the current frame
output_filename = f"{base_name}_{frame+1:04d}.png" # e.g., filename_0001.png
output_path = os.path.join(output_folder, output_filename)
# Render the frame to the specified output path
scene.Render()
scene.SaveImage("png", output_path)
print(f"Rendered frame {frame+1} to {output_path}")
# Close the document without saving
poser.CloseDocument()
print(f"Successfully closed {pz3_file}\n")
except AttributeError as attr_err:
print(f"Attribute error while processing {pz3_file}: {attr_err}")
except Exception as e:
print(f"Unexpected error while processing {pz3_file}: {e}")
Here is a some PoserPython and Poser-specific code for MP4s which may be useful...
Learn the Secrets of Poser 11 and Line-art Filters.
Looks good, thanks for posting, and glad it's working. For ease of reading, here's the formatted script...
Learn the Secrets of Poser 11 and Line-art Filters.
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Simple enough request, but the reality of it is proving to be problematic. Short and sweet: is there any way to batch render the PZ3s in a folder and export MP4s of all of them with specific settings?
I've been trying all day to come up with a Python script that will do it, but no matter what avenue I try I just get a faceful of errors. Has anyone else tried this? Or is there another method that I'm not seeing?