1
0
Fork 0
fgdata/Compositor/HDR/hdr.xml
Fernando García Liñán 9f39644199 HDR: Optimize the G-Buffer and do not separate the occlusion texture
- The G-Buffer layout has been redesigned to be 96 bits per pixel. There are 24
unused bits that can be used for extra material parameters later (like
clearcoat).
- Add better debug views for the G-Buffer.
- Use octahedron normal encoding. This yields the same results as the previous
method but uses 16 bits less.
- Use rg11fb10f for the environment mapping cubemaps.
- Tweak the shadow mapping parameters and add a colored debug mode.
- Only render shadow maps for objects that inherit from model-default.eff or
model-pbr.eff instead of having a fallback Effect. Now transparent objects
should be ignored (if they are marked as such with model-transparent or
similar).
- Remove the separate occlusion texture. Now the PBR Effect expects a single
texture where R=occlusion, G=roughness and B=metallic.
2021-08-27 00:03:43 +02:00

1316 lines
35 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>HDR</name>
<!-- XXX: These won't be necessary once we go core profile only -->
<use-osg-uniforms>true</use-osg-uniforms>
<use-vertex-attribute-aliasing>true</use-vertex-attribute-aliasing>
<!--
G-Buffer layout
..........................................................................
: : Red : Green : Blue : Alpha :
:.......................:...........:.........:............:.............:
: G-Buffer 0 (RGB10_A2) : Normal : Roughness : Material ID :
: G-Buffer 1 (RGBA8) : Base Color : Metallic :
: G-Buffer 2 (RGBA8) : Material specific params : Occlusion :
: Depth/Stencil : DEPTH32F_STENCIL8 (Reversed depth) :
:.......................:............:.........:...........:.............:
Notes:
- Two 10-bit channels is enough for normals, as long as we are using
octahedron normal encoding.
- Since the Material ID is stored in 2 bits, we can only have 4 different
material types. The maximum value (3 or 1.0) is reserved for the standard
PBR metallic-roughness material.
- In 'Material specific params' fancier materials can use up to 24 bits
to encode any information they might need (e.g. a clearcoat layer needs
to store the clearcoat amount and roughness).
- Materials that are very different from the standard should write
whatever they need in the G-Buffer without adhering to this layout and use
the stencil buffer and a separate render pass.
-->
<buffer>
<name>gbuffer0</name>
<type>2d</type>
<width>screen</width>
<height>screen</height>
<format>rgb10-a2</format>
</buffer>
<buffer>
<name>gbuffer1</name>
<type>2d</type>
<width>screen</width>
<height>screen</height>
<format>rgba8</format>
</buffer>
<buffer>
<name>gbuffer2</name>
<type>2d</type>
<width>screen</width>
<height>screen</height>
<format>rgba8</format>
</buffer>
<buffer>
<name>depth-stencil</name>
<type>2d</type>
<width>screen</width>
<height>screen</height>
<format>depth32f-stencil</format>
</buffer>
<!-- HDR lighting result -->
<buffer>
<name>hdr-result</name>
<type>2d</type>
<width>screen</width>
<height>screen</height>
<format>rgb16f</format>
</buffer>
<!-- Final LDR buffer -->
<buffer>
<name>final</name>
<type>2d</type>
<width>screen</width>
<height>screen</height>
<format>rgb8</format>
</buffer>
<!-- Atmosphere LUTs -->
<buffer>
<name>transmittance</name>
<type>2d</type>
<width>256</width>
<height>64</height>
<format>rgb16f</format>
<min-filter>linear</min-filter>
<mag-filter>linear</mag-filter>
<wrap-s>clamp-to-edge</wrap-s>
<wrap-t>clamp-to-edge</wrap-t>
</buffer>
<buffer>
<name>multiple-scattering</name>
<type>2d</type>
<width>32</width>
<height>32</height>
<format>rgb16f</format>
<min-filter>linear</min-filter>
<mag-filter>linear</mag-filter>
<wrap-s>clamp-to-edge</wrap-s>
<wrap-t>clamp-to-edge</wrap-t>
</buffer>
<buffer>
<name>sky-view</name>
<type>2d</type>
<width>256</width>
<height>128</height>
<format>rgb16f</format>
<min-filter>linear</min-filter>
<mag-filter>linear</mag-filter>
<wrap-s>repeat</wrap-s>
<wrap-t>clamp-to-edge</wrap-t>
</buffer>
<buffer>
<name>aerial-perspective</name>
<type>2d</type>
<width>1024</width>
<height>32</height>
<format>rgba16f</format>
<min-filter>linear</min-filter>
<mag-filter>linear</mag-filter>
<wrap-s>clamp-to-edge</wrap-s>
<wrap-t>clamp-to-edge</wrap-t>
</buffer>
<!-- Environment cubemap -->
<buffer>
<name>envmap</name>
<type>cubemap</type>
<width>128</width>
<height>128</height>
<format>r11f-g11f-b10f</format>
<min-filter>linear-mipmap-linear</min-filter>
<mag-filter>linear</mag-filter>
<wrap-s>clamp-to-edge</wrap-s>
<wrap-t>clamp-to-edge</wrap-t>
<mipmap-levels>5</mipmap-levels>
</buffer>
<buffer>
<name>prefiltered-envmap</name>
<type>cubemap</type>
<width>128</width>
<height>128</height>
<format>r11f-g11f-b10f</format>
<min-filter>linear-mipmap-linear</min-filter>
<mag-filter>linear</mag-filter>
<wrap-s>clamp-to-edge</wrap-s>
<wrap-t>clamp-to-edge</wrap-t>
<mipmap-levels>5</mipmap-levels>
</buffer>
<!-- Shadow map atlas -->
<buffer>
<name>sun-shadowmap-atlas</name>
<type>2d</type>
<width>8192</width>
<height>8192</height>
<format>depth16</format>
<wrap-s>clamp-to-border</wrap-s>
<wrap-t>clamp-to-border</wrap-t>
<min-filter>linear</min-filter>
<mag-filter>linear</mag-filter>
<border-color type="vec4d">1.0 1.0 1.0 1.0</border-color>
<shadow-comparison>true</shadow-comparison>
</buffer>
<!-- Average luminance -->
<buffer>
<name>luminance</name>
<type>2d</type>
<width>1024</width>
<height>1024</height>
<format>r32f</format>
<min-filter>linear-mipmap-nearest</min-filter>
<mag-filter>nearest</mag-filter>
<mipmap-levels>10</mipmap-levels>
</buffer>
<buffer>
<name>prev-luminance</name>
<type>2d</type>
<width>1</width>
<height>1</height>
<format>r32f</format>
<min-filter>nearest</min-filter>
<mag-filter>nearest</mag-filter>
</buffer>
<buffer>
<name>adapted-luminance</name>
<type>2d</type>
<width>1</width>
<height>1</height>
<format>r32f</format>
<min-filter>nearest</min-filter>
<mag-filter>nearest</mag-filter>
</buffer>
<!-- SSAO -->
<buffer>
<name>ao0</name>
<type>2d</type>
<width>screen</width>
<height>screen</height>
<screen-width-scale>0.5</screen-width-scale>
<screen-height-scale>0.5</screen-height-scale>
<format>r8</format>
</buffer>
<!-- Bloom buffers -->
<buffer include="bloom-buffer.xml">
<name>bloom0</name>
<screen-width-scale>0.5</screen-width-scale>
<screen-height-scale>0.5</screen-height-scale>
</buffer>
<buffer include="bloom-buffer.xml">
<name>bloom1</name>
<screen-width-scale>0.25</screen-width-scale>
<screen-height-scale>0.25</screen-height-scale>
</buffer>
<buffer include="bloom-buffer.xml">
<name>bloom2</name>
<screen-width-scale>0.125</screen-width-scale>
<screen-height-scale>0.125</screen-height-scale>
</buffer>
<buffer include="bloom-buffer.xml">
<name>bloom3</name>
<screen-width-scale>0.0625</screen-width-scale>
<screen-height-scale>0.0625</screen-height-scale>
</buffer>
<buffer include="bloom-buffer.xml">
<name>bloom0-tmp</name>
<screen-width-scale>0.5</screen-width-scale>
<screen-height-scale>0.5</screen-height-scale>
</buffer>
<buffer include="bloom-buffer.xml">
<name>bloom1-tmp</name>
<screen-width-scale>0.25</screen-width-scale>
<screen-height-scale>0.25</screen-height-scale>
</buffer>
<buffer include="bloom-buffer.xml">
<name>bloom2-tmp</name>
<screen-width-scale>0.125</screen-width-scale>
<screen-height-scale>0.125</screen-height-scale>
</buffer>
<buffer include="bloom-buffer.xml">
<name>bloom3-tmp</name>
<screen-width-scale>0.0625</screen-width-scale>
<screen-height-scale>0.0625</screen-height-scale>
</buffer>
<!-- SMAA buffers -->
<buffer>
<name>smaa-edges</name>
<type>2d</type>
<width>screen</width>
<height>screen</height>
<format>rgba8</format>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
<min-filter>linear-mipmap-linear</min-filter>
<mag-filter>linear</mag-filter>
</buffer>
<buffer>
<name>smaa-blend</name>
<type>2d</type>
<width>screen</width>
<height>screen</height>
<format>rgba8</format>
<wrap-s>clamp</wrap-s>
<wrap-t>clamp</wrap-t>
<min-filter>linear-mipmap-linear</min-filter>
<mag-filter>linear</mag-filter>
</buffer>
<!--=======================================================================-->
<!--
Clear the G-Buffer if we are debugging it to avoid the dreaded
'Solitaire Effect' :)
-->
<pass>
<name>debug-clear-gbuffer</name>
<type>quad</type>
<effect>Effects/HDR/gbuffer-debug-clear</effect>
<condition>
<property>/sim/rendering/hdr/debug/show-gbuffer</property>
</condition>
<attachment>
<component>color0</component>
<buffer>gbuffer0</buffer>
</attachment>
<attachment>
<component>color1</component>
<buffer>gbuffer1</buffer>
</attachment>
<attachment>
<component>color2</component>
<buffer>gbuffer2</buffer>
</attachment>
</pass>
<!--
Generate the atmospheric scattering related LUTs
This is an implementation of Sébastien Hillaire's "A Scalable and
Production Ready Sky and Atmosphere Rendering Technique".
As a small summary, the sky-view and aerial perspective LUTs are used by
later passes to apply atmospheric scattering to the skydome and
opaque/transparent objects respectively. These two LUTs also rely on
another pair of LUTs (transmittance and multiple scattering) to speed up
the computations.
-->
<pass>
<name>atmos-transmittance</name>
<type>quad</type>
<effect>Effects/HDR/atmos-transmittance</effect>
<attachment>
<component>color0</component>
<buffer>transmittance</buffer>
</attachment>
</pass>
<pass>
<name>atmos-multiple-scattering</name>
<type>quad</type>
<effect>Effects/HDR/atmos-multiple-scattering</effect>
<binding>
<unit>0</unit>
<buffer>transmittance</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>multiple-scattering</buffer>
</attachment>
</pass>
<pass>
<name>atmos-sky-view</name>
<type>quad</type>
<effect>Effects/HDR/atmos-sky-view</effect>
<binding>
<unit>0</unit>
<buffer>transmittance</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>multiple-scattering</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>sky-view</buffer>
</attachment>
</pass>
<pass>
<name>atmos-aerial-perspective</name>
<type>quad</type>
<effect>Effects/HDR/atmos-aerial-perspective</effect>
<binding>
<unit>0</unit>
<buffer>transmittance</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>multiple-scattering</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>aerial-perspective</buffer>
</attachment>
</pass>
<!--
Environment capture passes
Render to a cubemap using forward rendering. Only render the skydome and
very bare terrain since we want to make as little draw calls as possible.
We also want to avoid doing an OSG cull traversal on many nodes as our
scene graph structure isn't too well optimized.
-->
<pass include="env-capture-pass.xml">
<name>env-capture0</name>
<cubemap-face>0</cubemap-face>
<attachment>
<component>color0</component>
<buffer>envmap</buffer>
<face>0</face>
</attachment>
</pass>
<pass include="env-capture-pass.xml">
<name>env-capture1</name>
<cubemap-face>1</cubemap-face>
<attachment>
<component>color0</component>
<buffer>envmap</buffer>
<face>1</face>
</attachment>
</pass>
<pass include="env-capture-pass.xml">
<name>env-capture2</name>
<cubemap-face>2</cubemap-face>
<attachment>
<component>color0</component>
<buffer>envmap</buffer>
<face>2</face>
</attachment>
</pass>
<pass include="env-capture-pass.xml">
<name>env-capture3</name>
<cubemap-face>3</cubemap-face>
<attachment>
<component>color0</component>
<buffer>envmap</buffer>
<face>3</face>
</attachment>
</pass>
<pass include="env-capture-pass.xml">
<name>env-capture4</name>
<cubemap-face>4</cubemap-face>
<attachment>
<component>color0</component>
<buffer>envmap</buffer>
<face>4</face>
</attachment>
</pass>
<pass include="env-capture-pass.xml">
<name>env-capture5</name>
<cubemap-face>5</cubemap-face>
<attachment>
<component>color0</component>
<buffer>envmap</buffer>
<face>5</face>
<!-- Generate the mips after writing to the last face -->
<mipmap-generation>true</mipmap-generation>
</attachment>
</pass>
<!--
Pre-filter the environment map
We convolve the cubemap for five roughness values and store the results
on the mipmap levels of the cubemap. Later passes will choose which mipmap
level to use for reflections based on the roughness of the surface that's
being lighted/rendered. The first mipmap level can just be copied from the
original envmap as we'd like it to contain perfect mirror reflections.
Diffuse lighting is approximated by using the highest mipmap level
(roughness=1).
-->
<pass include="env-prefilter-pass.xml">
<name>env-prefilter0</name>
<effect>Effects/HDR/envmap-copy</effect>
<attachment>
<component>color0</component>
<buffer>prefiltered-envmap</buffer>
<face>0</face>
<level>0</level>
</attachment>
<attachment>
<component>color1</component>
<buffer>prefiltered-envmap</buffer>
<face>1</face>
<level>0</level>
</attachment>
<attachment>
<component>color2</component>
<buffer>prefiltered-envmap</buffer>
<face>2</face>
<level>0</level>
</attachment>
<attachment>
<component>color3</component>
<buffer>prefiltered-envmap</buffer>
<face>3</face>
<level>0</level>
</attachment>
<attachment>
<component>color4</component>
<buffer>prefiltered-envmap</buffer>
<face>4</face>
<level>0</level>
</attachment>
<attachment>
<component>color5</component>
<buffer>prefiltered-envmap</buffer>
<face>5</face>
<level>0</level>
</attachment>
</pass>
<pass include="env-prefilter-pass.xml">
<name>env-prefilter1</name>
<effect>Effects/HDR/envmap-prefilter1</effect>
<attachment>
<component>color0</component>
<buffer>prefiltered-envmap</buffer>
<face>0</face>
<level>1</level>
</attachment>
<attachment>
<component>color1</component>
<buffer>prefiltered-envmap</buffer>
<face>1</face>
<level>1</level>
</attachment>
<attachment>
<component>color2</component>
<buffer>prefiltered-envmap</buffer>
<face>2</face>
<level>1</level>
</attachment>
<attachment>
<component>color3</component>
<buffer>prefiltered-envmap</buffer>
<face>3</face>
<level>1</level>
</attachment>
<attachment>
<component>color4</component>
<buffer>prefiltered-envmap</buffer>
<face>4</face>
<level>1</level>
</attachment>
<attachment>
<component>color5</component>
<buffer>prefiltered-envmap</buffer>
<face>5</face>
<level>1</level>
</attachment>
</pass>
<pass include="env-prefilter-pass.xml">
<name>env-prefilter2</name>
<effect>Effects/HDR/envmap-prefilter2</effect>
<attachment>
<component>color0</component>
<buffer>prefiltered-envmap</buffer>
<face>0</face>
<level>2</level>
</attachment>
<attachment>
<component>color1</component>
<buffer>prefiltered-envmap</buffer>
<face>1</face>
<level>2</level>
</attachment>
<attachment>
<component>color2</component>
<buffer>prefiltered-envmap</buffer>
<face>2</face>
<level>2</level>
</attachment>
<attachment>
<component>color3</component>
<buffer>prefiltered-envmap</buffer>
<face>3</face>
<level>2</level>
</attachment>
<attachment>
<component>color4</component>
<buffer>prefiltered-envmap</buffer>
<face>4</face>
<level>2</level>
</attachment>
<attachment>
<component>color5</component>
<buffer>prefiltered-envmap</buffer>
<face>5</face>
<level>2</level>
</attachment>
</pass>
<pass include="env-prefilter-pass.xml">
<name>env-prefilter3</name>
<effect>Effects/HDR/envmap-prefilter3</effect>
<attachment>
<component>color0</component>
<buffer>prefiltered-envmap</buffer>
<face>0</face>
<level>3</level>
</attachment>
<attachment>
<component>color1</component>
<buffer>prefiltered-envmap</buffer>
<face>1</face>
<level>3</level>
</attachment>
<attachment>
<component>color2</component>
<buffer>prefiltered-envmap</buffer>
<face>2</face>
<level>3</level>
</attachment>
<attachment>
<component>color3</component>
<buffer>prefiltered-envmap</buffer>
<face>3</face>
<level>3</level>
</attachment>
<attachment>
<component>color4</component>
<buffer>prefiltered-envmap</buffer>
<face>4</face>
<level>3</level>
</attachment>
<attachment>
<component>color5</component>
<buffer>prefiltered-envmap</buffer>
<face>5</face>
<level>3</level>
</attachment>
</pass>
<pass include="env-prefilter-pass.xml">
<name>env-prefilter4</name>
<effect>Effects/HDR/envmap-prefilter4</effect>
<attachment>
<component>color0</component>
<buffer>prefiltered-envmap</buffer>
<face>0</face>
<level>4</level>
</attachment>
<attachment>
<component>color1</component>
<buffer>prefiltered-envmap</buffer>
<face>1</face>
<level>4</level>
</attachment>
<attachment>
<component>color2</component>
<buffer>prefiltered-envmap</buffer>
<face>2</face>
<level>4</level>
</attachment>
<attachment>
<component>color3</component>
<buffer>prefiltered-envmap</buffer>
<face>3</face>
<level>4</level>
</attachment>
<attachment>
<component>color4</component>
<buffer>prefiltered-envmap</buffer>
<face>4</face>
<level>4</level>
</attachment>
<attachment>
<component>color5</component>
<buffer>prefiltered-envmap</buffer>
<face>5</face>
<level>4</level>
</attachment>
</pass>
<!--
G-Buffer pass
This is the main forward pass. Here we skip the rendering of transparent
objects and other geometry that should be forward rendered later (like the
skydome, clouds, etc.)
-->
<pass>
<name>geometry</name>
<type>scene</type>
<effect-scheme>hdr-geometry</effect-scheme>
<clear-mask>depth stencil</clear-mask>
<clear-depth>0.0</clear-depth>
<cull-mask>0xfffff7ff</cull-mask>
<attachment>
<component>color0</component>
<buffer>gbuffer0</buffer>
</attachment>
<attachment>
<component>color1</component>
<buffer>gbuffer1</buffer>
</attachment>
<attachment>
<component>color2</component>
<buffer>gbuffer2</buffer>
</attachment>
<attachment>
<component>depth</component>
<buffer>depth-stencil</buffer>
</attachment>
<attachment>
<component>stencil</component>
<buffer>depth-stencil</buffer>
</attachment>
</pass>
<!-- Shadow mapping pre-passes -->
<pass include="csm-pass.xml">
<name>csm0</name>
<near-m>0.1</near-m>
<far-m>2.0</far-m>
<viewport>
<x>0.0</x>
<y>0.0</y>
<width>0.5</width>
<height>0.5</height>
</viewport>
</pass>
<pass include="csm-pass.xml">
<name>csm1</name>
<near-m>2.0</near-m>
<far-m>40.0</far-m>
<viewport>
<x>0.5</x>
<y>0.0</y>
<width>0.5</width>
<height>0.5</height>
</viewport>
</pass>
<pass include="csm-pass.xml">
<name>csm2</name>
<near-m>40.0</near-m>
<far-m>150.0</far-m>
<viewport>
<x>0.0</x>
<y>0.5</y>
<width>0.5</width>
<height>0.5</height>
</viewport>
</pass>
<pass include="csm-pass.xml">
<name>csm3</name>
<near-m>150.0</near-m>
<far-m>500.0</far-m>
<viewport>
<x>0.5</x>
<y>0.5</y>
<width>0.5</width>
<height>0.5</height>
</viewport>
</pass>
<!-- SSAO (Screen Space Ambient Occlusion) -->
<pass>
<name>ao</name>
<type>quad</type>
<effect>Effects/HDR/ao</effect>
<binding>
<unit>0</unit>
<buffer>gbuffer0</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>depth-stencil</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>ao0</buffer>
</attachment>
</pass>
<!--
Main lighting pass
Combine the G-Buffer and other buffers to compute the final shading value
of the pixel in HDR.
-->
<pass>
<name>lighting</name>
<type>quad</type>
<effect>Effects/HDR/lighting</effect>
<use-shadow-pass>csm0</use-shadow-pass>
<use-shadow-pass>csm1</use-shadow-pass>
<use-shadow-pass>csm2</use-shadow-pass>
<use-shadow-pass>csm3</use-shadow-pass>
<binding>
<unit>0</unit>
<buffer>gbuffer0</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>gbuffer1</buffer>
</binding>
<binding>
<unit>2</unit>
<buffer>gbuffer2</buffer>
</binding>
<binding>
<unit>3</unit>
<buffer>depth-stencil</buffer>
</binding>
<binding>
<unit>7</unit>
<buffer>ao0</buffer>
</binding>
<binding>
<unit>9</unit>
<buffer>prefiltered-envmap</buffer>
</binding>
<binding>
<unit>10</unit>
<buffer>sun-shadowmap-atlas</buffer>
</binding>
<binding>
<unit>11</unit>
<buffer>aerial-perspective</buffer>
</binding>
<binding>
<unit>12</unit>
<buffer>transmittance</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>hdr-result</buffer>
</attachment>
<attachment>
<component>stencil</component>
<buffer>depth-stencil</buffer>
</attachment>
</pass>
<pass>
<name>water</name>
<type>quad</type>
<effect>Effects/HDR/water-lighting</effect>
<binding>
<unit>0</unit>
<buffer>gbuffer0</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>gbuffer1</buffer>
</binding>
<binding>
<unit>3</unit>
<buffer>depth-stencil</buffer>
</binding>
<binding>
<unit>9</unit>
<buffer>prefiltered-envmap</buffer>
</binding>
<binding>
<unit>11</unit>
<buffer>aerial-perspective</buffer>
</binding>
<binding>
<unit>12</unit>
<buffer>transmittance</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>hdr-result</buffer>
</attachment>
<attachment>
<component>stencil</component>
<buffer>depth-stencil</buffer>
</attachment>
</pass>
<!--
Main forward pass
Render all objects that couldn't be rendered on the G-Buffer, mainly
transparent objects. This is also done in HDR.
We reuse the depth buffer from the G-Buffer stage so we can take advantage
of early depth testing.
-->
<pass>
<name>forward</name>
<type>scene</type>
<effect-scheme>hdr-forward</effect-scheme>
<use-shadow-pass>csm0</use-shadow-pass>
<use-shadow-pass>csm1</use-shadow-pass>
<use-shadow-pass>csm2</use-shadow-pass>
<use-shadow-pass>csm3</use-shadow-pass>
<!--
We should not be binding and attaching the depth buffer as that usually
implies reading and writing to it at the same time, which will result in
undefined behaviour. However, in the forward pass we don't write to the
depth buffer (all Effects that use hdr-forward have write-mask=false).
-->
<binding>
<unit>7</unit>
<buffer>depth-stencil</buffer>
</binding>
<binding>
<unit>9</unit>
<buffer>prefiltered-envmap</buffer>
</binding>
<binding>
<unit>10</unit>
<buffer>sun-shadowmap-atlas</buffer>
</binding>
<binding>
<unit>11</unit>
<buffer>aerial-perspective</buffer>
</binding>
<binding>
<unit>12</unit>
<buffer>transmittance</buffer>
</binding>
<binding>
<unit>13</unit>
<buffer>sky-view</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>hdr-result</buffer>
</attachment>
<attachment>
<component>depth</component>
<buffer>depth-stencil</buffer>
</attachment>
<attachment>
<component>stencil</component>
<buffer>depth-stencil</buffer>
</attachment>
</pass>
<!--
Average luminance calculation
1. Convert the RGB values to luminance values and store them on a fixed
size texture.
2. Generate mipmaps for this texture until we are left with a 1x1 texture
at the highest mipmap level. This downsampling process effectively
calculates the geometric mean of luminance.
3. Simulate eye adaptation by smoothing out the transition between
different exposures.
4. Update the previous frame average luminance value for next frame.
-->
<pass>
<name>luminance</name>
<type>quad</type>
<effect>Effects/HDR/luminance</effect>
<binding>
<unit>0</unit>
<buffer>hdr-result</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>luminance</buffer>
<mipmap-generation>true</mipmap-generation>
</attachment>
</pass>
<pass>
<name>adapt-luminance</name>
<type>quad</type>
<effect>Effects/HDR/adapt-luminance</effect>
<binding>
<unit>0</unit>
<buffer>prev-luminance</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>luminance</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>adapted-luminance</buffer>
</attachment>
</pass>
<pass>
<name>copy-prev-luminance</name>
<type>quad</type>
<effect>Effects/HDR/copy-prev-luminance</effect>
<binding>
<unit>0</unit>
<buffer>adapted-luminance</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>prev-luminance</buffer>
</attachment>
</pass>
<!--
Generate a threshold texture for bloom
The HDR lighting buffer is filtered so we are left with an image that only
contains the brightest spots. This image is then progressively
downscaled, blurred and upscaled until we are left with the final bloom
to be applied.
-->
<pass>
<name>bloom-threshold</name>
<type>quad</type>
<effect>Effects/HDR/bloom-threshold</effect>
<binding>
<unit>0</unit>
<buffer>hdr-result</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>adapted-luminance</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom0</buffer>
</attachment>
</pass>
<pass include="bloom-copy-pass.xml">
<name>bloom-copy1</name>
<binding>
<unit>0</unit>
<buffer>bloom0</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom1</buffer>
</attachment>
</pass>
<pass include="bloom-copy-pass.xml">
<name>bloom-copy2</name>
<binding>
<unit>0</unit>
<buffer>bloom1</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom2</buffer>
</attachment>
</pass>
<pass include="bloom-copy-pass.xml">
<name>bloom-copy3</name>
<binding>
<unit>0</unit>
<buffer>bloom2</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom3</buffer>
</attachment>
</pass>
<pass include="bloom-horizontal-blur-pass.xml">
<name>bloom-hblur3</name>
<binding>
<unit>0</unit>
<buffer>bloom3</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom3-tmp</buffer>
</attachment>
</pass>
<pass include="bloom-vertical-blur-pass.xml">
<name>bloom-vblur3</name>
<binding>
<unit>0</unit>
<buffer>bloom3-tmp</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom3</buffer>
</attachment>
</pass>
<pass include="bloom-horizontal-blur-pass.xml">
<name>bloom-hblur2</name>
<binding>
<unit>0</unit>
<buffer>bloom2</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>bloom3</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom2-tmp</buffer>
</attachment>
</pass>
<pass include="bloom-vertical-blur-pass.xml">
<name>bloom-vblur2</name>
<binding>
<unit>0</unit>
<buffer>bloom2-tmp</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom2</buffer>
</attachment>
</pass>
<pass include="bloom-horizontal-blur-pass.xml">
<name>bloom-hblur1</name>
<binding>
<unit>0</unit>
<buffer>bloom1</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>bloom2</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom1-tmp</buffer>
</attachment>
</pass>
<pass include="bloom-vertical-blur-pass.xml">
<name>bloom-vblur1</name>
<binding>
<unit>0</unit>
<buffer>bloom1-tmp</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom1</buffer>
</attachment>
</pass>
<pass include="bloom-horizontal-blur-pass.xml">
<name>bloom-hblur0</name>
<binding>
<unit>0</unit>
<buffer>bloom0</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>bloom1</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom0-tmp</buffer>
</attachment>
</pass>
<pass include="bloom-vertical-blur-pass.xml">
<name>bloom-vblur0</name>
<binding>
<unit>0</unit>
<buffer>bloom0-tmp</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>bloom0</buffer>
</attachment>
</pass>
<!--
Post-processing
Perform miscellaneous post-processing operations, namely tonemapping
and exposure compensation. This process converts the HDR buffer into an
LDR texture ready to be displayed on a screen.
-->
<pass>
<name>post</name>
<type>quad</type>
<effect>Effects/HDR/postprocess</effect>
<binding>
<unit>0</unit>
<buffer>hdr-result</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>adapted-luminance</buffer>
</binding>
<binding>
<unit>4</unit>
<buffer>bloom0</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>final</buffer>
</attachment>
</pass>
<!--
Final LDR post-processing passes that render to the screen
For now they just do antialiasing.
-->
<!-- No AA -->
<pass>
<name>no-aa-display</name>
<type>quad</type>
<effect>Effects/HDR/trivial</effect>
<condition>
<equals>
<property>/sim/rendering/hdr/antialiasing-technique</property>
<value type="int">0</value>
</equals>
</condition>
<binding>
<unit>0</unit>
<buffer>final</buffer>
</binding>
</pass>
<!-- FXAA -->
<pass>
<name>fxaa</name>
<type>quad</type>
<effect>Effects/HDR/fxaa</effect>
<condition>
<equals>
<property>/sim/rendering/hdr/antialiasing-technique</property>
<value type="int">1</value>
</equals>
</condition>
<binding>
<unit>0</unit>
<buffer>final</buffer>
</binding>
</pass>
<!--
SMAA (Enhanced Subpixel Morphological Antialiasing)
http://www.iryoku.com/smaa/
-->
<pass include="smaa-pass.xml">
<name>smaa-edge-detection</name>
<effect>Effects/HDR/smaa-edge-detection</effect>
<clear-mask>color stencil</clear-mask>
<clear-color type="vec4d">0.0 0.0 0.0 0.0</clear-color>
<binding>
<unit>0</unit>
<buffer>final</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>smaa-edges</buffer>
</attachment>
<attachment>
<component>stencil</component>
<buffer>depth-stencil</buffer>
</attachment>
</pass>
<pass include="smaa-pass.xml">
<name>smaa-blending-weight-calculation</name>
<effect>Effects/HDR/smaa-blending-weight-calculation</effect>
<clear-mask>color</clear-mask>
<clear-color type="vec4d">0.0 0.0 0.0 0.0</clear-color>
<binding>
<unit>0</unit>
<buffer>smaa-edges</buffer>
</binding>
<attachment>
<component>color0</component>
<buffer>smaa-blend</buffer>
</attachment>
<attachment>
<component>stencil</component>
<buffer>depth-stencil</buffer>
</attachment>
</pass>
<pass include="smaa-pass.xml">
<name>smaa-neighborhood-blending</name>
<effect>Effects/HDR/smaa-neighborhood-blending</effect>
<binding>
<unit>0</unit>
<buffer>final</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>smaa-blend</buffer>
</binding>
</pass>
<!-- Debug passes -->
<pass include="debug-pass.xml">
<name>debug-color</name>
<effect>Effects/HDR/gbuffer-debug-color</effect>
<geometry>
<left>0.0</left>
<bottom>0.0</bottom>
<width>0.2</width>
<height>0.2</height>
</geometry>
<binding>
<unit>0</unit>
<buffer>gbuffer1</buffer>
</binding>
</pass>
<pass include="debug-pass.xml">
<name>debug-normals</name>
<effect>Effects/HDR/gbuffer-debug-normal</effect>
<geometry>
<left>0.8</left>
<bottom>0.0</bottom>
<width>0.2</width>
<height>0.2</height>
</geometry>
<binding>
<unit>0</unit>
<buffer>gbuffer0</buffer>
</binding>
</pass>
<pass include="debug-pass.xml">
<name>debug-orm</name>
<effect>Effects/HDR/gbuffer-debug-orm</effect>
<geometry>
<left>0.0</left>
<bottom>0.8</bottom>
<width>0.2</width>
<height>0.2</height>
</geometry>
<binding>
<unit>0</unit>
<buffer>gbuffer0</buffer>
</binding>
<binding>
<unit>1</unit>
<buffer>gbuffer1</buffer>
</binding>
<binding>
<unit>2</unit>
<buffer>gbuffer2</buffer>
</binding>
</pass>
<pass include="debug-pass.xml">
<name>debug-matid</name>
<effect>Effects/HDR/gbuffer-debug-matid</effect>
<geometry>
<left>0.0</left>
<bottom>0.57</bottom>
<width>0.2</width>
<height>0.2</height>
</geometry>
<binding>
<unit>0</unit>
<buffer>gbuffer0</buffer>
</binding>
</pass>
<pass include="debug-pass.xml">
<name>debug-depth</name>
<effect>Effects/HDR/visualize-depth</effect>
<geometry>
<left>0.8</left>
<bottom>0.8</bottom>
<width>0.2</width>
<height>0.2</height>
</geometry>
<binding>
<unit>0</unit>
<buffer>depth-stencil</buffer>
</binding>
</pass>
</PropertyList>