To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

The pipeline used on each physical viewport defined on the [[Howto:Configure camera view windows|CameraGroup settings]] can be changed via a <code><compositor/></code> tag containing a valid path to the Compositor XML file (using the [[PropertyList XML File]] format).

The pipeline used on each physical viewport defined on the [[Howto:Configure camera view windows|CameraGroup settings]] can be changed via a <code><compositor/></code> tag containing a valid path to the Compositor XML file (using the [[PropertyList XML File]] format).

−

The Compositor introduces a new dedicated fgdata directory new rendering pipelines: $FG_ROOT/Compositor.

+

The Compositor introduces a new dedicated fgdata directory for new/custom rendering pipelines: $FG_ROOT/Compositor.

This is also where the default pipeline can be found, namely: $FG_ROOT/Compositor/default.xml

This is also where the default pipeline can be found, namely: $FG_ROOT/Compositor/default.xml

Revision as of 16:07, 8 February 2019

This article describes content/features that may not yet be available in the latest stable version of FlightGear (2018.3).You may need to install some extra components, use the latest development (Git) version or even rebuild FlightGear from source, possibly from a custom topic branch using special build settings: .This feature is scheduled for FlightGear 2019.3.

The Compositor aims to bring multi-pass rendering to FlightGear. It encapsulates a rendering pipeline and exposes its parameters to the Property Tree.
The pipeline used on each physical viewport defined on the CameraGroup settings can be changed via a <compositor/> tag containing a valid path to the Compositor XML file (using the PropertyList XML File format).

The Compositor introduces a new dedicated fgdata directory for new/custom rendering pipelines: $FG_ROOT/Compositor.

This is also where the default pipeline can be found, namely: $FG_ROOT/Compositor/default.xml

Background

First discussed in 03/2012 during the early Rembrandt days, Zan (Lauri Peltonen) came up with a set of patches demonstrating how to create an XML-configurable rendering pipeline.

Back then, this work was considered to look pretty promising [3] and at the time plans were discussed to unify this with the ongoing Rembrandt implementation (no longer maintained).

Adopting Zan's approach would have meant that efforts like Rembrandt (deferred rendering) could have been implemented without requiring C++ space modifications.

Rembrandt's developer (FredB) suggested to extend the format to avoid duplicating the stages when you have more than one viewport, i.e. specifying a pipeline as a template, with conditions like in effects, and have the current camera layout refer the pipeline that would be duplicated, resized and positioned for each declared viewport [4]

Zan's original patches can still be found in his newcameras branches which allow the user to define the rendering pipeline in preferences.xml:

At that point, it didn't have everything Rembrandt's pipeline needs, but most likely could be easily enhanced to support those things.

Basically the original version added support for multiple camera passes, texture targets, texture formats, passing textures from one pass to another etc, while preserving the standard rendering line if user wants that. [5]

Status

02/2019

The Compositor is in an usable state right now: it works but there are no effects or pipelines developed for it. There are also some bugs and features that don't work as expected because of some hardcoded assumptions in the FlightGear Viewer code.

The corresponding set of patches (topic branches) were put up for review in 08/2018 to discuss the underlying approach and hopefully get this merged in 2019. [6]

As of 02/2019, a set of merge requests has been created for the Compositor framework for SimGear, FlightGear and FGData respectively.

The Compositor is disabled by default at compilation time in
FlightGear (not SimGear). Both Rembrandt and the forward pipeline are
still available if this flag is disabled.

There is a known issue where FG will crash with a segfault if a valid
Compositor XML isn't found, but I don't know how to gracefully quit FG
at that stage of the init process.

The FGData merge request only includes the Low-spec pipeline, which
imitates the current near/far camera forward pipeline.[7]

James suggested, śince compilation is disabled by default, it might be easier to merge more or less as-is (unless there’s something really awkward), and then make any adjustments on top? That also means we can enable this option on Jenkins to get platform coverage.[8]

Features

Completely independent of other parts of the simulator, i.e. it's part of SimGear and can be used in a standalone fashion if needed, ala Canvas.

Although independent, its aim is to be fully compatible with the current rendering framework in FG. This includes the Effects system, CameraGroup, Rembrandt and ALS (and obviously the Canvas).

Its functionality overlaps Rembrandt: what can be done with Rembrandt can be done with the Compositor, but not vice versa.

It doesn't increase the hardware requirements, it expands the hardware range FG can run on. People with integrated GPUs (Intel HD etc) can run a Compositor with a single pass that renders directly to the screen like before, while people with more powerful cards can run a Compositor that implements deferred rendering, for example.

Elements

Buffers

A buffer represents a texture or, more generically, a region of GPU memory. It can have the following parameters:

Specifies the x, y, width and height of the fullscreen quad inside the viewport using normalized coordinates.

effect

The quad will use this effect.

shadow-map

Renders the scene from a light's point of view.

light-num

The OpenGL light number to use for this shadow map.

near-m and far-m

They specify the range of the shadow map.

Passes can render to a buffer (Render to Texture), to several buffers (Multiple Render Targets) or directly to the framebuffer. This is accomplished by the <attachment/> tag. Possible parameters of an attachment are:

Pipelines

Low-Spec pipeline

A fixed function forward rendering pipeline mainly targeted to low spec systems. It imitates the classic forward pipeline used before multi-pass rendering was introduced by using two near/far cameras rendering directly to the screen.

Canvas integration

Apart from serving as a debugging tool for visualizing the contents of a buffer, integrating the Compositor with Canvas allows aircraft developers to access RTT capabilities. Compositor buffers can be accessed within Canvas via a new custom Canvas Image protocol buffer://. For example, the path buffer://test-compositor/test-buffer displays the buffer test-buffer declared in test-compositor.

TODO

Some kind of versioning system to be able to make breaking changes in the future if/when the compositor is updated in any significant way, without people having to manually update their configs.

Coherently support static conditional branching (<condition> tags available for both passes and buffers), as well as using property tree parameters (via a <property> tag ala Effects). For simplicity and to avoid major architectural changes, these conditional checks should only be performed on startup (no dynamic branching). For example, the user should be able to select if they want shadows and their size in the launcher, not on the in-sim Rendering dialog.

Known Issues

Setting a buffer scale factor different from 1.0 and rendering to it might not scale the splash screen correctly.

No error handling when the Compositor wasn't found. FlightGear should quit gracefully but right now it segfaults.

computeIntersections() always uses pass 0, which might fail. The scene pass should be used (which one if there are several?).