Skip to content

Using cluster rendering

Valtteri Koskivuori edited this page Nov 21, 2021 · 3 revisions

On macOS and Linux, C-ray supports cluster network rendering as of version 0.6.3

Sharing a heavy render over multiple machines can cut your render times drastically, here's how to do it in c-ray:

First, set up worker nodes

Build and run c-ray on one or more of your desired worker machines like so: bin/c-ray --worker <optional port #>

c-ray should report to be listening for connections on the specified port. The default port if one is not specified is 2222.

Next, launch a coordinating master node to start the shared render

To start a network render, you launch c-ray as you normally would, but with an additional --nodes flag and a comma-separated list of <worker-ip>:<worker-port> pairs, like so:

bin/c-ray input/some_complex_scene.json --nodes <worker_machine_ip>,<another_worker_machine_ip>

Example with two nodes, one of which has a non-default port 2223 specified: bin/c-ray input/hdr.json --nodes 192.168.1.218,192.168.1.221:2223

If no port is specified for a worker, 2222 is assumed. If you specify a list with the wrong format, the fragile argument parser will silently break. Don't do that.

The master node will set up like normal, and then send all the assets referenced in the specified scene to all the worker nodes. The worker nodes will then locally set up their state, and report when they are ready for rendering. When all the worker nodes are ready, the render will begin.

If you're working on a laptop and don't want to burn your lap, you can offload your render entirely to network workers. If network rendering is in use, you can override your local thread count to zero with -j 0 in your arguments.

Important security caveat:

I would highly encourage you to carefully consider before exposing a c-ray worker node to the open internet. As a developer-oriented project, the c-ray render protocol and implementation have not yet been audited and are likely to contain security-critical bugs. As specified in the MIT license, I am in no way responsible if you encounter a security breach on your system via a compromised c-ray worker node.

With that being said, here's a secure way to run a render over the open internet:

First, establish a SSH tunnel over to the desired worker node, like so:

ssh -L 2222:127.0.0.1:2222 username@target

This will forward the default port from that machine, over a SSH tunnel to our local machine. Run a worker node on that remote machine as specified above, then connect to it like you would to a local node:

bin/c-ray input/some-scene.json --nodes 127.0.0.1

The extra latency shouldn't cause issues, but don't be surprised if you encounter them. The protocol is still very much under development!