Compositor: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 62: Line 62:
* 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.
* 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.
* Static branching support. Every pipeline element can be enabled/disabled at startup via a [[Conditions|<condition> block]].
* Static branching support. Every pipeline element can be enabled/disabled at startup via a [[Conditions|<condition> block]].
* The entire rendering pipeline can be reloaded via an fgcommand (<tt>reload-compositor</tt>).


== How to enable the Compositor ==
== How to enable the Compositor ==
Line 67: Line 68:
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.
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 compile FlightGear from source, you can already try the Compositor. Make sure you are pulling the latest version of the 'next' branch. You can also try out the latest nightly build from the FlightGear build server.
 
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.


== Notes for aircraft developers ==
== Notes for aircraft developers ==
Line 75: Line 74:
=== Lights ===
=== Lights ===


The Compositor introduces a new way of defining lights that is renderer agnostic, so every rendering pipeline will be able to access the lights that have been implemented like this. As of 2019/11, the only pipeline that supports dynamic lights is the ALS pipeline. The resulting light volumes can be visualized for debugging purposes by setting the property <tt>/sim/debug/show-light-volumes</tt> to true.
The Compositor introduces a new way of defining lights that is renderer agnostic, so every rendering pipeline will be able to access the lights that have been implemented like this. The resulting light volumes can be visualized for debugging purposes by setting the property <tt>/sim/debug/show-light-volumes</tt> to true.
 
[[Project Rembrandt]] light definitions are also read by the Compositor for backwards compatibility reasons. However, it is not recommended to use the old syntax for new/updated projects.


{|cellpadding=10|
{|cellpadding=10|
Line 119: Line 120:
   <spot-cutoff>40</spot-cutoff>
   <spot-cutoff>40</spot-cutoff>
   <range-m>50</range-m>
   <range-m>50</range-m>
  <dim-factor>
    <property>controls/lighting/instruments-norm</property>
  </dim-factor>
</light>
</light>
</syntaxhighlight>
</syntaxhighlight>
|valign=top style="width: 80%;"|
|valign=top style="width: 80%;"|
* <tt>'''name'''</tt>. An {{tag|animation}} will be able to reference the light by this name. Most animations will work as expected (rotate, translate, spin etc).
* <tt>'''name'''</tt>. An {{tag|animation}} will be able to reference the light by this name. Most animations will work as expected (rotate, translate, spin etc). Material animations are not supported.
* <tt>'''type'''</tt>. <tt>spot</tt> or <tt>point</tt>.
* <tt>'''type'''</tt>. <tt>spot</tt> or <tt>point</tt>.
* <tt>'''position'''</tt>. The position of the light source in model space and in meters.
* <tt>'''position'''</tt>. The position of the light source in model space and in meters.
Line 155: Line 159:
* <tt>'''spot-cutoff'''</tt>. Only available in <tt>spot</tt> lights. It specifies the maximum spread angle of a light source. Only values in the range 0 90 are accepted. If the angle between the direction of the light and the direction from the light to the fragment being lighted is greater than the spot cutoff angle, it won't be lit.
* <tt>'''spot-cutoff'''</tt>. Only available in <tt>spot</tt> lights. It specifies the maximum spread angle of a light source. Only values in the range 0 90 are accepted. If the angle between the direction of the light and the direction from the light to the fragment being lighted is greater than the spot cutoff angle, it won't be lit.
* <tt>'''spot-exponent'''</tt>. Only available in <tt>spot</tt> lights. Higher spot exponents result in a more focused light source, regardless of the spot cutoff angle.
* <tt>'''spot-exponent'''</tt>. Only available in <tt>spot</tt> lights. Higher spot exponents result in a more focused light source, regardless of the spot cutoff angle.
* <tt>'''dim-factor'''</tt>. Controls the dimming of the light source through an [[Expressions|expression]].
* <tt>'''debug-color'''</tt> ('''Optional'''). Sets the color of the debug light volume. By default it's red.
* <tt>'''debug-color'''</tt> ('''Optional'''). Sets the color of the debug light volume. By default it's red.
|}
|}
Line 160: Line 165:
=== Shadows ===
=== Shadows ===


The shadow mapping algorithm can be customized entirely by the rendering pipeline. This means that each one will have its own requirements when it comes to shadows. Here are some general recommendations:
The shadow mapping algorithm can be customized entirely by the rendering pipeline. This means that each pipeline will have its own requirements when it comes to shadows. Here are some general recommendations:


* Use the <code><noshadow></code> animation to disable shadows on objects that don't need them. An example would be billboarded lights or really small cockpit elements that don't need shadows and would cause degraded performance.
* Use the <code><noshadow></code> animation to disable shadows on objects that don't need them. An example would be billboarded lights (light sprites) or really small cockpit elements that don't need shadows and would cause degraded performance.
* Try to mark as many cockpit objects as possible as <tt>interior</tt>.
* Try to mark as many cockpit objects as possible as <tt>interior</tt>.
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
343

edits

Navigation menu