From 0f3c78a8c731f9153165542a9035f735fa7b0ef4 Mon Sep 17 00:00:00 2001 From: Firemark Date: Thu, 31 Jul 2014 22:21:14 +0200 Subject: [PATCH 01/12] modify shaders --- app/PreprocessedTerminal.qml | 5 +++-- app/ShaderTerminal.qml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/PreprocessedTerminal.qml b/app/PreprocessedTerminal.qml index 773d00a..da24f08 100644 --- a/app/PreprocessedTerminal.qml +++ b/app/PreprocessedTerminal.qml @@ -218,7 +218,7 @@ Item{ id: finalSource sourceItem: blurredterminal sourceRect: frame.sourceRect - format: ShaderEffectSource.Alpha + //format: ShaderEffectSource.Alpha hideSource: true } ShaderEffect { @@ -261,7 +261,8 @@ Item{ : "") + - "gl_FragColor.a = floor(color) / 256.0;" + + "gl_FragColor = texture2D(source, coords);" + + "gl_FragColor.a = color / 256.0;" + "}" onStatusChanged: if (log) console.log(log) //Print warning messages diff --git a/app/ShaderTerminal.qml b/app/ShaderTerminal.qml index ad3b1d7..5fe5f15 100644 --- a/app/ShaderTerminal.qml +++ b/app/ShaderTerminal.qml @@ -183,8 +183,8 @@ ShaderEffect { (glowing_line_strength !== 0 ? " color += randomPass(coords) * glowing_line_strength;" : "") + - - "vec3 finalColor = mix(background_color, font_color, color).rgb;" + + "vec4 new_font_color = mix(texture2D(source, txt_coords), font_color, 0.2);" + + "vec3 finalColor = mix(background_color, new_font_color, color).rgb;" + "finalColor *= texture2D(rasterizationSource, coords).a;" + (bloom !== 0 ? " @@ -194,6 +194,7 @@ ShaderEffect { finalColor *= brightness;" : "") + "gl_FragColor = vec4(finalColor *"+str(brightness)+", qt_Opacity); + //gl_FragColor = texture2D(source, txt_coords); }" onStatusChanged: if (log) console.log(log) //Print warning messages From f167b4d4478b4ec6d6f81c937ac049cef51d992e Mon Sep 17 00:00:00 2001 From: Firemark Date: Thu, 31 Jul 2014 22:41:54 +0200 Subject: [PATCH 02/12] support many colors in terminal --- app/ShaderTerminal.qml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/ShaderTerminal.qml b/app/ShaderTerminal.qml index 5fe5f15..26a9729 100644 --- a/app/ShaderTerminal.qml +++ b/app/ShaderTerminal.qml @@ -175,7 +175,7 @@ ShaderEffect { vec2 txt_coords = coords + offset * "+str(jitter)+";" : "vec2 txt_coords = coords;") + - "float color = texture2D(source, txt_coords).a;" + + "float color = 0.0;" + (noise_strength !== 0 ? " float noiseVal = texture2D(noiseSource, qt_TexCoord0 + vec2(fract(time / 51.0), fract(time / 237.0))).a; @@ -183,19 +183,22 @@ ShaderEffect { (glowing_line_strength !== 0 ? " color += randomPass(coords) * glowing_line_strength;" : "") + - "vec4 new_font_color = mix(texture2D(source, txt_coords), font_color, 0.2);" + - "vec3 finalColor = mix(background_color, new_font_color, color).rgb;" + + + "vec4 realBackColor = texture2D(source, txt_coords);" + + "vec4 mixedColor = mix(realBackColor * font_color, font_color, 0.0);" + + "vec4 finalBackColor = mix(background_color, mixedColor, realBackColor.a);" + + "vec3 finalColor = mix(finalBackColor, font_color, color).rgb;" + "finalColor *= texture2D(rasterizationSource, coords).a;" + (bloom !== 0 ? " - finalColor += font_color.rgb * texture2D(bloomSource, coords).r *" + str(bloom) + ";" : "") + + finalColor += font_color.rgb *" + + "dot(texture2D(bloomSource, coords).rgb, vec3(0.299, 0.587, 0.114)) *" + str(bloom) + ";" : "") + (brightness_flickering !== 0 ? " finalColor *= brightness;" : "") + - "gl_FragColor = vec4(finalColor *"+str(brightness)+", qt_Opacity); - //gl_FragColor = texture2D(source, txt_coords); - }" + "gl_FragColor = vec4(finalColor *"+str(brightness)+", qt_Opacity);" + + "}" onStatusChanged: if (log) console.log(log) //Print warning messages } From e3d8992a35fbf852fc63369b3d71e899966a5697 Mon Sep 17 00:00:00 2001 From: Firemark Date: Fri, 1 Aug 2014 00:04:59 +0200 Subject: [PATCH 03/12] Add two settings to change colors. --- app/ApplicationSettings.qml | 9 +++++++- app/SettingsTerminalTab.qml | 42 ++++++++++++++++++++++++------------- app/ShaderTerminal.qml | 21 +++++++++++++++---- 3 files changed, 53 insertions(+), 19 deletions(-) diff --git a/app/ApplicationSettings.qml b/app/ApplicationSettings.qml index 9daf9b2..d6e9a58 100644 --- a/app/ApplicationSettings.qml +++ b/app/ApplicationSettings.qml @@ -67,6 +67,9 @@ Item{ property real motion_blur: 0.40 property real bloom_strength: 0.65 + property real chroma_color: 0.0 + property real saturation_color: 0.0 + property real jitter: 0.18 property real horizontal_sincronization: 0.08 @@ -171,6 +174,8 @@ Item{ brightness_flickering: brightness_flickering, horizontal_sincronization: horizontal_sincronization, noise_strength: noise_strength, + chroma_color: chroma_color, + saturation_color: saturation_color, screen_distortion: screen_distortion, glowing_line_strength: glowing_line_strength, frames_index: frames_index, @@ -234,6 +239,8 @@ Item{ horizontal_sincronization = settings.horizontal_sincronization !== undefined ? settings.horizontal_sincronization : horizontal_sincronization brightness_flickering = settings.brightness_flickering !== undefined ? settings.brightness_flickering : brightness_flickering; noise_strength = settings.noise_strength !== undefined ? settings.noise_strength : noise_strength; + chroma_color = settings.chroma_color !== undefined ? settings.chroma_color : chroma_color; + saturation_color = settings.saturation_color !== undefined ? settings.saturation_color : saturation_color; screen_distortion = settings.screen_distortion !== undefined ? settings.screen_distortion : screen_distortion; glowing_line_strength = settings.glowing_line_strength !== undefined ? settings.glowing_line_strength : glowing_line_strength; @@ -333,7 +340,7 @@ Item{ } ListElement{ text: "IBM Dos" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":1}' builtin: true } ListElement{ diff --git a/app/SettingsTerminalTab.qml b/app/SettingsTerminalTab.qml index 04e473f..07f5ba6 100644 --- a/app/SettingsTerminalTab.qml +++ b/app/SettingsTerminalTab.qml @@ -92,21 +92,35 @@ Tab{ GroupBox{ title: qsTr("Colors") Layout.fillWidth: true - RowLayout{ - anchors.fill: parent - ColorButton{ - name: qsTr("Font") - height: 50 - Layout.fillWidth: true - onColorSelected: shadersettings._font_color = color; - button_color: shadersettings._font_color + ColumnLayout{ + RowLayout{ + anchors.fill: parent + ColorButton{ + name: qsTr("Font") + height: 50 + Layout.fillWidth: true + onColorSelected: shadersettings._font_color = color; + button_color: shadersettings._font_color + } + ColorButton{ + name: qsTr("Background") + height: 50 + Layout.fillWidth: true + onColorSelected: shadersettings._background_color = color; + button_color: shadersettings._background_color + } } - ColorButton{ - name: qsTr("Background") - height: 50 - Layout.fillWidth: true - onColorSelected: shadersettings._background_color = color; - button_color: shadersettings._background_color + ColumnLayout{ + CheckableSlider{ + name: qsTr("Chroma Color") + onValueChanged: shadersettings.chroma_color = value + _value: shadersettings.chroma_color + } + CheckableSlider{ + name: qsTr("Saturation Color") + onValueChanged: shadersettings.saturation_color = value + _value: shadersettings.saturation_color + } } } } diff --git a/app/ShaderTerminal.qml b/app/ShaderTerminal.qml index 26a9729..9a411d5 100644 --- a/app/ShaderTerminal.qml +++ b/app/ShaderTerminal.qml @@ -39,6 +39,9 @@ ShaderEffect { property real screen_distorsion: shadersettings.screen_distortion property real glowing_line_strength: shadersettings.glowing_line_strength + property real chroma_color: shadersettings.chroma_color; + property real saturation_color: shadersettings.saturation_color; + property real brightness_flickering: shadersettings.brightness_flickering property real horizontal_sincronization: shadersettings.horizontal_sincronization @@ -184,10 +187,20 @@ ShaderEffect { (glowing_line_strength !== 0 ? " color += randomPass(coords) * glowing_line_strength;" : "") + - "vec4 realBackColor = texture2D(source, txt_coords);" + - "vec4 mixedColor = mix(realBackColor * font_color, font_color, 0.0);" + - "vec4 finalBackColor = mix(background_color, mixedColor, realBackColor.a);" + - "vec3 finalColor = mix(finalBackColor, font_color, color).rgb;" + + (chroma_color !== 0 ? + "vec4 realBackColor = texture2D(source, txt_coords);" + + (saturation_color !== 0 ? + "vec4 satured_font_color = mix(font_color, vec4(1) , "+ str(saturation_color) + ");" + + "vec4 mixedColor = mix(font_color, realBackColor * satured_font_color, "+ str(chroma_color) +");": + "vec4 mixedColor = mix(font_color, realBackColor * font_color, "+ str(chroma_color) +");" + ) + + + "vec4 finalBackColor = mix(background_color, mixedColor, realBackColor.a);" + + "vec3 finalColor = mix(finalBackColor, font_color, color).rgb;" : + "color += texture2D(source, txt_coords).a;" + + "vec3 finalColor = mix(background_color, font_color, color).rgb;" + ) + + "finalColor *= texture2D(rasterizationSource, coords).a;" + (bloom !== 0 ? " From e1ac0a35b4defb3fea3f95ac2a92e5a1d59d205c Mon Sep 17 00:00:00 2001 From: Firemark Date: Fri, 1 Aug 2014 00:21:34 +0200 Subject: [PATCH 04/12] Change colors in color scheme --- app/ApplicationSettings.qml | 16 ++++++------ .../assets/color-schemes/cool-old-term.schema | 25 ++++++++++--------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/app/ApplicationSettings.qml b/app/ApplicationSettings.qml index d6e9a58..35a12e8 100644 --- a/app/ApplicationSettings.qml +++ b/app/ApplicationSettings.qml @@ -310,42 +310,42 @@ Item{ id: profileslist ListElement{ text: "Default Amber" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.4,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.65,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.4,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "Default Green" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.08,"jitter":0.18,"motion_blur":0.45,"noise_strength":0.1,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "Default Scanlines" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#00ff5b","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.07,"jitter":0.11,"motion_blur":0.4,"noise_strength":0.05,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "Default Pixelated" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.1,"contrast":0.85,"fontIndex":0,"font_color":"#ff8100","frames_index":1,"glowing_line_strength":0.2,"horizontal_sincronization":0.1,"jitter":0,"motion_blur":0.45,"noise_strength":0.14,"rasterization":2,"screen_distortion":0.05,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "Apple ][" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.5,"brightness":0.5,"brightness_flickering":0.2,"contrast":0.85,"fontIndex":2,"font_color":"#2fff91","frames_index":1,"glowing_line_strength":0.22,"horizontal_sincronization":0.08,"jitter":0.1,"motion_blur":0.65,"noise_strength":0.08,"rasterization":1,"screen_distortion":0.18,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "Vintage" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontIndex":0,"font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.54,"contrast":0.85,"fontIndex":0,"font_color":"#00ff3e","frames_index":2,"glowing_line_strength":0.3,"horizontal_sincronization":0.2,"jitter":0.4,"motion_blur":0.75,"noise_strength":0.2,"rasterization":1,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":0,"saturation_color":0}' builtin: true } ListElement{ text: "IBM Dos" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":1}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4,"brightness":0.5,"brightness_flickering":0.07,"contrast":0.85,"fontIndex":7,"font_color":"#ffffff","frames_index":1,"glowing_line_strength":0.13,"horizontal_sincronization":0,"jitter":0.08,"motion_blur":0.3,"noise_strength":0.03,"rasterization":0,"screen_distortion":0.1,"windowOpacity":1,"chroma_color":1,"saturation_color":0}' builtin: true } ListElement{ text: "Transparent Green" - obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4549689440993788,"brightness":0.5,"brightness_flickering":0.20341614906832298,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.15993788819875776,"horizontal_sincronization":0.05045871559633028,"jitter":0.20341614906832298,"motion_blur":0.24999999999999997,"noise_strength":0.20031055900621117,"rasterization":0,"screen_distortion":0.05045871559633028,"windowOpacity":0.5956221198156681}' + obj_string: '{"ambient_light":0.2,"background_color":"#000000","bloom_strength":0.4549689440993788,"brightness":0.5,"brightness_flickering":0.20341614906832298,"contrast":0.85,"fontIndex":0,"font_color":"#0ccc68","frames_index":0,"glowing_line_strength":0.15993788819875776,"horizontal_sincronization":0.05045871559633028,"jitter":0.20341614906832298,"motion_blur":0.24999999999999997,"noise_strength":0.20031055900621117,"rasterization":0,"screen_distortion":0.05045871559633028,"windowOpacity":0.5956221198156681,"chroma_color":0,"saturation_color":0}' builtin: true } } diff --git a/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema b/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema index 4df8184..6687f35 100644 --- a/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema +++ b/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema @@ -36,22 +36,23 @@ color 1 0 0 0 1 0 # regular background color (Black) color 2 0 0 0 0 0 # regular color 0 Black -color 3 59 59 59 0 0 # regular color 1 Red +color 3 255 43 43 0 0 # regular color 1 Red -color 4 137 137 137 0 0 # regular color 2 Green +color 4 0 28 172 120 0 0 # regular color 2 Green -color 5 116 116 116 0 0 # regular color 3 Yellow +color 5 248 213 104 0 0 # regular color 3 Yellow -color 6 39 39 39 0 0 # regular color 4 Blue +color 6 0 43 108 196 # regular color 4 Blue -color 7 70 70 70 0 0 # regular color 5 Magenta +color 7 255 29 206 0 0 # regular color 5 Magenta -color 8 148 148 148 0 0 # regular color 6 Cyan +color 8 24 167 181 0 0 # regular color 6 Cyan color 9 179 179 179 0 0 # regular color 7 White + # intensive colors @@ -68,17 +69,17 @@ color 11 0 0 0 1 0 # intensive background color color 12 106 106 106 0 0 # intensive color 0 -color 13 122 122 122 0 0 # intensive color 1 +color 13 253 94 83 0 0 # intensive color 1 -color 14 207 207 207 0 0 # intensive color 2 +color 14 168 228 160 0 0 # intensive color 2 -color 15 243 243 243 0 0 # intensive color 3 +color 15 254 254 34 0 0 # intensive color 3 -color 16 99 99 99 0 0 # intensive color 4 +color 16 154 206 235 0 0 # intensive color 4 -color 17 134 134 134 0 0 # intensive color 5 +color 17 252 116 253 0 0 # intensive color 5 -color 18 219 219 219 0 0 # intensive color 6 +color 18 236 234 190 0 0 # intensive color 6 color 19 255 255 255 0 0 # intensive color 7 From 876e6079d469b2101a90fede89e2d8a29ac0a33f Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sat, 2 Aug 2014 20:03:16 +0200 Subject: [PATCH 05/12] Fix: color layout in settings window. --- app/SettingsTerminalTab.qml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/SettingsTerminalTab.qml b/app/SettingsTerminalTab.qml index 07f5ba6..f8116c8 100644 --- a/app/SettingsTerminalTab.qml +++ b/app/SettingsTerminalTab.qml @@ -93,8 +93,9 @@ Tab{ title: qsTr("Colors") Layout.fillWidth: true ColumnLayout{ + anchors.fill: parent RowLayout{ - anchors.fill: parent + Layout.fillWidth: true ColorButton{ name: qsTr("Font") height: 50 @@ -111,6 +112,7 @@ Tab{ } } ColumnLayout{ + Layout.fillWidth: true CheckableSlider{ name: qsTr("Chroma Color") onValueChanged: shadersettings.chroma_color = value From 4b4fabaee34d3104bb3aae3e9880213d9079343a Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sun, 3 Aug 2014 10:36:07 +0200 Subject: [PATCH 06/12] Fix issues between colors and motion blur. --- app/PreprocessedTerminal.qml | 8 +++++--- app/ShaderTerminal.qml | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/PreprocessedTerminal.qml b/app/PreprocessedTerminal.qml index 223e2e5..b3b5553 100644 --- a/app/PreprocessedTerminal.qml +++ b/app/PreprocessedTerminal.qml @@ -255,16 +255,18 @@ Item{ : "") + "coords = coords + delta;" + "vec4 vcolor = texture2D(source, coords) * 256.0; - float color = vcolor.r * 0.21 + vcolor.g * 0.72 + vcolor.b + 0.04;" + + float color = vcolor.r * 0.21 + vcolor.g * 0.72 + vcolor.b * 0.04;" + (mBlur !== 0 ? + "vec4 blurredVcolor = texture2D(blurredSource, coords) * 256.0;" + "float blurredSourceColor = texture2D(blurredSource, coords).a * 256.0;" + "blurredSourceColor = blurredSourceColor - blurredSourceColor * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" + + "vcolor = step(1.0, color) * vcolor + step(color, 1.0) * blurredVcolor;" + "color = step(1.0, color) * color + step(color, 1.0) * blurredSourceColor;" : "") + - "gl_FragColor = texture2D(source, coords);" + - "gl_FragColor.a = color / 256.0;" + + "gl_FragColor = floor(vcolor) / 256.0;" + + "gl_FragColor.a = floor(color) / 256.0;" + "}" onStatusChanged: if (log) console.log(log) //Print warning messages diff --git a/app/ShaderTerminal.qml b/app/ShaderTerminal.qml index 9a411d5..a2e1c0d 100644 --- a/app/ShaderTerminal.qml +++ b/app/ShaderTerminal.qml @@ -191,7 +191,8 @@ ShaderEffect { "vec4 realBackColor = texture2D(source, txt_coords);" + (saturation_color !== 0 ? "vec4 satured_font_color = mix(font_color, vec4(1) , "+ str(saturation_color) + ");" + - "vec4 mixedColor = mix(font_color, realBackColor * satured_font_color, "+ str(chroma_color) +");": + "vec4 mixedColor = mix(font_color, realBackColor * satured_font_color, "+ str(chroma_color) +");" + : "vec4 mixedColor = mix(font_color, realBackColor * font_color, "+ str(chroma_color) +");" ) + From a7210c69ed999e8f6d0a385ab7cb3f8b4bcfffe8 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sun, 3 Aug 2014 10:44:25 +0200 Subject: [PATCH 07/12] Fix incorrect colors scheme. --- konsole-qml-plugin/assets/color-schemes/cool-old-term.schema | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema b/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema index 6687f35..b9340a7 100644 --- a/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema +++ b/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema @@ -38,11 +38,11 @@ color 2 0 0 0 0 0 # regular color 0 Black color 3 255 43 43 0 0 # regular color 1 Red -color 4 0 28 172 120 0 0 # regular color 2 Green +color 4 28 172 120 0 0 # regular color 2 Green color 5 248 213 104 0 0 # regular color 3 Yellow -color 6 0 43 108 196 # regular color 4 Blue +color 6 43 108 196 0 0 # regular color 4 Blue color 7 255 29 206 0 0 # regular color 5 Magenta From 1902e34d04cc8092f2ab1c422df730e8bca79560 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sun, 3 Aug 2014 14:43:36 +0200 Subject: [PATCH 08/12] Fix issues between colors and bloom. --- app/PreprocessedTerminal.qml | 6 +++++- app/ShaderTerminal.qml | 23 ++++++++++++++++------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/PreprocessedTerminal.qml b/app/PreprocessedTerminal.qml index b3b5553..11f6cc5 100644 --- a/app/PreprocessedTerminal.qml +++ b/app/PreprocessedTerminal.qml @@ -246,6 +246,10 @@ Item{ "uniform lowp sampler2D blurredSource;" : "") + + "float rgb2grey(vec3 v){ + return dot(v, vec3(0.21, 0.72, 0.04)); + }" + + "void main() {" + "vec2 coords = qt_TexCoord0;" + (mScanlines != shadersettings.no_rasterization ? " @@ -255,7 +259,7 @@ Item{ : "") + "coords = coords + delta;" + "vec4 vcolor = texture2D(source, coords) * 256.0; - float color = vcolor.r * 0.21 + vcolor.g * 0.72 + vcolor.b * 0.04;" + + float color = rgb2grey(vcolor);" + (mBlur !== 0 ? "vec4 blurredVcolor = texture2D(blurredSource, coords) * 256.0;" + "float blurredSourceColor = texture2D(blurredSource, coords).a * 256.0;" + diff --git a/app/ShaderTerminal.qml b/app/ShaderTerminal.qml index a2e1c0d..f53d077 100644 --- a/app/ShaderTerminal.qml +++ b/app/ShaderTerminal.qml @@ -146,6 +146,9 @@ ShaderEffect { return fract(smoothstep(-0.2, 0.0, coords.y - 3.0 * fract(time * 0.0001))) * glowing_line_strength; }" : "") + + "float rgb2grey(vec3 v){ + return dot(v, vec3(0.21, 0.72, 0.04)); + }" + "void main() {" + "vec2 cc = vec2(0.5) - qt_TexCoord0;" + @@ -187,26 +190,32 @@ ShaderEffect { (glowing_line_strength !== 0 ? " color += randomPass(coords) * glowing_line_strength;" : "") + - (chroma_color !== 0 ? + (chroma_color !== 0 ? "vec4 realBackColor = texture2D(source, txt_coords);" + (saturation_color !== 0 ? "vec4 satured_font_color = mix(font_color, vec4(1) , "+ str(saturation_color) + ");" + "vec4 mixedColor = mix(font_color, realBackColor * satured_font_color, "+ str(chroma_color) +");" : "vec4 mixedColor = mix(font_color, realBackColor * font_color, "+ str(chroma_color) +");" - ) + - + ) + + "vec4 finalBackColor = mix(background_color, mixedColor, realBackColor.a);" + - "vec3 finalColor = mix(finalBackColor, font_color, color).rgb;" : + "vec3 finalColor = mix(finalBackColor, font_color, color).rgb;" + : "color += texture2D(source, txt_coords).a;" + "vec3 finalColor = mix(background_color, font_color, color).rgb;" ) + "finalColor *= texture2D(rasterizationSource, coords).a;" + - (bloom !== 0 ? " - finalColor += font_color.rgb *" + - "dot(texture2D(bloomSource, coords).rgb, vec3(0.299, 0.587, 0.114)) *" + str(bloom) + ";" : "") + + (bloom !== 0 ? + "vec3 bloomColor = texture2D(bloomSource, coords).rgb;" + + (chroma_color !== 0 ? + "bloomColor = font_color.rgb * mix(vec3(rgb2grey(bloomColor)), bloomColor, "+str(chroma_color)+");" + : + "bloomColor = font_color.rgb * rgb2grey(bloomColor);") + + "finalColor += bloomColor * "+str(bloom)+";" + : "") + (brightness_flickering !== 0 ? " finalColor *= brightness;" : "") + From f4771d4f37408275ac4f06ec9ef8849827db3239 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Sun, 3 Aug 2014 16:39:28 +0200 Subject: [PATCH 09/12] Rewrite motion blur with colors. It now simpler. --- app/PreprocessedTerminal.qml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/app/PreprocessedTerminal.qml b/app/PreprocessedTerminal.qml index 11f6cc5..7720f49 100644 --- a/app/PreprocessedTerminal.qml +++ b/app/PreprocessedTerminal.qml @@ -220,7 +220,6 @@ Item{ id: finalSource sourceItem: blurredterminal sourceRect: frame.sourceRect - //format: ShaderEffectSource.Alpha hideSource: true } ShaderEffect { @@ -258,19 +257,18 @@ Item{ coords.x = floor(virtual_resolution.x * coords.x) / virtual_resolution.x;" : "") : "") + "coords = coords + delta;" + - "vec4 vcolor = texture2D(source, coords) * 256.0; - float color = rgb2grey(vcolor);" + + + "vec4 color = texture2D(source, coords) * 256.0; + color.a = rgb2grey(color.rgb);" + + (mBlur !== 0 ? - "vec4 blurredVcolor = texture2D(blurredSource, coords) * 256.0;" + - "float blurredSourceColor = texture2D(blurredSource, coords).a * 256.0;" + - "blurredSourceColor = blurredSourceColor - blurredSourceColor * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" + - "vcolor = step(1.0, color) * vcolor + step(color, 1.0) * blurredVcolor;" + - "color = step(1.0, color) * color + step(color, 1.0) * blurredSourceColor;" + "vec4 blur_color = texture2D(blurredSource, coords) * 256.0;" + + "blur_color.a = blur_color.a - blur_color.a * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" + + "color = step(1.0, color.a) * color + step(color.a, 1.0) * blur_color;" : "") + - "gl_FragColor = floor(vcolor) / 256.0;" + - "gl_FragColor.a = floor(color) / 256.0;" + + "gl_FragColor = floor(color) / 256.0;" + "}" onStatusChanged: if (log) console.log(log) //Print warning messages From 7f5a47f8a42edef1e1fb9f689b1463747ef5774d Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Wed, 6 Aug 2014 19:07:30 +0200 Subject: [PATCH 10/12] Use offline saturation color. Better and a little bit faster. --- app/ApplicationSettings.qml | 5 +++-- app/ShaderTerminal.qml | 7 +------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/ApplicationSettings.qml b/app/ApplicationSettings.qml index 386e110..5d38948 100644 --- a/app/ApplicationSettings.qml +++ b/app/ApplicationSettings.qml @@ -59,8 +59,9 @@ Item{ property string _background_color: "#000000" property string _font_color: "#ff8100" - property color font_color: mix(strToColor(_font_color), strToColor(_background_color), 0.7 + (contrast * 0.3)) - property color background_color: mix(strToColor(_background_color), strToColor(_font_color), 0.7 + (contrast * 0.3)) + property string saturated_color: mix(strToColor("#FFFFFF"), strToColor(_font_color), saturation_color) + property color font_color: mix(strToColor(saturated_color), strToColor(_background_color), 0.7 + (contrast * 0.3)) + property color background_color: mix(strToColor(_background_color), strToColor(saturated_color), 0.7 + (contrast * 0.3)) property real noise_strength: 0.1 property real screen_distortion: 0.1 diff --git a/app/ShaderTerminal.qml b/app/ShaderTerminal.qml index f53d077..b4b12e1 100644 --- a/app/ShaderTerminal.qml +++ b/app/ShaderTerminal.qml @@ -192,12 +192,7 @@ ShaderEffect { (chroma_color !== 0 ? "vec4 realBackColor = texture2D(source, txt_coords);" + - (saturation_color !== 0 ? - "vec4 satured_font_color = mix(font_color, vec4(1) , "+ str(saturation_color) + ");" + - "vec4 mixedColor = mix(font_color, realBackColor * satured_font_color, "+ str(chroma_color) +");" - : - "vec4 mixedColor = mix(font_color, realBackColor * font_color, "+ str(chroma_color) +");" - ) + + "vec4 mixedColor = mix(font_color, realBackColor * font_color, "+ str(chroma_color) +");" + "vec4 finalBackColor = mix(background_color, mixedColor, realBackColor.a);" + "vec3 finalColor = mix(finalBackColor, font_color, color).rgb;" From 40d34c2cca6ca05a72775499c161db3e58c97c2a Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Thu, 7 Aug 2014 00:18:44 +0200 Subject: [PATCH 11/12] Fix: colors play nicely with frames reflections now. --- app/frames/utils/FrameShader.qml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/frames/utils/FrameShader.qml b/app/frames/utils/FrameShader.qml index fee9045..78a1142 100644 --- a/app/frames/utils/FrameShader.qml +++ b/app/frames/utils/FrameShader.qml @@ -13,6 +13,8 @@ ShaderEffect{ property bool frameReflections: shadersettings.frameReflections property variant lightSource: reflectionEffectSourceLoader.item + property real chroma_color: shadersettings.chroma_color + Loader{ id: reflectionEffectLoader width: parent.width * 0.33 @@ -62,6 +64,10 @@ ShaderEffect{ return (coords + cc * (1.0 + dist) * dist); } + float rgb2grey(vec3 v){ + return dot(v, vec3(0.21, 0.72, 0.04)); + } + void main(){ vec2 coords = distortCoordinates(qt_TexCoord0); vec4 txt_color = texture2D(source, coords); @@ -72,16 +78,20 @@ ShaderEffect{ float dotProd = dot(normal, light_direction);" + (frameReflections ? " - float screenLight = texture2D(lightSource, coords).r; + vec3 realLightColor = texture2D(lightSource, coords).rgb; + float screenLight = rgb2grey(realLightColor); float clampedDotProd = clamp(dotProd, 0.05, 1.0); float diffuseReflection = clamp(screenLight * 1.5 * clampedDotProd, 0.0, 0.35); - float reflectionAlpha = mix(1.0, 0.90, dotProd);" + float reflectionAlpha = mix(1.0, 0.90, dotProd); + vec3 lightColor = mix(font_color.rgb * screenLight, font_color.rgb * realLightColor, "+chroma_color.toFixed(2)+");" : " float diffuseReflection = 0.0; - float reflectionAlpha = 1.0;") + " + float reflectionAlpha = 1.0; + vec3 lightColor = font_color.rgb;") + " + vec3 back_color = background_color.rgb * (0.2 + 0.5 * dotProd); - vec3 front_color = font_color.rgb * (0.05 + diffuseReflection); + vec3 front_color = lightColor * (0.05 + diffuseReflection); vec4 dark_color = vec4((back_color + front_color) * txt_normal.a, txt_normal.a * reflectionAlpha); gl_FragColor = mix(dark_color, txt_color, ambient_light); From 307f6403273b8c2e9cf5d14eb32ffb43063e9b27 Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Thu, 7 Aug 2014 00:21:40 +0200 Subject: [PATCH 12/12] Capping saturation to 50% --- app/ApplicationSettings.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ApplicationSettings.qml b/app/ApplicationSettings.qml index 5d38948..242f681 100644 --- a/app/ApplicationSettings.qml +++ b/app/ApplicationSettings.qml @@ -59,7 +59,7 @@ Item{ property string _background_color: "#000000" property string _font_color: "#ff8100" - property string saturated_color: mix(strToColor("#FFFFFF"), strToColor(_font_color), saturation_color) + property string saturated_color: mix(strToColor("#FFFFFF"), strToColor(_font_color), saturation_color * 0.5) property color font_color: mix(strToColor(saturated_color), strToColor(_background_color), 0.7 + (contrast * 0.3)) property color background_color: mix(strToColor(_background_color), strToColor(saturated_color), 0.7 + (contrast * 0.3))