regcs / AliceLG

A Blender add-on for the use of Blender with the Looking Glass holographic displays.
GNU General Public License v3.0
104 stars 23 forks source link

[Rendering] Implement render farm support #45

Closed regcs closed 3 years ago

regcs commented 3 years ago

Currently, rendering quilts on a render farm seems not to work. We need to look into that.

regcs commented 3 years ago

Note for later:

The user reporting the issue has mentioned that the render operator must be called in blocking mode. There are actually two operators that are called in the add-on:

  1. Our operator which handles the render pipeline.
  2. The bpy.ops.render.render operator.

~An approach to solve the problem might, thus, be connected to the following approaches:~ ~1. Set the attribute 'BLOCKING' for our own operator.~ ~2. Internally call bpy.ops.render.render() instead of bpy.ops.render.render("INVOKE_DEFAULT") because the latter is running the operator in modal mode.~ Edit: The BLOCKING property is only for blocking the UI from being used and the second approach would not make the rest of the operator blocking. So forget about that.

Since we need a non-blocking operation for normal usage of the add-on, the best approach would be to create a second blocking operator, which can be called from scripts by users who want to render on a render farm.

alxdncn commented 3 years ago

This would be fixed with multi-view rendering, which we're currently implementing as an option, though we'll need to test to ensure that's the case.

We can also attempt to fix this for single-view rendering.

regcs commented 3 years ago

After talking to another render farm user, I am getting the impression that this can be solved by implementing the above mentioned second operator and instead of processing everything in a modal loop, just use a normal loop within the operators invoke() call. This operator would be blocking and can be called from command line.

regcs commented 3 years ago

I did some research on render farms today and it seems every render farm works a bit different. That means, the only thing we can do on the add-on side is to provide a mechanism that enables render farms to add support for Alice/LG. There are three things I will implement:

regcs commented 3 years ago

408e74d3245a27694a8a5c04375cec1f319eb306 adds command-line arguments -alicelg-render and -alicelg-render-anim, which start a quilt rendering or quilt animation rendering when calling Blender in background mode from the command line. These can be called by render farms. Either of the both arguments must be called after all Blender arguments, i.e. following a --. For example:

blender -b BLENDFILE_PATH -- -alicelg-render

This will start Blender, open the BLENDFILE_PATH, and will use the settings saved in this .blend file to render a quilt. Still need to implement a bit of refinement (e.g., What if the user / renderfarm also passes an output path for the file?)

Edit: Using Blenders -o/ --render-output now works to specify the output path of the quilt. If specified, the "Add Metadata" option is automatically disabled (456f4f8757).

regcs commented 3 years ago

Added further command line arguments with 97b23841ae291c56cb9932238bdb56b1d55399b6. The add-on now understands the following arguments, which are already known from Blender command line:

However, it is important that these arguments are specified after the mandatory -- to notify Alice/LG that the arguments are meant for the add-on. An example call, which would start Blender in background mode, load the BLENDFILE_PATH, and render a quilt animation from frame 10 to 24 with the base file name quilt_anim would look like this:

blender -b BLENDFILE_PATH -- -alicelg-render-anim -o /tmp/quilt_anim.png -s 10 -e 24

Another example, which would only render the frame 16 as a single quilt, would like this:

blender -b BLENDFILE_PATH -- -alicelg-render -o /tmp/quilt.png -f 16