diff --git a/Effects/display.eff b/Effects/display.eff index 1b82c6f4d..a5624dcf4 100644 --- a/Effects/display.eff +++ b/Effects/display.eff @@ -2,11 +2,27 @@ Effects/display - /sim/rendering/rembrandt/exposure /sim/rendering/rembrandt/show-buffers /sim/rendering/rembrandt/bloom /sim/rendering/rembrandt/bloom-strength /sim/rendering/rembrandt/bloom-buffers + + Textures\noise_tex.jpg + linear-mipmap-linear + repeat + repeat + normalized + + + + /sim/rendering/rembrandt/cinema/vignette + /sim/rendering/rembrandt/cinema/inner-circle + /sim/rendering/rembrandt/cinema/outer-circle + /sim/rendering/rembrandt/cinema/color-shift + /sim/rendering/rembrandt/cinema/red-shift + /sim/rendering/rembrandt/cinema/green-shift + /sim/rendering/rembrandt/cinema/blue-shift + /sim/rendering/rembrandt/debug-buffer[0]/enabled /sim/rendering/rembrandt/debug-buffer[0]/name @@ -17,6 +33,194 @@ /sim/rendering/rembrandt/debug-buffer[3]/enabled /sim/rendering/rembrandt/debug-buffer[3]/name + + + + + /sim/rendering/rembrandt/cinema/vignette + /sim/rendering/rembrandt/cinema/color-shift + + + 0.0 + /sim/rendering/rembrandt/show-buffers + + + + + + 99999 + RenderBin + + + 0 + buffer + lighting + + + 1 + buffer + bloom-3 + + + + Shaders/fullscreen.vert + Shaders/cinema.frag + + + lighting_tex + sampler-2d + 0 + + + bloom_tex + sampler-2d + 1 + + + + bloomEnabled + bool + bloom + + + bloomStrength + float + bloom-strength + + + bloomBuffers + bool + bloom-buffers + + + + vignette + bool + cinema/vignette + + + innerCircle + float + cinema/inner-circle + + + outerCircle + float + cinema/outer-circle + + + colorShift + bool + cinema/color-shift + + + redShift + float-vec3 + cinema/red-shift + + + greenShift + float-vec3 + cinema/green-shift + + + blueShift + float-vec3 + cinema/blue-shift + + + + + + + /sim/rendering/rembrandt/night-vision + + 0.0 + /sim/rendering/rembrandt/show-buffers + + + + + + 99999 + RenderBin + + + 0 + buffer + lighting + + + 1 + buffer + bloom-3 + + + 2 + buffer + spec-emis + + + 3 + buffer + diffuse + + + 4 + texture[0]/image + texture[0]/filter + texture[0]/wrap-s + texture[0]/wrap-t + texture[0]/internal-format + + + + Shaders/fullscreen.vert + Shaders/night-vision.frag + + + lighting_tex + sampler-2d + 0 + + + bloom_tex + sampler-2d + 1 + + + spec_emis_tex + sampler-2d + 2 + + + color_tex + sampler-2d + 3 + + + noise_tex + sampler-2d + 4 + + + + bloomEnabled + bool + bloom + + + bloomStrength + float + bloom-strength + + + bloomBuffers + bool + bloom-buffers + + + @@ -89,11 +293,6 @@ sampler-2d 5 - - exposure - float - exposure - showBuffers bool diff --git a/Shaders/cinema.frag b/Shaders/cinema.frag new file mode 100644 index 000000000..1352e4215 --- /dev/null +++ b/Shaders/cinema.frag @@ -0,0 +1,47 @@ +uniform sampler2D lighting_tex; +uniform sampler2D bloom_tex; + +uniform bool colorShift; +uniform vec3 redShift; +uniform vec3 greenShift; +uniform vec3 blueShift; + +uniform bool vignette; +uniform float innerCircle; +uniform float outerCircle; + +uniform vec2 fg_BufferSize; +// uniform float osg_SimulationTime; +// uniform float shutterFreq; +// uniform float shutterDuration; + +uniform bool bloomEnabled; +uniform float bloomStrength; +uniform bool bloomBuffers; + +void main() { + vec2 coords = gl_TexCoord[0].xy; + vec4 color = texture2D( lighting_tex, coords ); + if (bloomEnabled && bloomBuffers) + color = color + bloomStrength * texture2D( bloom_tex, coords ); + + if (colorShift) { + vec3 c2; + c2.r = dot(color, redShift); + c2.g = dot(color, greenShift); + c2.b = dot(color, blueShift); + color.rgb = c2; + } + + if (vignette) { + vec2 c = 2.0 * coords - vec2(1.,1.); + c = c * vec2( 1.0, fg_BufferSize.y / fg_BufferSize.x ); + float l = length(c); + float f = smoothstep( innerCircle, innerCircle * outerCircle, l ); + color.rgb = (1 - f) * color.rgb; + } + // if ((osg_FrameNumber % 6) == 0) + // f = 1.0; + + gl_FragColor = color; +} diff --git a/Shaders/display.frag b/Shaders/display.frag index 66205cd1b..3c07b9ec8 100644 --- a/Shaders/display.frag +++ b/Shaders/display.frag @@ -6,7 +6,6 @@ uniform sampler2D bufferNE_tex; uniform sampler2D bufferSW_tex; uniform sampler2D bufferSE_tex; -uniform float exposure; uniform bool showBuffers; uniform bool bloomEnabled; @@ -18,14 +17,6 @@ uniform bool bufferNE_enabled; uniform bool bufferSW_enabled; uniform bool bufferSE_enabled; -vec3 HDR(vec3 L) { - L = L * exposure; - L.r = L.r < 1.413 ? pow(L.r * 0.38317, 1.0 / 2.2) : 1.0 - exp(-L.r); - L.g = L.g < 1.413 ? pow(L.g * 0.38317, 1.0 / 2.2) : 1.0 - exp(-L.g); - L.b = L.b < 1.413 ? pow(L.b * 0.38317, 1.0 / 2.2) : 1.0 - exp(-L.b); - return L; -} - void main() { vec2 coords = gl_TexCoord[0].xy; vec4 color; @@ -42,13 +33,11 @@ void main() { color = texture2D( lighting_tex, coords ); if (bloomEnabled && bloomBuffers) color = color + bloomStrength * texture2D( bloom_tex, coords ); - //color = vec4( HDR( color.rgb ), 1.0 ); } } else { color = texture2D( lighting_tex, coords ); if (bloomEnabled && bloomBuffers) color = color + bloomStrength * texture2D( bloom_tex, coords ); - //color = vec4( HDR( color.rgb ), 1.0 ); } gl_FragColor = color; } diff --git a/Shaders/night-vision.frag b/Shaders/night-vision.frag new file mode 100644 index 000000000..86488b0d6 --- /dev/null +++ b/Shaders/night-vision.frag @@ -0,0 +1,42 @@ +// Night vision effect inspired by http://www.geeks3d.com/20091009/shader-library-night-vision-post-processing-filter-glsl/ + +uniform sampler2D color_tex; +uniform sampler2D lighting_tex; +uniform sampler2D bloom_tex; +uniform sampler2D spec_emis_tex; +uniform sampler2D noise_tex; + +uniform bool bloomEnabled; +uniform float bloomStrength; +uniform bool bloomBuffers; + +uniform vec2 fg_BufferSize; +uniform float osg_SimulationTime; + +void main() { + vec2 coords = gl_TexCoord[0].xy; + vec4 color; + vec2 uv; + uv.x = 0.4*sin(osg_SimulationTime*50.0); + uv.y = 0.4*cos(osg_SimulationTime*50.0); + vec3 n = texture2D(noise_tex, (coords*3.5) + uv).rgb; + + vec2 c1 = coords + (n.xy*0.005); + color = texture2D( lighting_tex, c1 ); + if (bloomEnabled && bloomBuffers) + color = color + bloomStrength * texture2D( bloom_tex, c1 ); + + float lum = dot(color.rgb, vec3(.3, .59, .11)); + color.rgb *= (4.0 - 3.0*smoothstep(0.2, 0.3, lum)); + + // color.rgb += texture2D( spec_emis_tex, c1 ).b; + // color.rgb += texture2D( bloom_tex, c1 ).rgb; + color.rgb = (color.rgb + (n*0.2)) * vec3(0.1, 0.95, 0.2); + + vec2 c = 2.0 * coords - vec2(1.,1.); + c = c * vec2( 1.0, fg_BufferSize.y / fg_BufferSize.x ); + float l = length(c); + float f = smoothstep( 0.7, 1.1, l ); + color.rgb = (1 - f) * color.rgb; + gl_FragColor = color; +} diff --git a/Textures/noise_tex.jpg b/Textures/noise_tex.jpg new file mode 100644 index 000000000..bad5ffd74 Binary files /dev/null and b/Textures/noise_tex.jpg differ diff --git a/gui/dialogs/rembrandt.xml b/gui/dialogs/rembrandt.xml index 7a6a2ed6b..2ea93a121 100644 --- a/gui/dialogs/rembrandt.xml +++ b/gui/dialogs/rembrandt.xml @@ -52,7 +52,7 @@ - 66 + 63 @@ -111,7 +111,7 @@ - -4 + -7 @@ -152,9 +152,9 @@ - + - + hbox left @@ -170,7 +170,7 @@ - 45 + 42 @@ -231,7 +231,7 @@ /sim/rendering/shadows/filtering - 67 + 222 @@ -289,18 +289,14 @@ /sim/rendering/shadows/num-cascades - 67 + 222 hbox right - - - 130 - - + @@ -373,6 +369,381 @@ shadow-cascade-4 + + 147 + + + + + + + hbox + left + + + left + + vignette + /sim/rendering/rembrandt/cinema/vignette + + dialog-apply + vignette + + + + 34 + + + + + /sim/rendering/rembrandt/cinema/vignette + + + + inner-circle + 0.0 + 1.5 + 0.01 + /sim/rendering/rembrandt/cinema/inner-circle + + dialog-apply + inner-circle + + + /sim/rendering/rembrandt/cinema/vignette + + + + + %.2f + true + /sim/rendering/rembrandt/cinema/inner-circle + + /sim/rendering/rembrandt/cinema/vignette + + + + + + hbox + right + + + + + /sim/rendering/rembrandt/cinema/vignette + + + + outer-circle + 1.0 + 2.0 + 0.01 + /sim/rendering/rembrandt/cinema/outer-circle + + dialog-apply + outer-circle + + + /sim/rendering/rembrandt/cinema/vignette + + + + + %.2f + true + /sim/rendering/rembrandt/cinema/outer-circle + + /sim/rendering/rembrandt/cinema/vignette + + + + 222 + + + + + + + hbox + left + + + left + + color-shift + /sim/rendering/rembrandt/cinema/color-shift + + dialog-apply + color-shift + + + + 37 + + + + + /sim/rendering/rembrandt/cinema/color-shift + + + + red-shift-r + 0.0 + 1.0 + 0.004 + /sim/rendering/rembrandt/cinema/red-shift/x + + dialog-apply + red-shift-r + + + /sim/rendering/rembrandt/cinema/color-shift + + + + + %.2f + true + /sim/rendering/rembrandt/cinema/red-shift/x + + /sim/rendering/rembrandt/cinema/color-shift + + + + red-shift-g + 0.0 + 1.0 + 0.004 + /sim/rendering/rembrandt/cinema/red-shift/y + + dialog-apply + red-shift-g + + + /sim/rendering/rembrandt/cinema/color-shift + + + + + %.2f + true + /sim/rendering/rembrandt/cinema/red-shift/y + + /sim/rendering/rembrandt/cinema/color-shift + + + + red-shift-b + 0.0 + 1.0 + 0.004 + /sim/rendering/rembrandt/cinema/red-shift/z + + dialog-apply + red-shift-b + + + /sim/rendering/rembrandt/cinema/color-shift + + + + + %.2f + true + /sim/rendering/rembrandt/cinema/red-shift/z + + /sim/rendering/rembrandt/cinema/color-shift + + + + + + hbox + right + + + + + /sim/rendering/rembrandt/cinema/color-shift + + + + green-shift-r + 0.0 + 1.0 + 0.004 + /sim/rendering/rembrandt/cinema/green-shift/x + + dialog-apply + green-shift-r + + + /sim/rendering/rembrandt/cinema/color-shift + + + + + %.2f + true + /sim/rendering/rembrandt/cinema/green-shift/x + + /sim/rendering/rembrandt/cinema/color-shift + + + + green-shift-g + 0.0 + 1.0 + 0.004 + /sim/rendering/rembrandt/cinema/green-shift/y + + dialog-apply + green-shift-g + + + /sim/rendering/rembrandt/cinema/color-shift + + + + + %.2f + true + /sim/rendering/rembrandt/cinema/green-shift/y + + /sim/rendering/rembrandt/cinema/color-shift + + + + green-shift-b + 0.0 + 1.0 + 0.004 + /sim/rendering/rembrandt/cinema/green-shift/z + + dialog-apply + green-shift-b + + + /sim/rendering/rembrandt/cinema/color-shift + + + + + %.2f + true + /sim/rendering/rembrandt/cinema/green-shift/z + + /sim/rendering/rembrandt/cinema/color-shift + + + + + + hbox + right + + + + + /sim/rendering/rembrandt/cinema/color-shift + + + + blue-shift-r + 0.0 + 1.0 + 0.004 + /sim/rendering/rembrandt/cinema/blue-shift/x + + dialog-apply + blue-shift-r + + + /sim/rendering/rembrandt/cinema/color-shift + + + + + %.2f + true + /sim/rendering/rembrandt/cinema/blue-shift/x + + /sim/rendering/rembrandt/cinema/color-shift + + + + blue-shift-g + 0.0 + 1.0 + 0.004 + /sim/rendering/rembrandt/cinema/blue-shift/y + + dialog-apply + blue-shift-g + + + /sim/rendering/rembrandt/cinema/color-shift + + + + + %.2f + true + /sim/rendering/rembrandt/cinema/blue-shift/y + + /sim/rendering/rembrandt/cinema/color-shift + + + + blue-shift-b + 0.0 + 1.0 + 0.004 + /sim/rendering/rembrandt/cinema/blue-shift/z + + dialog-apply + blue-shift-b + + + /sim/rendering/rembrandt/cinema/color-shift + + + + + %.2f + true + /sim/rendering/rembrandt/cinema/blue-shift/z + + /sim/rendering/rembrandt/cinema/color-shift + + + + + + + + hbox + left + + + left + + night-vision + /sim/rendering/rembrandt/night-vision + + dialog-apply + night-vision + + + + + /sim/rendering/rembrandt/cinema/color-shift + /sim/rendering/rembrandt/cinema/vignette + + + + diff --git a/preferences.xml b/preferences.xml index da199b548..02435746e 100644 --- a/preferences.xml +++ b/preferences.xml @@ -72,6 +72,28 @@ Started September 2000 by David Megginson, david@megginson.com true 1.0 true + false + + false + 0.8 + 1.3 + false + + .393 + .769 + .189 + + + .349 + .686 + .168 + + + .272 + .534 + .131 + + 1.0 false true