1
0
Fork 0

Allow to select debugged buffers in Rembrandt

This commit is contained in:
Frederic Bouvier 2012-05-18 12:42:34 +02:00
parent 58c5a389ce
commit 1932ddb014
6 changed files with 371 additions and 45 deletions

View file

@ -4,8 +4,17 @@
<parameters> <parameters>
<exposure type="float"><use>/sim/rendering/rembrandt/exposure</use></exposure> <exposure type="float"><use>/sim/rendering/rembrandt/exposure</use></exposure>
<show-buffers type="bool"><use>/sim/rendering/rembrandt/show-buffers</use></show-buffers> <show-buffers type="bool"><use>/sim/rendering/rembrandt/show-buffers</use></show-buffers>
<ambient-occlusion type="bool"><use>/sim/rendering/rembrandt/ambient-occlusion-buffers</use></ambient-occlusion>
<bloom type="bool"><use>/sim/rendering/rembrandt/bloom</use></bloom> <bloom type="bool"><use>/sim/rendering/rembrandt/bloom</use></bloom>
<bloom-buffers type="bool"><use>/sim/rendering/rembrandt/bloom-buffers</use></bloom-buffers>
<buffer-nw-enabled><use>/sim/rendering/rembrandt/debug-buffer[0]/enabled</use></buffer-nw-enabled>
<buffer-nw-name><use>/sim/rendering/rembrandt/debug-buffer[0]/name</use></buffer-nw-name>
<buffer-ne-enabled><use>/sim/rendering/rembrandt/debug-buffer[1]/enabled</use></buffer-ne-enabled>
<buffer-ne-name><use>/sim/rendering/rembrandt/debug-buffer[1]/name</use></buffer-ne-name>
<buffer-sw-enabled><use>/sim/rendering/rembrandt/debug-buffer[2]/enabled</use></buffer-sw-enabled>
<buffer-sw-name><use>/sim/rendering/rembrandt/debug-buffer[2]/name</use></buffer-sw-name>
<buffer-se-enabled><use>/sim/rendering/rembrandt/debug-buffer[3]/enabled</use></buffer-se-enabled>
<buffer-se-name><use>/sim/rendering/rembrandt/debug-buffer[3]/name</use></buffer-se-name>
</parameters> </parameters>
<technique n="11"> <technique n="11">
<pass> <pass>
@ -16,77 +25,69 @@
<texture-unit> <texture-unit>
<unit>0</unit> <unit>0</unit>
<type>buffer</type> <type>buffer</type>
<name>depth</name> <name>lighting</name>
</texture-unit> </texture-unit>
<texture-unit> <texture-unit>
<unit>1</unit> <unit>1</unit>
<type>buffer</type> <type>buffer</type>
<name>normal</name> <name>bloom-3</name>
</texture-unit> </texture-unit>
<texture-unit> <texture-unit>
<unit>2</unit> <unit>2</unit>
<type>buffer</type> <type>buffer</type>
<name>diffuse</name> <name><use>buffer-nw-name</use></name>
</texture-unit> </texture-unit>
<texture-unit> <texture-unit>
<unit>3</unit> <unit>3</unit>
<type>buffer</type> <type>buffer</type>
<name>spec-emis</name> <name><use>buffer-ne-name</use></name>
</texture-unit> </texture-unit>
<texture-unit> <texture-unit>
<unit>4</unit> <unit>4</unit>
<type>buffer</type> <type>buffer</type>
<name>lighting</name> <name><use>buffer-sw-name</use></name>
</texture-unit> </texture-unit>
<texture-unit> <texture-unit>
<unit>5</unit> <unit>5</unit>
<type>buffer</type> <type>buffer</type>
<name>bloom-3</name> <name><use>buffer-se-name</use></name>
</texture-unit>
<texture-unit>
<unit>6</unit>
<type>buffer</type>
<name>ao-3</name>
</texture-unit> </texture-unit>
<program> <program>
<vertex-shader>Shaders/fullscreen.vert</vertex-shader> <vertex-shader>Shaders/fullscreen.vert</vertex-shader>
<fragment-shader>Shaders/display.frag</fragment-shader> <fragment-shader>Shaders/display.frag</fragment-shader>
</program> </program>
<uniform> <uniform>
<name>depth_tex</name> <name>lighting_tex</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">0</value> <value type="int">0</value>
</uniform> </uniform>
<uniform> <uniform>
<name>normal_tex</name> <name>bloom_tex</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">1</value> <value type="int">1</value>
</uniform> </uniform>
<uniform> <uniform>
<name>color_tex</name> <name>bufferNW_tex</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">2</value> <value type="int">2</value>
</uniform> </uniform>
<uniform> <uniform>
<name>specular_tex</name> <name>bufferNE_tex</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">3</value> <value type="int">3</value>
</uniform> </uniform>
<uniform> <uniform>
<name>lighting_tex</name> <name>bufferSW_tex</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">4</value> <value type="int">4</value>
</uniform> </uniform>
<uniform> <uniform>
<name>bloom_tex</name> <name>bufferSE_tex</name>
<type>sampler-2d</type> <type>sampler-2d</type>
<value type="int">5</value> <value type="int">5</value>
</uniform> </uniform>
<uniform>
<name>ao_tex</name>
<type>sampler-2d</type>
<value type="int">6</value>
</uniform>
<uniform> <uniform>
<name>exposure</name> <name>exposure</name>
<type>float</type> <type>float</type>
@ -97,16 +98,38 @@
<type>bool</type> <type>bool</type>
<value type="bool"><use>show-buffers</use></value> <value type="bool"><use>show-buffers</use></value>
</uniform> </uniform>
<uniform> <uniform>
<name>ambientOcclusion</name> <name>bufferNW_enabled</name>
<type>bool</type> <type>bool</type>
<value type="bool"><use>ambient-occlusion</use></value> <value type="bool"><use>buffer-nw-enabled</use></value>
</uniform> </uniform>
<uniform>
<name>bufferNE_enabled</name>
<type>bool</type>
<value type="bool"><use>buffer-ne-enabled</use></value>
</uniform>
<uniform>
<name>bufferSW_enabled</name>
<type>bool</type>
<value type="bool"><use>buffer-sw-enabled</use></value>
</uniform>
<uniform>
<name>bufferSE_enabled</name>
<type>bool</type>
<value type="bool"><use>buffer-se-enabled</use></value>
</uniform>
<uniform> <uniform>
<name>bloomEnabled</name> <name>bloomEnabled</name>
<type>bool</type> <type>bool</type>
<value type="bool"><use>bloom</use></value> <value type="bool"><use>bloom</use></value>
</uniform> </uniform>
<uniform>
<name>bloomBuffers</name>
<type>bool</type>
<value type="bool"><use>bloom-buffers</use></value>
</uniform>
</pass> </pass>
</technique> </technique>
</PropertyList> </PropertyList>

View file

@ -1,15 +1,21 @@
uniform sampler2D depth_tex;
uniform sampler2D normal_tex;
uniform sampler2D color_tex;
uniform sampler2D specular_tex;
uniform sampler2D lighting_tex; uniform sampler2D lighting_tex;
uniform sampler2D bloom_tex; uniform sampler2D bloom_tex;
uniform sampler2D ao_tex;
uniform sampler2D bufferNW_tex;
uniform sampler2D bufferNE_tex;
uniform sampler2D bufferSW_tex;
uniform sampler2D bufferSE_tex;
uniform float exposure; uniform float exposure;
uniform bool showBuffers; uniform bool showBuffers;
uniform bool fg_DepthInColor;
uniform bool ambientOcclusion;
uniform bool bloomEnabled; uniform bool bloomEnabled;
uniform bool bloomBuffers;
uniform bool bufferNW_enabled;
uniform bool bufferNE_enabled;
uniform bool bufferSW_enabled;
uniform bool bufferSE_enabled;
vec3 HDR(vec3 L) { vec3 HDR(vec3 L) {
L = L * exposure; L = L * exposure;
@ -23,25 +29,23 @@ void main() {
vec2 coords = gl_TexCoord[0].xy; vec2 coords = gl_TexCoord[0].xy;
vec4 color; vec4 color;
if (showBuffers) { if (showBuffers) {
if (coords.x < 0.2 && coords.y < 0.2) { if (coords.x < 0.2 && coords.y < 0.2 && bufferSW_enabled) {
color = texture2D( normal_tex, coords * 5.0 ); color = texture2D( bufferSW_tex, coords * 5.0 );
} else if (coords.x >= 0.8 && coords.y >= 0.8) { } else if (coords.x >= 0.8 && coords.y >= 0.8 && bufferNE_enabled) {
color = texture2D( specular_tex, (coords - vec2( 0.8, 0.8 )) * 5.0 ); color = texture2D( bufferNE_tex, (coords - vec2( 0.8, 0.8 )) * 5.0 );
} else if (coords.x >= 0.8 && coords.y < 0.2) { } else if (coords.x >= 0.8 && coords.y < 0.2 && bufferSE_enabled) {
color = texture2D( color_tex, (coords - vec2( 0.8, 0.0 )) * 5.0 ); color = texture2D( bufferSE_tex, (coords - vec2( 0.8, 0.0 )) * 5.0 );
} else if (coords.x < 0.2 && coords.y >= 0.8 && fg_DepthInColor) { } else if (coords.x < 0.2 && coords.y >= 0.8 && bufferNW_enabled) {
color = texture2D( depth_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 ); color = texture2D( bufferNW_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 );
} else if (coords.x < 0.2 && coords.y >= 0.8 && bloomEnabled) {
color = texture2D( bloom_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 );
} else { } else {
color = texture2D( lighting_tex, coords ); color = texture2D( lighting_tex, coords );
if (bloomEnabled) if (bloomEnabled && bloomBuffers)
color = color + texture2D( bloom_tex, coords ); color = color + texture2D( bloom_tex, coords );
//color = vec4( HDR( color.rgb ), 1.0 ); //color = vec4( HDR( color.rgb ), 1.0 );
} }
} else { } else {
color = texture2D( lighting_tex, coords ); color = texture2D( lighting_tex, coords );
if (bloomEnabled) if (bloomEnabled && bloomBuffers)
color = color + texture2D( bloom_tex, coords ); color = color + texture2D( bloom_tex, coords );
//color = vec4( HDR( color.rgb ), 1.0 ); //color = vec4( HDR( color.rgb ), 1.0 );
} }

View file

@ -99,8 +99,8 @@
<logging>Logging</logging> <logging>Logging</logging>
<local_weather>Local Weather (Test)</local_weather> <local_weather>Local Weather (Test)</local_weather>
<print-scene-info>Print Visible Scene Info</print-scene-info> <print-scene-info>Print Visible Scene Info</print-scene-info>
<ambient-occlusion>Hide/Show Ambient occlusion</ambient-occlusion>
<rendering-buffers>Hide/Show Rendering Buffers</rendering-buffers> <rendering-buffers>Hide/Show Rendering Buffers</rendering-buffers>
<rembrandt-buffers-choice>Select Rendering Buffers</rembrandt-buffers-choice>
<!-- Help menu --> <!-- Help menu -->
<help>Help</help> <help>Help</help>

View file

@ -0,0 +1,275 @@
<?xml version="1.0"?>
<PropertyList>
<name>rembrandt-buffers</name>
<modal>false</modal>
<layout>vbox</layout>
<padding>20</padding>
<group>
<layout>hbox</layout>
<empty>
<stretch>1</stretch>
</empty>
<text>
<label>Rendering buffers</label>
</text>
<empty>
<stretch>1</stretch>
</empty>
<button>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<legend></legend>
<keynum>27</keynum>
<border>2</border>
<binding>
<command>dialog-close</command>
</binding>
</button>
</group>
<hrule/>
<group>
<layout>table</layout>
<checkbox>
<halign>left</halign>
<label>North West buffer</label>
<name>buffer-nw-enabled</name>
<row>0</row>
<col>0</col>
<colspan>2</colspan>
<property>/sim/rendering/rembrandt/debug-buffer[0]/enabled</property>
<binding>
<command>dialog-apply</command>
<object-name>buffer-nw-enabled</object-name>
</binding>
</checkbox>
<text>
<label>Buffer</label>
<halign>right</halign>
<row>1</row>
<col>0</col>
<enable>
<property>/sim/rendering/rembrandt/debug-buffer[0]/enabled</property>
</enable>
</text>
<combo>
<halign>left</halign>
<name>buffer-nw-name</name>
<row>1</row>
<col>1</col>
<property>/sim/rendering/rembrandt/debug-buffer[0]/name</property>
<value>real-depth</value>
<value>depth</value>
<value>normal</value>
<value>diffuse</value>
<value>spec-emis</value>
<value>ao-1</value>
<value>ao-2</value>
<value>ao-3</value>
<value>bloom-1</value>
<value>bloom-2</value>
<value>bloom-3</value>
<value>lighting</value>
<binding>
<command>dialog-apply</command>
<object-name>buffer-nw-name</object-name>
</binding>
<enable>
<property>/sim/rendering/rembrandt/debug-buffer[0]/enabled</property>
</enable>
</combo>
<vrule>
<row>0</row>
<col>2</col>
<rowspan>2</rowspan>
</vrule>
<hrule>
<row>2</row>
<col>0</col>
<colspan>2</colspan>
</hrule>
<checkbox>
<halign>left</halign>
<label>North East buffer</label>
<name>buffer-ne-enabled</name>
<row>0</row>
<col>3</col>
<colspan>2</colspan>
<property>/sim/rendering/rembrandt/debug-buffer[1]/enabled</property>
<binding>
<command>dialog-apply</command>
<object-name>buffer-ne-enabled</object-name>
</binding>
</checkbox>
<text>
<label>Buffer</label>
<halign>right</halign>
<row>1</row>
<col>3</col>
<enable>
<property>/sim/rendering/rembrandt/debug-buffer[1]/enabled</property>
</enable>
</text>
<combo>
<halign>left</halign>
<name>buffer-ne-name</name>
<row>1</row>
<col>4</col>
<property>/sim/rendering/rembrandt/debug-buffer[1]/name</property>
<value>real-depth</value>
<value>depth</value>
<value>normal</value>
<value>diffuse</value>
<value>spec-emis</value>
<value>ao-1</value>
<value>ao-2</value>
<value>ao-3</value>
<value>bloom-1</value>
<value>bloom-2</value>
<value>bloom-3</value>
<value>lighting</value>
<binding>
<command>dialog-apply</command>
<object-name>buffer-ne-name</object-name>
</binding>
<enable>
<property>/sim/rendering/rembrandt/debug-buffer[1]/enabled</property>
</enable>
</combo>
<checkbox>
<halign>left</halign>
<label>South West buffer</label>
<name>buffer-sw-enabled</name>
<row>3</row>
<col>0</col>
<colspan>2</colspan>
<property>/sim/rendering/rembrandt/debug-buffer[2]/enabled</property>
<binding>
<command>dialog-apply</command>
<object-name>buffer-sw-enabled</object-name>
</binding>
</checkbox>
<text>
<label>Buffer</label>
<halign>right</halign>
<row>4</row>
<col>0</col>
<enable>
<property>/sim/rendering/rembrandt/debug-buffer[2]/enabled</property>
</enable>
</text>
<combo>
<halign>left</halign>
<name>buffer-sw-name</name>
<row>4</row>
<col>1</col>
<property>/sim/rendering/rembrandt/debug-buffer[2]/name</property>
<value>real-depth</value>
<value>depth</value>
<value>normal</value>
<value>diffuse</value>
<value>spec-emis</value>
<value>ao-1</value>
<value>ao-2</value>
<value>ao-3</value>
<value>bloom-1</value>
<value>bloom-2</value>
<value>bloom-3</value>
<value>lighting</value>
<binding>
<command>dialog-apply</command>
<object-name>buffer-sw-name</object-name>
</binding>
<enable>
<property>/sim/rendering/rembrandt/debug-buffer[2]/enabled</property>
</enable>
</combo>
<vrule>
<row>3</row>
<col>2</col>
<rowspan>2</rowspan>
</vrule>
<hrule>
<row>2</row>
<col>3</col>
<colspan>2</colspan>
</hrule>
<checkbox>
<halign>left</halign>
<label>South East buffer</label>
<name>buffer-se-enabled</name>
<row>3</row>
<col>3</col>
<colspan>2</colspan>
<property>/sim/rendering/rembrandt/debug-buffer[3]/enabled</property>
<binding>
<command>dialog-apply</command>
<object-name>buffer-se-enabled</object-name>
</binding>
</checkbox>
<text>
<label>Buffer</label>
<halign>right</halign>
<row>4</row>
<col>3</col>
<enable>
<property>/sim/rendering/rembrandt/debug-buffer[3]/enabled</property>
</enable>
</text>
<combo>
<halign>left</halign>
<name>buffer-se-name</name>
<row>4</row>
<col>4</col>
<property>/sim/rendering/rembrandt/debug-buffer[3]/name</property>
<value>real-depth</value>
<value>depth</value>
<value>normal</value>
<value>diffuse</value>
<value>spec-emis</value>
<value>ao-1</value>
<value>ao-2</value>
<value>ao-3</value>
<value>bloom-1</value>
<value>bloom-2</value>
<value>bloom-3</value>
<value>lighting</value>
<binding>
<command>dialog-apply</command>
<object-name>buffer-se-name</object-name>
</binding>
<enable>
<property>/sim/rendering/rembrandt/debug-buffer[3]/enabled</property>
</enable>
</combo>
</group>
<hrule/>
<button>
<legend>Close</legend>
<default>true</default>
<key>Esc</key>
<binding>
<command>dialog-close</command>
</binding>
</button>
</PropertyList>

View file

@ -667,6 +667,14 @@
<enabled>false</enabled> <enabled>false</enabled>
</item> </item>
<item>
<name>rembrandt-buffers-choice</name>
<binding>
<command>dialog-show</command>
<dialog-name>rembrandt-buffers</dialog-name>
</binding>
</item>
</menu> </menu>
<menu> <menu>

View file

@ -76,6 +76,22 @@ Started September 2000 by David Megginson, david@megginson.com
<exposure type="float" userarchive="y">1.0</exposure> <exposure type="float" userarchive="y">1.0</exposure>
<use-color-for-depth type="bool">false</use-color-for-depth> <use-color-for-depth type="bool">false</use-color-for-depth>
<no-16bit-buffer type="bool">true</no-16bit-buffer> <no-16bit-buffer type="bool">true</no-16bit-buffer>
<debug-buffer n="0">
<enabled type="bool" userarchive="y">false</enabled>
<name userarchive="y"></name>
</debug-buffer>
<debug-buffer n="1">
<enabled type="bool" userarchive="y">true</enabled>
<name userarchive="y">spec-emis</name>
</debug-buffer>
<debug-buffer n="2">
<enabled type="bool" userarchive="y">true</enabled>
<name userarchive="y">normal</name>
</debug-buffer>
<debug-buffer n="3">
<enabled type="bool" userarchive="y">true</enabled>
<name userarchive="y">diffuse</name>
</debug-buffer>
</rembrandt> </rembrandt>
<debug type="bool">false</debug> <debug type="bool">false</debug>
<realism type="int">5</realism> <realism type="int">5</realism>