Add condition on ambient occlusion and a menu item to switch it on and off if the stage is enabled in the pipeline
This commit is contained in:
parent
7d573e3292
commit
1a5cc682a9
9 changed files with 76 additions and 5 deletions
|
@ -1,6 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PropertyList>
|
<PropertyList>
|
||||||
<name>Effects/ambient</name>
|
<name>Effects/ambient</name>
|
||||||
|
<parameters>
|
||||||
|
<ambient-occlusion type="bool"><use>/sim/rendering/rembrandt/ambient-occlusion</use></ambient-occlusion>
|
||||||
|
</parameters>
|
||||||
<technique n="11">
|
<technique n="11">
|
||||||
<pass>
|
<pass>
|
||||||
<lighting>false</lighting>
|
<lighting>false</lighting>
|
||||||
|
@ -65,6 +68,11 @@
|
||||||
<type>sampler-2d</type>
|
<type>sampler-2d</type>
|
||||||
<value type="int">4</value>
|
<value type="int">4</value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>ambientOcclusion</name>
|
||||||
|
<type>bool</type>
|
||||||
|
<value type="bool"><use>ambient-occlusion</use></value>
|
||||||
|
</uniform>
|
||||||
<!-- The following uniforms are automatically defined and initialized :
|
<!-- The following uniforms are automatically defined and initialized :
|
||||||
- fg_SunAmbientColor
|
- fg_SunAmbientColor
|
||||||
- fg_SunDiffuseColor
|
- fg_SunDiffuseColor
|
||||||
|
|
|
@ -12,6 +12,12 @@
|
||||||
</buffer>
|
</buffer>
|
||||||
<buffer>
|
<buffer>
|
||||||
<name>normal</name>
|
<name>normal</name>
|
||||||
|
<condition>
|
||||||
|
<equal>
|
||||||
|
<value type="bool">true</value>
|
||||||
|
<property>/sim/rendering/rembrandt/no-16bit-buffer</property>
|
||||||
|
</equal>
|
||||||
|
</condition>
|
||||||
<internal-format>rgba8</internal-format>
|
<internal-format>rgba8</internal-format>
|
||||||
<source-format>rgba</source-format>
|
<source-format>rgba</source-format>
|
||||||
<source-type>unsigned-byte</source-type>
|
<source-type>unsigned-byte</source-type>
|
||||||
|
@ -20,6 +26,22 @@
|
||||||
<scale-factor>1.0</scale-factor>
|
<scale-factor>1.0</scale-factor>
|
||||||
<wrap-mode>clamp-to-border</wrap-mode>
|
<wrap-mode>clamp-to-border</wrap-mode>
|
||||||
</buffer>
|
</buffer>
|
||||||
|
<buffer>
|
||||||
|
<name>normal</name>
|
||||||
|
<condition>
|
||||||
|
<equal>
|
||||||
|
<value type="bool">false</value>
|
||||||
|
<property>/sim/rendering/rembrandt/no-16bit-buffer</property>
|
||||||
|
</equal>
|
||||||
|
</condition>
|
||||||
|
<internal-format>rg16</internal-format>
|
||||||
|
<source-format>rg</source-format>
|
||||||
|
<source-type>unsigned-short</source-type>
|
||||||
|
<width>screen</width>
|
||||||
|
<height>screen</height>
|
||||||
|
<scale-factor>1.0</scale-factor>
|
||||||
|
<wrap-mode>clamp-to-border</wrap-mode>
|
||||||
|
</buffer>
|
||||||
<buffer>
|
<buffer>
|
||||||
<name>shadow</name>
|
<name>shadow</name>
|
||||||
<internal-format>depth-component32</internal-format>
|
<internal-format>depth-component32</internal-format>
|
||||||
|
@ -55,6 +77,9 @@
|
||||||
</buffer>
|
</buffer>
|
||||||
<buffer>
|
<buffer>
|
||||||
<name>ao-1</name>
|
<name>ao-1</name>
|
||||||
|
<condition>
|
||||||
|
<property>/sim/rendering/rembrandt/ambient-occlusion-buffers</property>
|
||||||
|
</condition>
|
||||||
<internal-format>rgba8</internal-format>
|
<internal-format>rgba8</internal-format>
|
||||||
<source-format>rgba</source-format>
|
<source-format>rgba</source-format>
|
||||||
<source-type>unsigned-byte</source-type>
|
<source-type>unsigned-byte</source-type>
|
||||||
|
@ -65,6 +90,9 @@
|
||||||
</buffer>
|
</buffer>
|
||||||
<buffer>
|
<buffer>
|
||||||
<name>ao-2</name>
|
<name>ao-2</name>
|
||||||
|
<condition>
|
||||||
|
<property>/sim/rendering/rembrandt/ambient-occlusion-buffers</property>
|
||||||
|
</condition>
|
||||||
<internal-format>rgba8</internal-format>
|
<internal-format>rgba8</internal-format>
|
||||||
<source-format>rgba</source-format>
|
<source-format>rgba</source-format>
|
||||||
<source-type>unsigned-byte</source-type>
|
<source-type>unsigned-byte</source-type>
|
||||||
|
@ -75,6 +103,9 @@
|
||||||
</buffer>
|
</buffer>
|
||||||
<buffer>
|
<buffer>
|
||||||
<name>ao-3</name>
|
<name>ao-3</name>
|
||||||
|
<condition>
|
||||||
|
<property>/sim/rendering/rembrandt/ambient-occlusion-buffers</property>
|
||||||
|
</condition>
|
||||||
<internal-format>rgba8</internal-format>
|
<internal-format>rgba8</internal-format>
|
||||||
<source-format>rgba</source-format>
|
<source-format>rgba</source-format>
|
||||||
<source-type>unsigned-byte</source-type>
|
<source-type>unsigned-byte</source-type>
|
||||||
|
@ -126,6 +157,9 @@
|
||||||
<stage>
|
<stage>
|
||||||
<name>ssao-1</name>
|
<name>ssao-1</name>
|
||||||
<type>fullscreen</type>
|
<type>fullscreen</type>
|
||||||
|
<condition>
|
||||||
|
<property>/sim/rendering/rembrandt/ambient-occlusion-buffers</property>
|
||||||
|
</condition>
|
||||||
<order-num>2</order-num>
|
<order-num>2</order-num>
|
||||||
<effect>Effects/ssao</effect>
|
<effect>Effects/ssao</effect>
|
||||||
<needs-du-dv>true</needs-du-dv>
|
<needs-du-dv>true</needs-du-dv>
|
||||||
|
@ -138,6 +172,9 @@
|
||||||
<stage>
|
<stage>
|
||||||
<name>ssao-2</name>
|
<name>ssao-2</name>
|
||||||
<type>fullscreen</type>
|
<type>fullscreen</type>
|
||||||
|
<condition>
|
||||||
|
<property>/sim/rendering/rembrandt/ambient-occlusion-buffers</property>
|
||||||
|
</condition>
|
||||||
<order-num>3</order-num>
|
<order-num>3</order-num>
|
||||||
<effect>Effects/ssao-blur-1</effect>
|
<effect>Effects/ssao-blur-1</effect>
|
||||||
<scale-factor>0.25</scale-factor>
|
<scale-factor>0.25</scale-factor>
|
||||||
|
@ -149,6 +186,9 @@
|
||||||
<stage>
|
<stage>
|
||||||
<name>ssao-3</name>
|
<name>ssao-3</name>
|
||||||
<type>fullscreen</type>
|
<type>fullscreen</type>
|
||||||
|
<condition>
|
||||||
|
<property>/sim/rendering/rembrandt/ambient-occlusion-buffers</property>
|
||||||
|
</condition>
|
||||||
<order-num>4</order-num>
|
<order-num>4</order-num>
|
||||||
<effect>Effects/ssao-blur-2</effect>
|
<effect>Effects/ssao-blur-2</effect>
|
||||||
<scale-factor>0.25</scale-factor>
|
<scale-factor>0.25</scale-factor>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<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>
|
||||||
</parameters>
|
</parameters>
|
||||||
<technique n="11">
|
<technique n="11">
|
||||||
<pass>
|
<pass>
|
||||||
|
@ -85,6 +86,11 @@
|
||||||
<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>
|
||||||
|
<name>ambientOcclusion</name>
|
||||||
|
<type>bool</type>
|
||||||
|
<value type="bool"><use>ambient-occlusion</use></value>
|
||||||
|
</uniform>
|
||||||
</pass>
|
</pass>
|
||||||
</technique>
|
</technique>
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
|
@ -155,7 +155,8 @@ _setlistener("/sim/signals/nasal-dir-initialized", func {
|
||||||
}
|
}
|
||||||
menuEnable("autopilot", isAutopilotMenuEnabled() );
|
menuEnable("autopilot", isAutopilotMenuEnabled() );
|
||||||
menuEnable("joystick-info", size(props.globals.getNode("/input/joysticks").getChildren("js")));
|
menuEnable("joystick-info", size(props.globals.getNode("/input/joysticks").getChildren("js")));
|
||||||
menuEnable("rendering-buffers", getprop("/sim/rendering/rembrandt"));
|
menuEnable("ambient-occlusion", getprop("/sim/rendering/rembrandt/enabled") and getprop("/sim/rendering/rembrandt/ambient-occlusion-buffers"));
|
||||||
|
menuEnable("rendering-buffers", getprop("/sim/rendering/rembrandt/enabled"));
|
||||||
|
|
||||||
# frame-per-second display
|
# frame-per-second display
|
||||||
var fps = props.globals.getNode("/sim/rendering/fps-display", 1);
|
var fps = props.globals.getNode("/sim/rendering/fps-display", 1);
|
||||||
|
|
|
@ -3,13 +3,16 @@ uniform sampler2D ao_tex;
|
||||||
uniform sampler2D normal_tex;
|
uniform sampler2D normal_tex;
|
||||||
uniform sampler2D spec_emis_tex;
|
uniform sampler2D spec_emis_tex;
|
||||||
uniform vec4 fg_SunAmbientColor;
|
uniform vec4 fg_SunAmbientColor;
|
||||||
|
uniform bool ambientOcclusion;
|
||||||
void main() {
|
void main() {
|
||||||
vec2 coords = gl_TexCoord[0].xy;
|
vec2 coords = gl_TexCoord[0].xy;
|
||||||
float initialized = texture2D( spec_emis_tex, coords ).a;
|
float initialized = texture2D( spec_emis_tex, coords ).a;
|
||||||
if ( initialized < 0.1 )
|
if ( initialized < 0.1 )
|
||||||
discard;
|
discard;
|
||||||
vec3 tcolor = texture2D( color_tex, coords ).rgb;
|
vec3 tcolor = texture2D( color_tex, coords ).rgb;
|
||||||
float ao = texture2D( ao_tex, coords ).r;
|
float ao = 1.0;
|
||||||
|
if (ambientOcclusion) {
|
||||||
|
ao = texture2D( ao_tex, coords ).r;
|
||||||
|
}
|
||||||
gl_FragColor = vec4(tcolor*fg_SunAmbientColor.rgb*ao, 1.0);
|
gl_FragColor = vec4(tcolor*fg_SunAmbientColor.rgb*ao, 1.0);
|
||||||
// gl_FragColor = vec4(tcolor*fg_SunAmbientColor.rgb, 1.0);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ uniform sampler2D ao_tex;
|
||||||
uniform float exposure;
|
uniform float exposure;
|
||||||
uniform bool showBuffers;
|
uniform bool showBuffers;
|
||||||
uniform bool fg_DepthInColor;
|
uniform bool fg_DepthInColor;
|
||||||
|
uniform bool ambientOcclusion;
|
||||||
|
|
||||||
vec3 HDR(vec3 L) {
|
vec3 HDR(vec3 L) {
|
||||||
L = L * exposure;
|
L = L * exposure;
|
||||||
|
@ -29,7 +30,7 @@ void main() {
|
||||||
color = texture2D( color_tex, (coords - vec2( 0.8, 0.0 )) * 5.0 );
|
color = texture2D( color_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 && fg_DepthInColor) {
|
||||||
color = texture2D( depth_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 );
|
color = texture2D( depth_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 );
|
||||||
} else if (coords.x < 0.2 && coords.y >= 0.8) {
|
} else if (coords.x < 0.2 && coords.y >= 0.8 && ambientOcclusion) {
|
||||||
color = texture2D( ao_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 );
|
color = texture2D( ao_tex, (coords - vec2( 0.0, 0.8 )) * 5.0 );
|
||||||
} else {
|
} else {
|
||||||
color = texture2D( lighting_tex, coords ) /* + texture2D( bloom_tex, coords ) */;
|
color = texture2D( lighting_tex, coords ) /* + texture2D( bloom_tex, coords ) */;
|
||||||
|
|
|
@ -99,6 +99,7 @@
|
||||||
<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>
|
||||||
|
|
||||||
<!-- Help menu -->
|
<!-- Help menu -->
|
||||||
|
|
|
@ -658,6 +658,15 @@
|
||||||
</binding>
|
</binding>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<name>ambient-occlusion</name>
|
||||||
|
<binding>
|
||||||
|
<command>property-toggle</command>
|
||||||
|
<property>/sim/rendering/rembrandt/ambient-occlusion</property>
|
||||||
|
</binding>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</item>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<name>rendering-buffers</name>
|
<name>rendering-buffers</name>
|
||||||
<binding>
|
<binding>
|
||||||
|
|
|
@ -67,10 +67,12 @@ Started September 2000 by David Megginson, david@megginson.com
|
||||||
<rembrandt>
|
<rembrandt>
|
||||||
<enabled type="bool">false</enabled>
|
<enabled type="bool">false</enabled>
|
||||||
<renderer>default-pipeline</renderer>
|
<renderer>default-pipeline</renderer>
|
||||||
<show-buffers type="bool" userarchive="y">true</show-buffers>
|
<show-buffers type="bool" userarchive="y">false</show-buffers>
|
||||||
<ambient-occlusion type="bool" userarchive="y">false</ambient-occlusion>
|
<ambient-occlusion type="bool" userarchive="y">false</ambient-occlusion>
|
||||||
|
<ambient-occlusion-buffers type="bool">true</ambient-occlusion-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>
|
||||||
|
<no-16bit-buffer type="bool">false</no-16bit-buffer>
|
||||||
</rembrandt>
|
</rembrandt>
|
||||||
<debug type="bool">false</debug>
|
<debug type="bool">false</debug>
|
||||||
<realism type="int">5</realism>
|
<realism type="int">5</realism>
|
||||||
|
|
Loading…
Reference in a new issue