1
0
Fork 0

Add a bloom strength property and a slider in the Rembrandt dialog

This commit is contained in:
Frederic Bouvier 2012-06-26 09:02:21 +02:00
parent ecbcdbbd02
commit 4e241640b6
4 changed files with 87 additions and 24 deletions

View file

@ -5,6 +5,7 @@
<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>
<bloom type="bool"><use>/sim/rendering/rembrandt/bloom</use></bloom> <bloom type="bool"><use>/sim/rendering/rembrandt/bloom</use></bloom>
<bloom-strength type="float"><use>/sim/rendering/rembrandt/bloom-strength</use></bloom-strength>
<bloom-buffers type="bool"><use>/sim/rendering/rembrandt/bloom-buffers</use></bloom-buffers> <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-enabled><use>/sim/rendering/rembrandt/debug-buffer[0]/enabled</use></buffer-nw-enabled>
@ -125,10 +126,15 @@
<type>bool</type> <type>bool</type>
<value type="bool"><use>bloom</use></value> <value type="bool"><use>bloom</use></value>
</uniform> </uniform>
<uniform>
<name>bloomStrength</name>
<type>float</type>
<value><use>bloom-strength</use></value>
</uniform>
<uniform> <uniform>
<name>bloomBuffers</name> <name>bloomBuffers</name>
<type>bool</type> <type>bool</type>
<value type="bool"><use>bloom-buffers</use></value> <value><use>bloom-buffers</use></value>
</uniform> </uniform>
</pass> </pass>
</technique> </technique>

View file

@ -10,6 +10,7 @@ uniform float exposure;
uniform bool showBuffers; uniform bool showBuffers;
uniform bool bloomEnabled; uniform bool bloomEnabled;
uniform float bloomStrength;
uniform bool bloomBuffers; uniform bool bloomBuffers;
uniform bool bufferNW_enabled; uniform bool bufferNW_enabled;
@ -40,13 +41,13 @@ void main() {
} else { } else {
color = texture2D( lighting_tex, coords ); color = texture2D( lighting_tex, coords );
if (bloomEnabled && bloomBuffers) if (bloomEnabled && bloomBuffers)
color = color + texture2D( bloom_tex, coords ); color = color + bloomStrength * 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 && bloomBuffers) if (bloomEnabled && bloomBuffers)
color = color + texture2D( bloom_tex, coords ); color = color + bloomStrength * texture2D( bloom_tex, coords );
//color = vec4( HDR( color.rgb ), 1.0 ); //color = vec4( HDR( color.rgb ), 1.0 );
} }
gl_FragColor = color; gl_FragColor = color;

View file

@ -34,6 +34,10 @@
<hrule/> <hrule/>
<group>
<layout>hbox</layout>
<halign>left</halign>
<checkbox> <checkbox>
<halign>left</halign> <halign>left</halign>
<label>Bloom</label> <label>Bloom</label>
@ -43,13 +47,52 @@
<command>dialog-apply</command> <command>dialog-apply</command>
<object-name>bloom</object-name> <object-name>bloom</object-name>
</binding> </binding>
<visible> <enable>
<property>/sim/rendering/rembrandt/bloom-buffers</property>
</enable>
</checkbox>
<empty>
<pref-width>66</pref-width>
</empty>
<text>
<label>Strength</label>
<enable>
<and> <and>
<property>/sim/rendering/rembrandt/enabled</property> <property>/sim/rendering/rembrandt/bloom</property>
<property>/sim/rendering/rembrandt/bloom-buffers</property> <property>/sim/rendering/rembrandt/bloom-buffers</property>
</and> </and>
</visible> </enable>
</checkbox> </text>
<slider>
<name>bloom-strength</name>
<min>0.0</min>
<max>1.0</max>
<step>0.01</step>
<property>/sim/rendering/rembrandt/bloom-strength</property>
<binding>
<command>dialog-apply</command>
<object-name>bloom-strength</object-name>
</binding>
<enable>
<and>
<property>/sim/rendering/rembrandt/bloom</property>
<property>/sim/rendering/rembrandt/bloom-buffers</property>
</and>
</enable>
</slider>
<text>
<label>12345678</label>
<format>%.2f</format>
<live>true</live>
<property>/sim/rendering/rembrandt/bloom-strength</property>
<enable>
<and>
<property>/sim/rendering/rembrandt/bloom</property>
<property>/sim/rendering/rembrandt/bloom-buffers</property>
</and>
</enable>
</text>
</group>
<group> <group>
<layout>hbox</layout> <layout>hbox</layout>
@ -63,6 +106,9 @@
<command>dialog-apply</command> <command>dialog-apply</command>
<object-name>occlusion</object-name> <object-name>occlusion</object-name>
</binding> </binding>
<enable>
<property>/sim/rendering/rembrandt/ambient-occlusion-buffers</property>
</enable>
</checkbox> </checkbox>
<empty> <empty>
<pref-width>-4</pref-width> <pref-width>-4</pref-width>
@ -70,14 +116,14 @@
<text> <text>
<label>Strength</label> <label>Strength</label>
<enable> <enable>
<and>
<property>/sim/rendering/rembrandt/ambient-occlusion</property> <property>/sim/rendering/rembrandt/ambient-occlusion</property>
<property>/sim/rendering/rembrandt/ambient-occlusion-buffers</property>
</and>
</enable> </enable>
</text> </text>
<slider> <slider>
<name>ambient-occlusion-strength</name> <name>ambient-occlusion-strength</name>
<enable>
<property>/sim/rendering/rembrandt/ambient-occlusion</property>
</enable>
<min>0.0</min> <min>0.0</min>
<max>1.0</max> <max>1.0</max>
<step>0.01</step> <step>0.01</step>
@ -86,15 +132,24 @@
<command>dialog-apply</command> <command>dialog-apply</command>
<object-name>ambient-occlusion-strength</object-name> <object-name>ambient-occlusion-strength</object-name>
</binding> </binding>
<enable>
<and>
<property>/sim/rendering/rembrandt/ambient-occlusion</property>
<property>/sim/rendering/rembrandt/ambient-occlusion-buffers</property>
</and>
</enable>
</slider> </slider>
<text> <text>
<enable>
<property>/sim/rendering/rembrandt/ambient-occlusion</property>
</enable>
<label>12345678</label> <label>12345678</label>
<format>%.2f</format> <format>%.2f</format>
<live>true</live> <live>true</live>
<property>/sim/rendering/rembrandt/ambient-occlusion-strength</property> <property>/sim/rendering/rembrandt/ambient-occlusion-strength</property>
<enable>
<and>
<property>/sim/rendering/rembrandt/ambient-occlusion</property>
<property>/sim/rendering/rembrandt/ambient-occlusion-buffers</property>
</and>
</enable>
</text> </text>
</group> </group>

View file

@ -69,6 +69,7 @@ Started September 2000 by David Megginson, david@megginson.com
<ambient-occlusion-strength type="float" userarchive="y">1.0</ambient-occlusion-strength> <ambient-occlusion-strength type="float" userarchive="y">1.0</ambient-occlusion-strength>
<ambient-occlusion-buffers type="bool">true</ambient-occlusion-buffers> <ambient-occlusion-buffers type="bool">true</ambient-occlusion-buffers>
<bloom type="bool" userarchive="y">true</bloom> <bloom type="bool" userarchive="y">true</bloom>
<bloom-strength type="float" userarchive="y">1.0</bloom-strength>
<bloom-buffers type="bool">true</bloom-buffers> <bloom-buffers type="bool">true</bloom-buffers>
<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>