Iray Programmer's Manual

Server integration

The server side Iray Bridge features needed to back up the Iray Bridge render and snapshot contexts are made available by loading the plugin iray_bridge_server.dll/so. This plugin installs the API component:

mi::bridge::IIray_bridge_server

This API component can be used to create an instance of the Iray Bridge Application by calling:

mi::bridge::IIray_bridge_server::create_application(const char* application_path, http::IServer* http_server)

Iray Bridge uses web sockets to communicate between client and server, so before creating an application an HTTP server must be created and set up to listen to some interface and port. The create_application() method then creates an Iray Bridge application listening for clients on the provided path on the provided HTTP server. So if the HTTP server is set up to listen for HTTP requests on the standard port 80 on host some.host.com and the application is created with the path some_app, then the client would connect to it using the web socket URL ws://some.host.com/some_app.

Before the application can accept sessions it must be configured and opened for connections. The only mandatory configuration is the path to the disk cache which is set by calling:

IIray_bridge_application::set_disk_cache(const char* location)

The disk cache is where data is cached to avoid having to upload the same data more than once. It is a persistant storage and is either a local path or a cache server. Prefixes are used to distinguish the two cases: "path:" for local path and "address:" to indicate an TCP/IP address to a cache server. Examples:

"path:c:\temp\disk_cache" or "address:127.0.0.1:7777".

If snapshots will be saved then a path where they are saved needs to be specified by calling:

IIray_bridge_application::set_snapshot_path(const char path)

It is also possible to register a session handler by calling:

IIray_bridge_application::set_session_handler( IApplication_session_handler* handler)

This optional handler will be called during the client handshake and can be used to inspect the security token provided by connecting clients and reject connections based on the token, or other things like restricting the number of concurrent sessions.

When configuration is finished, open the application for client sessions by calling:

IIray_bridge_application::open()

The Iray Bridge application is now ready to accept client sessions and render on behalf of Iray Bridge render contexts.

Iray Bridge supports hardware H.264 encoding. This is enabled by loading the plugin nvenc_video.dll/so on the server. Note that a Kepler or newer NVIDIA GPU is required for hardware video encoding to work. Iray Bridge also supports software H.264 encoding by loading the plugin x264_video.dll/so. If both plugins are loaded then hardware H.264 encoding will be used if there is a GPU on the server that supports it, otherwise software encoding will be used.

Note: These plugins are not shipped with Iray because of H.264 licensing considerations. For more information, contact NVIDIA ARC.

Iray Bridge also supports encoding using any image format supported by Iray. Loading the freeimage.dll/so plugin provides a large number of image formats that suit different needs and have different size/quality trade-offs such as jpg, png, or exr. Loading other image plugins will automatically make the format available for use by Iray Bridge.