Project Rembrandt: Difference between revisions

Jump to navigation Jump to search
Uniform table style/class, move references to the "Appendix" and the common location at the bottom of the page.
(Uniform table style/class, move references to the "Appendix" and the common location at the bottom of the page.)
Line 37: Line 37:


== Caveats ==
== 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.
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.


Line 55: Line 54:


=== Rendering of transparent surfaces ===
=== Rendering of transparent surfaces ===
{|
[[Image:project_rembrandt_5.png|thumb|300px|Transparent surfaces drawn after opaque objects]]
|style="vertical-align:top"|Transparent surfaces are detected by OSG loader plugins and their state set receive the TRANSPARENT_BIN rendering hint. In the culling pass, the cull visitor orders transparent surfaces in transparent bin. In a cull callback attached to the Geometry camera, after the scenegraph traversal, the transparent bins are removed from the render stage and saved in a temporary collection. In a cull callback attached to the Lighting camera, after the scenegraph traversal, the transparent bins saved at the previous stage, are added to the render stage of the Lighting camera with a high order num. That way, the transparent surface are drawn on top of the scene lighted from the Gbuffer.
Transparent surfaces are detected by OSG loader plugins and their state set receive the TRANSPARENT_BIN rendering hint. In the culling pass, the cull visitor orders transparent surfaces in transparent bin. In a cull callback attached to the Geometry camera, after the scenegraph traversal, the transparent bins are removed from the render stage and saved in a temporary collection. In a cull callback attached to the Lighting camera, after the scenegraph traversal, the transparent bins saved at the previous stage, are added to the render stage of the Lighting camera with a high order num. That way, the transparent surface are drawn on top of the scene lighted from the Gbuffer.
|[[Image:project_rembrandt_5.png|thumb|300px|Transparent surfaces drawn after opaque objects]]
|}


=== Memory consumption ===
=== Memory consumption ===
For each camera defined in the camera group, there is a separate shadow map, so the video memory usage is :
For each camera defined in the camera group, there is a separate shadow map, so the video memory usage is :
*G-buffer and Lighting buffer: 20 bytes per pixel. For an HD screen (1920x1080) memory requirement is 40 Mb
* G-buffer and Lighting buffer: 20 bytes per pixel. For an HD screen (1920x1080) memory requirement is 40 Mb
*Shadow map: 3 x shadow_map_size x shadow_map_size bytes (if size is 8192, whole map size is 192 Mb
* Shadow map: 3 x shadow_map_size x shadow_map_size bytes (if size is 8192, whole map size is 192 Mb
Not counting textures, display list or vertex buffers for models and terrain
Not counting textures, display list or vertex buffers for models and terrain


3 HD screens require 120 Mb of memory for the buffers (shadow excluded), you're asking 3x8192x8192x3 = 576 Mb (megabytes) of memory for the shadows alone.
3 HD screens require 120 Mb of memory for the buffers (shadow excluded), you're asking 3x8192x8192x3 = 576 Mb (megabytes) of memory for the shadows alone.


If you are seeing error messages during startup or FlightGear doesn't start up properly, it's probably because you don't have enough free video memory. Reduce the size of the shadow map in preferences.xml by locating  
If you are seeing error messages during startup or FlightGear doesn't start up properly, it's probably because you don't have enough free video memory. Reduce the size of the shadow map in preferences.xml by locating  
Line 84: Line 79:
=== Predefined uniforms ===
=== Predefined uniforms ===
These glsl uniforms don't need to be declared in the effect file.
These glsl uniforms don't need to be declared in the effect file.
{|border="1" cellspacing="0" cellpadding="3"
{| class="wikitable"
!Name
!Name
!Type
!Type
Line 146: Line 141:
The Geometry Stage is there to fill the G-buffer. '''Shading doesn't occur at this stage, so light or fog computation should not be part of the shader'''. The required operation in the Fragment Shader is to fill every individual buffer with sensible value :
The Geometry Stage is there to fill the G-buffer. '''Shading doesn't occur at this stage, so light or fog computation should not be part of the shader'''. The required operation in the Fragment Shader is to fill every individual buffer with sensible value :


{| class="wikitable" style="text-align: center;"
{| class="wikitable" style="text-align: center;"
|depth (gl_FragDepth)||GL_DEPTH_COMPONENT32||colspan="4"|Fragment depth
|depth (gl_FragDepth)||GL_DEPTH_COMPONENT32||colspan="4"|Fragment depth
|-
|-
Line 181: Line 176:
=== Required Effects ===
=== Required Effects ===
Several pass are implemented using the effect system. For this purpose, some effects are referenced in the core code using reserved names. these effects are:
Several pass are implemented using the effect system. For this purpose, some effects are referenced in the core code using reserved names. these effects are:
{|border="1" cellspacing="0" cellpadding="3"
{| class="wikitable" cellpadding="3"
!Name
!Name
!Kind
!Kind
Line 284: Line 279:
</syntaxhighlight>
</syntaxhighlight>
|valign=top|
|valign=top|
{|border="1" cellspacing="0" cellpadding="3"
{| class="wikitable" cellpadding="3"
!Name
!Name
!Purpose
!Purpose
Line 375: Line 370:
</syntaxhighlight>
</syntaxhighlight>
|valign=top|
|valign=top|
{|border="1" cellspacing="0" cellpadding="3"
{| class="wikitable" cellpadding="3"
!Name
!Name
!Purpose
!Purpose
Line 414: Line 409:
|}
|}
|}
|}
== References ==
* {{cite web |url=http://http.download.nvidia.com/developer/presentations/2004/6800_Leagues/6800_Leagues_Deferred_Shading.pdf |title=Deferred Shading |author=Shawn Hargreaves and Mark Harris }}
* {{cite web |url=http://bat710.univ-lyon1.fr/~jciehl/Public/educ/GAMA/2007/Deferred_Shading_Tutorial_SBGAMES2005.pdf |title=Deferred Shading Tutorial |author=Fabio Policarpo and Francisco Fonseca }}
* {{cite web |url=http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf |title=Deferred Rendering in Killzone 2 |author=Michal Valient |month=July |year=2007 }}
* {{cite web |url=http://www.anandtech.com/show/5011/nvidiaea-posts-battlefield-3-graphics-tech-talk |title=Battlefield 3 Graphics Tech Talk |author=Johan Andersson |month=October |year=2011 }}
* {{cite web |url=http://www.disney.co.uk/cms_res/blackrockstudio/pdf/Rendering_Techniques_in_SplitSecond.pdf |title=Rendering Techniques in Split/Second |author=Jeremy Moore and David Jefferies |year=2009 }}
* {{cite web |url=http://www.crytek.com/sites/default/files/A_bit_more_deferred_-_CryEngine3.ppt |title="A bit more Deferred" - CryEngine 3 (PPT) |author=Martin Mittring }}
* {{cite web |url=http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter09.html |title=Deferred Shading in S.T.A.L.K.E.R. |author=Oles Shishkovtsov }}
* {{cite web |url=http://http.developer.nvidia.com/GPUGems3/gpugems3_ch19.html |title=Deferred Shading in Tabula Rasa |author=Rusty Koonce }}


== Initial TODO List ==
== Initial TODO List ==
Line 477: Line 462:
;model-transparent
;model-transparent
:new effect to classify transparent surfaces (those that are not bound to the glass shader or other shader that use explicitly the transparent bin )
:new effect to classify transparent surfaces (those that are not bound to the glass shader or other shader that use explicitly the transparent bin )
{{Appendix|all|
* {{cite web |url=http://http.download.nvidia.com/developer/presentations/2004/6800_Leagues/6800_Leagues_Deferred_Shading.pdf |title=Deferred Shading |author=Shawn Hargreaves and Mark Harris }}
* {{cite web |url=http://bat710.univ-lyon1.fr/~jciehl/Public/educ/GAMA/2007/Deferred_Shading_Tutorial_SBGAMES2005.pdf |title=Deferred Shading Tutorial |author=Fabio Policarpo and Francisco Fonseca }}
* {{cite web |url=http://www.guerrilla-games.com/publications/dr_kz2_rsx_dev07.pdf |title=Deferred Rendering in Killzone 2 |author=Michal Valient |month=July |year=2007 }}
* {{cite web |url=http://www.anandtech.com/show/5011/nvidiaea-posts-battlefield-3-graphics-tech-talk |title=Battlefield 3 Graphics Tech Talk |author=Johan Andersson |month=October |year=2011 }}
* {{cite web |url=http://www.disney.co.uk/cms_res/blackrockstudio/pdf/Rendering_Techniques_in_SplitSecond.pdf |title=Rendering Techniques in Split/Second |author=Jeremy Moore and David Jefferies |year=2009 }}
* {{cite web |url=http://www.crytek.com/sites/default/files/A_bit_more_deferred_-_CryEngine3.ppt |title="A bit more Deferred" - CryEngine 3 (PPT) |author=Martin Mittring }}
* {{cite web |url=http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter09.html |title=Deferred Shading in S.T.A.L.K.E.R. |author=Oles Shishkovtsov }}
* {{cite web |url=http://http.developer.nvidia.com/GPUGems3/gpugems3_ch19.html |title=Deferred Shading in Tabula Rasa |author=Rusty Koonce }}
}}


[[Category:Shader development]]
[[Category:Shader development]]
[[Category:Core development projects]]
[[Category:Core development projects]]

Navigation menu