Hi fellow wiki editors!

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).

I have tried to keep the template short, but meaningful. /Johan G

Difference between revisions of "Project Rembrandt"

From FlightGear wiki
Jump to: navigation, search
Line 23: Line 23:
 
:*Sunlight pass: a second screen aligned quad is drawn and a shader computes the view position of every pixel to compute its diffuse and specular color, using the normal stored in the first stage. The resulting color is blended with the previous pass.
 
:*Sunlight pass: a second screen aligned quad is drawn and a shader computes the view position of every pixel to compute its diffuse and specular color, using the normal stored in the first stage. The resulting color is blended with the previous pass.
 
:*Fog pass: a new screen aligned quad is draw and the position of the pixel is computed to evaluate the amount of fog the pixel has. The forg color is blended with the result of the previous stage.
 
:*Fog pass: a new screen aligned quad is draw and the position of the pixel is computed to evaluate the amount of fog the pixel has. The forg color is blended with the result of the previous stage.
 +
 +
;In the end, the Display Stage, with optional Post-Processing effect :
 +
:The results of the previous buffers are pushed to the main framebuffer to be displayed, optionally modified to show Glow, Motion blur, HDR, redout or blackout, anti-aliasing, etc...
 +
 +
In FG, we end the rendering pipeline by displaying the GUI and the HUD.
 +
 +
All these stage are more precisely described if this [http://bat710.univ-lyon1.fr/~jciehl/Public/educ/GAMA/2007/Deferred_Shading_Tutorial_SBGAMES2005.pdf tutorial] that is the basis of the current code, with some addition and modifications.
 +
 +
== Caveats ==
 +
 +
Deferred rendering is not capable to display transparent. 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.

Revision as of 04:12, 18 December 2011

Why this name ?

Rembrandt was a dutch painter living in 17th century, famous as one of the master of chiaroscuro.

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

What is it

The idea driving the project is to implement 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 difficult to render more sophisticated shading (see the 'Uber-shader') because one have to take into account all aspects of the rendering equation.

Main view with the content of buffers displayed at corners

On the contrary, deferred rendering is about separating operations in simplified stages and collect the intermediary results in hidden buffers that can be used by the next stage.

First stage is the Geometry Stage 
we render all the scene into 4 textures, using multi render targets, to do it in one pass: one for the depth buffer, one for the normals (lower left of the image), one for the diffuse colors (lower right) and one for the specular colors (upper right).
Next stage is the Shadow Stage 
we render the scene again into a depth texture from the point of view of the lights. There will be one texture for every light casting shadows.
Then comes the Lighting Stage, with several substages 
  • Sky and cloud pass: the sky and the clouds are first drawn using classical method.
  • Ambient pass: the diffuse buffer is modulated with the ambient color of the scene and is drawn as a screen-aligned textured quad
  • Sunlight pass: a second screen aligned quad is drawn and a shader computes the view position of every pixel to compute its diffuse and specular color, using the normal stored in the first stage. The resulting color is blended with the previous pass.
  • Fog pass: a new screen aligned quad is draw and the position of the pixel is computed to evaluate the amount of fog the pixel has. The forg color is blended with the result of the previous stage.
In the end, the Display Stage, with optional Post-Processing effect 
The results of the previous buffers are pushed to the main framebuffer to be displayed, optionally modified to show Glow, Motion blur, HDR, redout or blackout, anti-aliasing, etc...

In FG, we end the rendering pipeline by displaying the GUI and the HUD.

All these stage are more precisely described if this tutorial that is the basis of the current code, with some addition and modifications.

Caveats

Deferred rendering is not capable to display transparent. 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.