Project Rembrandt: Difference between revisions

Jump to navigation Jump to search
m
m (→‎Status (07/2014): obsolete due to Compositor)
(15 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<!-- {{WIP}} -->
== Why the name? ==
== Why this name ? ==
{{Wikipedia|Rembrandt}} was a dutch painter living in the 17th century, famous as one of the master of {{Wikipedia|chiaroscuro}}.
[http://en.wikipedia.org/wiki/Rembrandt Rembrandt] was a dutch painter living in the 17th century, famous as one of the master of [http://en.wikipedia.org/wiki/Chiaroscuro chiaroscuro].


This project is about changing the way [[FlightGear]] renders lights, [[shadows]] and shades, and aims at making Rembrandt painting style possible in FG.
This project is about changing the way [[FlightGear]] renders lights, [[shadows]] and shades, and aims at making Rembrandt painting style possible in FG.
Line 8: Line 7:


== What is it ? ==
== What is it ? ==
{{FGCquote
  |Deferred {{=}} rendering a geometry pass into the geometry (g-)buffer which holds positions, normals, materials, then doing all operations (texel, light, ...) in fragment passes on that buffer (or any others).<br/>
<br/>
Forward {{=}} (usually) rendering part of the shading (typically ambient and diffuse light) per vertex, extrapolate all quantities  which are declared as varying across triangles and hand them via rasterizer to the fragment shader which does the rest
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=221222#p221222
    |title=<nowiki>Re: Orbital Makes the Sky Black</nowiki>
    |author=<nowiki>Thorsten</nowiki>
    |date=<nowiki>Sun Oct 19</nowiki>
  }}
}}
The idea driving the project is to implement [http://en.wikipedia.org/wiki/Deferred_shading deferred rendering] inside FlightGear.
The idea driving the project is to implement [http://en.wikipedia.org/wiki/Deferred_shading deferred rendering] inside FlightGear.
From the beginning FlightGear had a forward renderer that tries to render all properties of an object in one pass (shading, lighting, fog, ...), making it difficult to render more sophisticated shading  
From the beginning FlightGear had a forward renderer that tries to render all properties of an object in one pass (shading, lighting, fog, ...), making it difficult to render more sophisticated shading  
Line 45: Line 55:


== Caveats ==
== Caveats ==
Deferred rendering is not able to display transparency. For the moment, clouds are renderer separately and should be lit and shaded by their own. Transparent surfaces are alpha-tested and not blended. They would have to be drawn in their own bin over the composited image.
Deferred rendering is not able to display transparency. For the moment, clouds are rendered separately and should be lit and shaded by their own. Transparent surfaces are alpha-tested and not blended. They would have to be drawn in their own bin over the composited image.


It also don't fit with depth partitioning because the depth buffer should be kept to retain the view space position, so for the moment, z-fighting is quite visible. Depth partitioning with non overlapping depth range might be the solution and should be experimented at one point.
It also doesn't fit with depth partitioning because the depth buffer should be kept to retain the view space position, so for the moment, z-fighting is quite visible. Depth partitioning with non overlapping depth range might be the solution and should be experimented at one point.


The glow pass can make certain MFD (that use emissive color) unreadable because blurred. Should be treated as transparent.
The glow pass can make certain MFDs (that use emissive color) unreadable because of blurring. Should be treated as transparent.


== Implementation ==
== Implementation ==
Line 70: Line 80:


<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
<map-size type="int">8192</map-size>
<map-size type="int">8192</map-size>
</syntaxhighlight>
</syntaxhighlight>


And put 4096 or 2048 instead.
And put 4096 or 2048 instead.
You can also use a startup parameter: --prop:/sim/rendering/shadows/map-size=2048
You can also use a startup parameter <code>--prop:/sim/rendering/shadows/map-size=2048</code>


=== Configurable pipeline ===
=== Configurable pipeline ===
The Rembrandt renderer uses an XML file to setup its pipeline for each viewport described in the camera group. This file describes the way the intermediary buffers are setup and how the different rendering stages are sequenced. The general outline of a pipeline file is as follow :
The Rembrandt renderer uses an XML file to setup its pipeline for each viewport described in the camera group. This file describes the way the intermediary buffers are setup and how the different rendering stages are sequenced. The general outline of a pipeline file is as follow :


Line 230: Line 239:


Each effect attached to the fullscreen passes define the way blending is done between the pass and the previous accumulation of render.
Each effect attached to the fullscreen passes define the way blending is done between the pass and the previous accumulation of render.
=== C++ implementation ===
On the C++ side, Rembrandt is set up in those steps:
* ''buildRenderingPipeline()'' is the last common function between forward rendering and deferred rendering. That's the point of start for specific deferred stuff. In this function we call  ''buildDeferredPipeline()''
** ''buildDeferredPipeline()'' is just a wrapper for ''buildCameraFromRenderingPipeline()''
*** ''buildCameraFromRenderingPipeline()'' is where we initialize all buffers and create all the stages found in ''Effects/default-pipeline.xml'' with the call to ''buildBuffers()'' and ''buildStage()''
**** ''buildBuffers()'' is where we ask to build each buffer with the call to ''buildDeferredBuffer()''
***** ''buildDeferredBuffer()'' create a 2D texture
**** ''buildStage()'' is where we ask to build each camera depending on the type of the stage (geometry, lighting, shadow, fullscreen, display) with the call to ''buildDeferred*Camera()'' (where * is the stage type)
***** ''buildDeferred*Camera()''is where we build the camera, for each camera we attach the required buffers with the call to ''buildAttachments()''.
****** ''buildDeferredGeometryCamera()'' c.f [http://wiki.flightgear.org/Project_Rembrandt#What_is_it_.3F What is it ?]
****** ''buildDeferredShadowCamera()'' c.f [http://wiki.flightgear.org/Project_Rembrandt#What_is_it_.3F What is it ?]
****** ''buildDeferredLightingCamera()'' Only for the lighting camera (''buildDeferredLightingCamera()'') we have to build passes who is called with ''buildPass()'' c.f [http://wiki.flightgear.org/Project_Rembrandt#What_is_it_.3F What is it ?]
****** ''buildDeferredFullscreenCamera()'' c.f [http://wiki.flightgear.org/Project_Rembrandt#What_is_it_.3F What is it ?]
****** ''buildDeferredDisplayCamera()'' c.f [http://wiki.flightgear.org/Project_Rembrandt#What_is_it_.3F What is it ?]


== Running Flightgear with Rembrandt ==
== Running Flightgear with Rembrandt ==
Line 537: Line 564:


If opaque surface need to have special effect, for example to apply bump mapping, this effect should use the "RenderBin" bin, or the rendering hint set to "opaque", and the G-buffer needs to be initialized correctly in the Geometry stage.
If opaque surface need to have special effect, for example to apply bump mapping, this effect should use the "RenderBin" bin, or the rendering hint set to "opaque", and the G-buffer needs to be initialized correctly in the Geometry stage.
A surface that uses the [[ALS technical notes#ALS glass effect|ALS glass effect]] does not need to be separately registered for Rembrandt, this is done automatically.


=== Making sure that all geometry will cast shadow ===
=== Making sure that all geometry will cast shadow ===
Line 654: Line 683:
|-
|-
|<tt>attenuation</tt>
|<tt>attenuation</tt>
|Three element vector. <c> element is the constant factor, <l> element is the linear factor and <q> element is the quadratic factor.<br />
|Three element vector. <c> element is the constant factor, <l> element is the linear factor and &lt;q&gt; element is the quadratic factor.<br />
Attenuation of color at distance d is [[File:Spotlight_attenuation.png]]
Attenuation of color at distance d is [[File:Spotlight_attenuation.png]]
|-
|-
Line 954: Line 983:
* {{cite web |url=http://advances.realtimerendering.com/s2012/Epic/The%20Technology%20Behind%20the%20Elemental%20Demo%2016x9.pptx |author=Martin Mittring |title=The Technology behind the Unreal Engine 4 Elemental Demo |accessdate=15 September 2012 }}
* {{cite web |url=http://advances.realtimerendering.com/s2012/Epic/The%20Technology%20Behind%20the%20Elemental%20Demo%2016x9.pptx |author=Martin Mittring |title=The Technology behind the Unreal Engine 4 Elemental Demo |accessdate=15 September 2012 }}
}}
}}
<references/>


[[Category:Shader development]]
[[Category:Shader development]]
[[Category:Core development projects]]
[[Category:Core development projects]]
[[fr:Projet Rembrandt]]
[[fr:Projet Rembrandt]]

Navigation menu