Enter python. While technically not a data format, it fits everything else I want in a scene descriptor perfectly. Quietly slip a layer of json between it and the C++ engine, and you got yourself a pretty clean and intuitive way to talk to the renderer. As a bonus it’s widely used, and foreshadows potential future user interface endeavours. But let’s not get ahead of ourselves.
Here’s a mockup of what a python layer might look like.:
import aurora
import math
scene = aurora.core.Scene()
# Settings
options = { "resolution" : [512, 512],
"driver" : "openexr",
"filename" : "dragon.exr",
"pixelsamples" : 256,
"pixelsampler" : "adaptive",
"accelerator" : "uniformgrid",
"minraydepth" : 3,
"raytermination" : "roulette",
"raybias" : 0.001,
"loglevel" : "debug",
}
scene.options = options
# Camera
renderCam = aurora.core.Camera(fov = math.pi/8)
renderCam.translate(278, 273, -800)
scene.setCamera(renderCam)
# Dragon
dragon = aurora.geometry.ObjMesh("models/stanford/dragon.obj")
dragon.scale(30, 30, 30)
dragon.rotateY(-15)
dragon.translate(280, 0, 280)
material = aurora.shaders.MatteSurface(color(1,1,1))
dragon.material = material
scene.append(dragon)
# Cornell box
scene.append(aurora.core.Archive(“scenes/cornell.asc”))
# Light
light = aurora.lights.SquareAreaLight(exposure = 5.75, color = color(1,1,1))
light.scale(60, 1, 60)
light.translate(280, 548.7, 280)
scene.append(light)
aurora.core.render(scene)
I also named my engine Aurora, for numerous reasons.
-Espen
No comments:
Post a Comment