wip: multiprocessing renderer
@@ -12,6 +12,8 @@ Notes
"""
import os
+import multiprocessing
+from multiprocessing import Pool
import numpy as np
from moviepy.editor import ImageSequenceClip
@@ -74,6 +76,11 @@ stage_scripts = stages.generate_scripts()
# objects can be defined externally and included separately.
included = ['default.inc']
+# Multiprocessing Configuration (USER DEFINE)
+MULTIPROCESSING = True
+THREAD_PER_AGENT = 4 # Number of thread use per rendering process.
+NUM_AGENT = multiprocessing.cpu_count() // 2 # number of parallel rendering.
+
# Execute
if __name__ == "__main__":
# Load Data
@@ -147,6 +154,9 @@ if __name__ == "__main__":
# Process POVray
# For each frames, a 'png' image file is generated in OUTPUT_IMAGE_DIR directory.
+ if MULTIPROCESSING:
+ pass
+ else:
for script_file, image_file in tqdm(zip(batch_in, batch_out), total=total_frame):
render(
script_file,
@@ -154,6 +164,7 @@ if __name__ == "__main__":
width=WIDTH,
height=HEIGHT,
display=DISPLAY_FRAMES,
+ pov_thread=multiprocessing.cpu_count()
)
# Create Video using moviepy
