343
edits
m (+-cat: Core development projects → Compositor) |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
|image = ALS Compositor pipeline.jpg | |image = ALS Compositor pipeline.jpg | ||
|name = Compositor Framework | |name = Compositor Framework | ||
|started = 01/2018 (Available since FlightGear | |started = 01/2018 (Available since FlightGear 2020.4) | ||
|description = Dynamic rendering pipeline configured via the [[Property tree]] and [[PropertyList XML File|XML]] | |description = Dynamic rendering pipeline configured via the [[Property tree]] and [[PropertyList XML File|XML]] | ||
|status = Stable (merged and actively maintained) | |status = Stable (merged and actively maintained) | ||
Line 13: | Line 13: | ||
* {{flightgear file|src/Viewer}} | * {{flightgear file|src/Viewer}} | ||
* {{fgdata file|Compositor}} | * {{fgdata file|Compositor}} | ||
}} | }} | ||
The '''Compositor''' aims to bring multi-pass rendering to FlightGear. It encapsulates a rendering pipeline and exposes its parameters to a [[Property Tree]] interface. At startup, FlightGear reads the pipeline definition file for each physical viewport defined on the [[Howto:Configure camera view windows|CameraGroup settings]]. If no Compositor file is specified for a physical camera, the one given by the <code>--compositor=</code> startup command will be used. If such startup option is not used either, FlightGear will look for a valid Compositor file in <tt>$FG_ROOT/Compositor/default.xml</tt>. | The '''Compositor''' aims to bring multi-pass rendering to FlightGear. It encapsulates a rendering pipeline and exposes its parameters to a [[Property Tree]] interface. At startup, FlightGear reads the pipeline definition file for each physical viewport defined on the [[Howto:Configure camera view windows|CameraGroup settings]]. If no Compositor file is specified for a physical camera, the one given by the <code>--compositor=</code> startup command will be used. If such startup option is not used either, FlightGear will look for a valid Compositor file in <tt>$FG_ROOT/Compositor/default.xml</tt>. | ||
The Compositor introduces a new dedicated fgdata directory for new/custom rendering pipelines: {{Fgdata file|Compositor}}. | The Compositor introduces a new dedicated fgdata directory for new/custom rendering pipelines: {{Fgdata file|Compositor}}. | ||
== Background == | == Background == | ||
{{See also|Supporting multiple renderers|Howto:Canvas View Camera Element}} | {{See also|Supporting multiple renderers|Howto:Canvas View Camera Element}} | ||
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. | 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 <ref>{{cite web | ||
Back then, this work was considered to look pretty promising <ref>{{cite web | |||
|url = https://sourceforge.net/p/flightgear/mailman/message/28946515/ | |url = https://sourceforge.net/p/flightgear/mailman/message/28946515/ | ||
|title = <nowiki> Re: [Flightgear-devel] [Rembrandt] the plan </nowiki> | |title = <nowiki> Re: [Flightgear-devel] [Rembrandt] the plan </nowiki> | ||
Line 38: | Line 31: | ||
}}</ref> and at the time plans were discussed to unify this with the ongoing Rembrandt implementation (no longer maintained). | }}</ref> 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, i.e. purely in [[Base package]] space. | Adopting Zan's approach would have meant that efforts like [[Rembrandt]] (deferred rendering) could have been implemented without requiring C++ space modifications, i.e. purely in [[Base package]] space. 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 <ref>{{cite web | ||
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 <ref>{{cite web | |||
|url = https://sourceforge.net/p/flightgear/mailman/message/28944773/ | |url = https://sourceforge.net/p/flightgear/mailman/message/28944773/ | ||
|title = <nowiki> Re: [Flightgear-devel] [Rembrandt] the plan </nowiki> | |title = <nowiki> Re: [Flightgear-devel] [Rembrandt] the plan </nowiki> | ||
Line 49: | Line 40: | ||
}}</ref> | }}</ref> | ||
Zan's original patches can still be found in his newcameras branches which allow the user to define the rendering pipeline in preferences.xml: {{gitorious source|proj=fg|repo=zans-flightgear|branch=newcameras|text=FlightGear}}, {{gitorious source|proj=fg|repo=zans-simgear|branch=newcameras|text=SimGear}}. | Zan's original patches can still be found in his newcameras branches which allow the user to define the rendering pipeline in preferences.xml: {{gitorious source|proj=fg|repo=zans-flightgear|branch=newcameras|text=FlightGear}}, {{gitorious source|proj=fg|repo=zans-simgear|branch=newcameras|text=SimGear}}. 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. <ref>{{cite web | ||
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. <ref>{{cite web | |||
|url = https://sourceforge.net/p/flightgear/mailman/message/28944733/ | |url = https://sourceforge.net/p/flightgear/mailman/message/28944733/ | ||
|title = <nowiki> [Flightgear-devel] [Rembrandt] the plan </nowiki> | |title = <nowiki> [Flightgear-devel] [Rembrandt] the plan </nowiki> | ||
Line 78: | Line 65: | ||
== How to enable the Compositor == | == How to enable the Compositor == | ||
The Compositor is now the default renderer framework in FlightGear since 2020/11/17. It will be included as part of version 2020.4 onwards. | |||
If you compile FlightGear from source, you can already try the Compositor. Make sure you are pulling the latest version of the 'next' branch. | |||
If you want to enable shadows on all objects, use these options as startup parameters (in QT GUI or in the commandline) <code>--prop:bool:/sim/rendering/shadows/enabled=true</code> and <code>--prop:int:/sim/rendering/shadows/sun-atlas-size=2048</code>. If you feel like shadows are too low-quality (specially in the cockpit), increase the shadow resolution to 4096 or 8192 instead of 2048. | |||
If you want to enable shadows on all objects | |||
== Notes for aircraft developers == | == Notes for aircraft developers == | ||
Line 193: | Line 175: | ||
== Porting and developing Effects/Shaders == | == Porting and developing Effects/Shaders == | ||
Effects can now have different implementations depending on the Compositor pipeline being used. For example, a grass Effect implemented | Effects can now have different implementations depending on the Compositor pipeline being used. For example, a grass Effect implemented for a high quality pipeline might have much more detail than one that targets low specification machines. Still, they both implement the "look" of grass, so they share the same Effect file (grass.eff). | ||
The Compositor chooses which implementation of an Effect to render based on the <tt><scheme></tt> of the techniques. | The Compositor chooses which implementation of an Effect to render based on the <tt><scheme></tt> of the techniques. | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
<technique n="15"> | <technique n="15"> | ||
<scheme> | <scheme>test-scheme</scheme> | ||
[...] | [...] | ||
</technique> | </technique> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
In this case the technique will be chosen if the Compositor pipeline <tt><scene></tt> pass uses the <tt> | In this case the technique will be chosen if the Compositor pipeline <tt><scene></tt> pass uses the <tt>test-scheme</tt> Effect scheme. Consequently, porting an Effect to a pipeline will require knowing which Effect schemes it uses and writing a technique for each one. The only exception to this is the Classic pipeline, which uses techniques with no scheme. | ||
== Creating a custom rendering pipeline == | == Creating a custom rendering pipeline == | ||
Line 607: | Line 510: | ||
| They specify the depth range of the shadow map | | They specify the depth range of the shadow map | ||
|} | |} | ||
== Known Issues == | == Known Issues == |
edits