Cannot render with yafray from python script (keep getting white image)

Hi,

I am using a python script to render still images of a blender model from the commandline with: blender -b blank.blend -p script.py I am trying to change the renderer to yafray (which is installed and working correctly) but keep getting a blank white image.

Rendering with the internal renderer always works fine:

context = Scene.GetCurrent().getRenderingContext()
context.setRenderer(Render.INTERNAL)
context.setRenderPath(RenderPath)
context.imageSizeX(pixelsizex)
context.imageSizeY(pixelsizey)
context.quality(100)
context.setImageType(Render.JPEG)
context.threads = 1
context.render()

but as soon as I try to use yafray I get a blank white image no matter how much I play with the options below:

context = Scene.GetCurrent().getRenderingContext()
context.setRenderer(Render.YAFRAY)
context.enableRayTracing(1)
context.setYafrayGIMethod(Render.NONE)
context.setYafrayGIQuality(Render.NONE)
context.yafrayRayDepth(3)
context.yafrayGIDepth(3)
context.yafrayProcessorCount(2)
context.yafrayGIIndirPower(1.0)
context.yafrayGIPower(1.0)
context.setRenderPath(RenderPath)
context.imageSizeX(pixelsizex)
context.imageSizeY(pixelsizey)
context.quality(100)
context.setImageType(Render.JPEG)
context.render()

The funny thing if I fire up the Blender GUI and load this script, I get the blank rendered image displayed as soon as Blender has loaded, but if I press F10 to get the scene options and click around WITHOUT changing any options, then click Render, the image renders fine, so it’s not because of improper lighting in the scene.

Any ideas what would cause that? Thanks in advance…

Gabriel Ross

OK, figured it out. You have to set the yafray gamma and ray bias manually, the GUI sets defaults, but when doing it programmatically you have to set the values yourself:

context.yafrayGamma(1.0)
context.yafrayRayBias(0.1)