1
0
Fork 0

Compositor framework initial commit.

This commit is contained in:
Fernando García Liñán 2019-02-04 17:58:09 +01:00
parent 0abb7201f1
commit 6256f776d4
5 changed files with 265 additions and 0 deletions

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This Compositor imitates the classic forward pipeline used before multi-pass
rendering was introduced. It doesn't involve any FBOs and all the rendering
happens in two passes rendering directly to the screen.
The precision of the Z-buffer deteriorates with huge near-far spreads, so
two passes with different depth ranges are used to avoid Z-fighting and
other unpleasantness.
-->
<PropertyList>
<name>low-spec</name>
<pass n="0">
<name>far-pass</name>
<type>scene</type>
<z-near>100.0</z-near>
<z-far>120000.0</z-far>
</pass>
<pass n="1">
<name>near-pass</name>
<type>scene</type>
<cull-mask>0xfff7ff</cull-mask> <!-- Cull the sky (bit 11 off) -->
<!-- Only clear the depth buffer so color information isn't overwritten -->
<clear-color-bit>false</clear-color-bit>
<clear-depth-bit>true</clear-depth-bit>
<clear-stencil-bit>false</clear-stencil-bit>
<z-near>0.1</z-near>
<z-far>100.0</z-far>
</pass>
</PropertyList>

8
Compositor/default.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This Compositor is used by default when none has been specified in the
CameraGroup settings.
-->
<!--<PropertyList include="test/test.xml"/>-->
<PropertyList include="LowSpec/low-spec.xml"/>

18
Compositor/test/csm.xml Normal file
View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<type>shadow-map</type>
<light-name>FGLightSource</light-name>
<effect-override>Effects/shadow-pass</effect-override>
<!-- Only render objects with the CAST_SHADOW bit flag -->
<cull-mask>0x000004</cull-mask>
<!--
<condition>
<property>/sim/rendering/shadows/enabled</property>
</condition>
-->
<attachment>
<buffer>shadow-atlas</buffer>
<component>depth</component>
</attachment>
</PropertyList>

View file

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Reflection cubemap -->
<!-- <pass include="cubemap-reflection.xml">
<name>refl0</name>
<cubemap-face>0</cubemap-face>
<attachment>
<buffer>refl</buffer>
<face>0</face>
</attachment>
</pass>
<pass include="cubemap-reflection.xml">
<name>refl1</name>
<cubemap-face>1</cubemap-face>
<attachment>
<buffer>refl</buffer>
<face>1</face>
</attachment>
</pass>
<pass include="cubemap-reflection.xml">
<name>refl2</name>
<cubemap-face>2</cubemap-face>
<attachment>
<buffer>refl</buffer>
<face>2</face>
</attachment>
</pass>
<pass include="cubemap-reflection.xml">
<name>refl3</name>
<cubemap-face>3</cubemap-face>
<attachment>
<buffer>refl</buffer>
<face>3</face>
</attachment>
</pass>
<pass include="cubemap-reflection.xml">
<name>refl4</name>
<cubemap-face>4</cubemap-face>
<attachment>
<buffer>refl</buffer>
<face>4</face>
</attachment>
</pass>
<pass include="cubemap-reflection.xml">
<name>refl5</name>
<cubemap-face>5</cubemap-face>
<attachment>
<buffer>refl</buffer>
<face>5</face>
</attachment>
</pass>
-->
<PropertyList>
<type>scene</type>
<!-- BACKGROUND_BIT and TERRAIN_BIT -->
<cull-mask>0x000801</cull-mask>
<z-near>0.1</z-near>
<z-far>1000.0</z-far>
</PropertyList>

147
Compositor/test/test.xml Normal file
View file

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<PropertyList>
<name>test</name>
<buffer>
<name>refl</name>
<type>cubemap</type>
<width>128</width>
<height>128</height>
<format>rgba8</format>
</buffer>
<buffer>
<name>color</name>
<type>2d</type>
<width>screen</width>
<height>screen</height>
<format>rgba8</format>
</buffer>
<buffer>
<name>depth</name>
<type>2d</type>
<width>screen</width>
<height>screen</height>
<format>depth32f</format>
</buffer>
<buffer>
<name>shadow-atlas</name>
<type>2d</type>
<width>8192</width>
<height>8192</height>
<format>depth32f</format>
<wrap-s>clamp-to-border</wrap-s>
<wrap-t>clamp-to-border</wrap-t>
<wrap-r>clamp-to-border</wrap-r>
<border-color type="vec4d">1.0 1.0 1.0 1.0</border-color>
<shadow-comparison>true</shadow-comparison>
</buffer>
<pass include="csm.xml">
<name>csm0</name>
<near-m>0.1</near-m>
<far-m>3.0</far-m>
</pass>
<!-- Shadow cascades -->
<!--
<pass include="csm.xml">
<name>csm0</name>
<near-m>0.1</near-m>
<far-m>5.0</far-m>
<viewport>
<x>0.0</x>
<y>0.0</y>
<width>0.25</width>
<height>1.0</height>
</viewport>
</pass>
<pass include="csm.xml">
<name>csm1</name>
<near-m>5.0</near-m>
<far-m>50.0</far-m>
<viewport>
<x>0.25</x>
<y>0.0</y>
<width>0.25</width>
<height>1.0</height>
</viewport>
</pass>
<pass include="csm.xml">
<name>csm2</name>
<near-m>50.0</near-m>
<far-m>500.0</far-m>
<viewport>
<x>0.5</x>
<y>0.0</y>
<width>0.25</width>
<height>1.0</height>
</viewport>
</pass>
<pass include="csm.xml">
<name>csm3</name>
<near-m>500.0</near-m>
<far-m>5000.0</far-m>
<viewport>
<x>0.75</x>
<y>0.0</y>
<width>0.25</width>
<height>1.0</height>
</viewport>
</pass>
-->
<pass>
<name>forward</name>
<type>scene</type>
<use-shadow-pass>csm0</use-shadow-pass>
<binding>
<buffer>shadow-atlas</buffer>
<unit>10</unit>
</binding>
<attachment>
<buffer>color</buffer>
<component>color0</component>
<multisample-samples>4</multisample-samples>
<multisample-color-samples>4</multisample-color-samples>
</attachment>
<attachment>
<buffer>depth</buffer>
<component>depth</component>
</attachment>
</pass>
<pass>
<name>display</name>
<type>quad</type>
<clear-color-bit>false</clear-color-bit>
<binding>
<buffer>color</buffer>
<unit>0</unit>
</binding>
</pass>
<!--
<pass>
<name>shadow-debug</name>
<type>quad</type>
<clear-color-bit>false</clear-color-bit>
<geometry>
<left>0.7</left>
<bottom>0.0</bottom>
<width>0.3</width>
<height>0.2</height>
<scale>1.0</scale>
</geometry>
<binding>
<buffer>shadow-atlas</buffer>
<unit>0</unit>
</binding>
</pass>
-->
</PropertyList>