Skip to content

Instantly share code, notes, and snippets.

@sariths
Last active October 24, 2017 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sariths/984ce2797e0f19982b57acdabc065284 to your computer and use it in GitHub Desktop.
Save sariths/984ce2797e0f19982b57acdabc065284 to your computer and use it in GitHub Desktop.
Test perforate.cal with accurate direct settings.
# coding=utf-8
import os,multiprocessing
#Create octree for the scene.
os.system("oconv materials.rad room.rad skies/NYC.sky> octrees/scene.oct")
commands1=[]
commands2=[]
commands3=[]
commands4=[]
commands5=[]
commands6=[]
#Start looping for individual perforations.
for perf in sorted(os.listdir('perforations')):
#split the name to extract perforation value
name,extension = os.path.splitext(perf)
#Create octree for perforation.
commands1.append('oconv -i octrees/scene.oct perforations/%s objects/Glazing.rad > octrees/final%s.oct'%(perf,name))
#run rpict for overture.
commands2.append('rpict -vf views/south.vf -pt 0 -pj 1 -ps 1 -x 64 -y 64 -ab 4 -ad 1024 -ar 1024 -aa 0.1 -af test%s.amb -dc 1 -dt 0 -dj 1 octrees/final%s.oct > test.hdr'%(name,name))
#run rpict for final imaging.
commands3.append('rpict -vf views/south.vf -pt 0 -pj 1 -ps 1 -x 600 -y 600 -ab 4 -ad 1024 -ar 1024 -aa 0.1 -af test%s.amb -dc 1 -dt 0 -dj 1 octrees/final%s.oct > images/%s.hdr'%(name,name,name))
#Optional: Correct exposure,
commands4.append('pfilt -e -2 images/%s.hdr> images/%se.hdr'%(name,name))
#Optional: Falsecolor rendering
commands5.append('falsecolor -i images/%s.hdr -d 0 -s 2000 > images/%sf.hdr'%(name,name))
#Optional composite images, Create a tiff file for cross-platform, radiance independent display.
commands6.append('pcompos -a 2 -la %s | ra_tiff - %s'%(" ".join(['images/%se.hdr'%name,'images/%sf.hdr'%name]),'images/%s.tiff'%name))
x = multiprocessing.Pool(processes=16)
x.map(os.system,commands1)
x.map(os.system,commands2)
x.map(os.system,commands3)
x.map(os.system,commands4)
x.map(os.system,commands5)
x.map(os.system,commands6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment