HDR Pipeline
The FlightGear forum has a subforum related to: Effects & Shaders |
Started in | 04/2021 |
---|---|
Description | A modern rendering pipeline that targets relatively powerful systems |
Contributor(s) | Fernando García Liñán [1] |
Status | In development |
Folders | |
Changelog | https://sourceforge.net/u/fgarlin/profile/feed.rss |
Rendering |
---|
Rendering Pipeline |
Effects and Shaders |
Ongoing Efforts |
Standalone Tools |
IPC/Networking |
The HDR Pipeline is a Compositor-based rendering pipeline that attempts to bring modern rendering techniques to FlightGear, namely high dynamic range (HDR) and physically based rendering (PBR) . It is implemented entirely in $FG_ROOT using XML for the Compositor pipeline definition and Effects, and GLSL for shaders and is only available on 'next' branch or nightly builds (2020.4). The pipeline can be enabled with the command line argument --compositor=Compositor/HDR/hdr
.
Background
The Classic Pipeline relies on legacy OpenGL features, so rather than improving or reworking it, the idea of creating an entirely separate rendering pipeline from scratch started taking shape. The Compositor played the biggest role in enabling this effort as it allows the creation of new rendering pipelines entirely in FGData space without any C++ changes whatsoever, greatly reducing the amount of work that had to be done and making the iterative process of testing and debugging much faster.
Status
Last updated: 11/2023
The HDR pipeline is more or less stable, and is currently available on next for anyone adventurous enough to try it. Version 2024.1 will not support HDR.
Keep in mind that the HDR pipeline might not work in your system until we finish moving to the OpenGL core profile. AMD graphics cards (regardless of age) and Intel integrated GPUs are known to be problematic.
Notes for aircraft developers
The HDR pipeline handles lighting in a completely different manner compared to ALS. The pipeline will attempt to "translate" classic Effects so they display correctly by making some assumptions. These assumptions are not always correct, so your aircraft might not display correctly under the HDR pipeline. In this section we describe some steps you can follow to leverage all the power of the HDR pipeline.
PBR and glTF
Physically-based rendering (PBR) refers to the concept of using realistic shading/lighting models along with measured surface values to accurately represent real-world materials. See this webpage for an extensive introduction to PBR and how you can create physically-based assets for your aircraft.
This pipeline introduces a PBR Effect (fgdata/Effects/model-pbr.eff). However, you don't need to assign this Effect manually. You can export your model from Blender to the glTF format and use it directly. The Blender exporter will take care of exporting the necessary textures and the FlightGear parser will automatically assign the PBR Effect to your model. Your model XML file would contain something like this:
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<path>my-aircraft.gltf</path>
[...]
</PropertyList>
Although not recommended, the PBR effect can be assigned as usual by adding an <effect> tag in the model XML and configuring it like you would configure model-combined.
Lights
Lights are defined using the Compositor syntax. However, since we are dealing with physically-based values, the ambient/diffuse/specular values are ignored and the color and intensity parameters are used instead. The attenuation parameter is also ignored.
It is possible to have a light definition that is compatible with both ALS and HDR by defining all parameters at the same time. This might be troublesome though because the same values might yield different results under each pipeline.
An example light definition is shown below:
<light>
<name>my-spotlight</name>
<type>spot</type>
<position>
<x-m>-7.7476</x-m>
<y-m>0</y-m>
<z-m>-1.7990</z-m>
</position>
<direction>
<x>-1.0</x>
<y>0</y>
<z>-0.013</z>
</direction>
<color>
<r>1.0</r>
<g>0.0</g>
<b>0.0</b>
</color>
<intensity>10</intensity>
<spot-exponent>5</spot-exponent>
<spot-cutoff>40</spot-cutoff>
<range-m>50</range-m>
</light>
References
References |