def render(filename, output=None, integrator=None, tmo=True): ren = Renderer() if integrator is not None: ren.integrator.load(integrator, ren.sam_mgr, ren.spectral) print("Begin of loading %s" % filename) start = time.clock() ren.load(filename) elapsed = time.clock() - start print("Loading scene took %f seconds" % elapsed) print("Begin preparing scene for rendering") start = time.clock() ren.prepare() elapsed = time.clock() - start print("Preparation of scene took %f seconds" % elapsed) total_time = 0.0 iteration = 0 while True: start = time.clock() ret = ren.render() elapsed = time.clock() - start total_time += elapsed iteration += 1 print("Rendering of iteration %i took %f seconds" % (iteration, elapsed)) if ret: # We finished rendering all samples break; print("Total rendering time took %f seconds." % total_time) if output is None: output = os.path.join(os.path.dirname(filename), 'Unknown.jpeg') name, ext = os.path.splitext(output) hdr_output = os.path.join(os.path.dirname(filename), 'Unknown.exr') save_image(hdr_output, ren._hdr_buffer) if ext in ('.rgbe', '.exr'): save_image(output, ren._hdr_buffer) else: width, height = ren._hdr_buffer.size() new_img = ImageRGBA(width, height) if tmo: print("Tone mapping is in progress!") start = time.clock() ren.tmo() elapsed = time.clock() - start print("Tone mapping took %f seconds!" % elapsed) blt_prgba_to_rgba(ren._hdr_output, new_img) else: blt_prgba_to_rgba(ren._hdr_buffer, new_img) save_image(output, new_img)
from sdl.blt_floatrgba import blt_prgba_to_rgba, ImageRGBA from imldr import save_image from renlgt import Renderer ren = Renderer() # ren.load('sphere1.txt') ren.load("triangle1.txt") ren.prepare() ren.render() ren.tmo() width, height = ren._hdr_buffer.size() new_img = ImageRGBA(width, height) # blt_prgba_to_rgba(ren._hdr_buffer, new_img) blt_prgba_to_rgba(ren._hdr_output, new_img) save_image("render1.jpeg", new_img)
from sdl.blt_floatrgba import blt_prgba_to_rgba, ImageRGBA from imldr import save_image from renlgt import Renderer ren = Renderer() #ren.load('sphere1.txt') ren.load('triangle1.txt') ren.prepare() ren.render() ren.tmo() width, height = ren._hdr_buffer.size() new_img = ImageRGBA(width, height) #blt_prgba_to_rgba(ren._hdr_buffer, new_img) blt_prgba_to_rgba(ren._hdr_output, new_img) save_image("render1.jpeg", new_img)