[Bf-cycles] progressive updates from a headless CUDA render

Stefan Werner stewreo at gmail.com
Wed Mar 8 17:16:43 CET 2017


Hi,

I’m integrating Cycles into a headless standalone application and am trying to get progressive updates from a CUDA render. As it looks like right now, I don’t think I can pull that off without modifying Cycles itself.

(the following text is ignoring the OpenCL backend, that one I haven’t looked at yet)

First, there are three flags to play with, and it doesn’t seem that all possible combinations are supported:
SessionParams.background, SessionParams.progressive_refine and SessionParams.progressive. The name “background” was initially a bit confusing to me, but I found out that it’s intended to distinguish between a “fire and forget” render task and an interactive rendering session that keeps the session alive for updates (= viewport rendering in Blender).

For a headless application, currently the background=false mode is not available with CUDA rendering. Attempting to use that combination without a valid current OpenGL context crashes the application on my Linux machine. Eventually, I’d like to be able to use background=false (interactive session) without OpenGL, and this could probably be of interest to other developers too (to integrate Cycles into applications using Vulkan, Metal or DirectX, for example).

In the case of background=true and progressive=true, a combination which I believe Blender is not using, things look slightly better. It doesn’t crash, it works fine with CPU and returns black frames for CUDA. I have a simple change to get it to return frames with CUDA, but I’d like to get other opinions if it is valid:

In session.cpp, line 567, replace

	if(!params.background)
		need_tonemap = true;

with
	if(!params.background || params.progressive)
		need_tonemap = true;

Does anyone have any thoughts? Am I misunderstanding the flags? Has anyone else who is plugging Cycles into a 3rd party application come across this or even solved the problem of progressive CUDA renders without OpenGL?

Thanks,
Stefan


More information about the Bf-cycles mailing list