Now ambient reflection is integrated in the screen frame. This improves performances and quality.

This commit is contained in:
Filippo Scognamiglio 2014-04-17 15:20:15 +02:00
parent 475f6bde37
commit 6f34085f7b
7 changed files with 4 additions and 17 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.0.1, 2014-04-17T13:17:40. --> <!-- Written by QtCreator 3.0.1, 2014-04-17T14:53:07. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 571 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 571 KiB

After

Width:  |  Height:  |  Size: 811 KiB

View File

@ -64,12 +64,10 @@ ShaderEffect{
vec4 txt_normal = texture2D(normals, coords); vec4 txt_normal = texture2D(normals, coords);
vec3 normal = normalize(txt_normal.rgb * 2.0 - 1.0); vec3 normal = normalize(txt_normal.rgb * 2.0 - 1.0);
vec3 light_dir = normalize(vec3(0.5,0.5, 0.0) - vec3(qt_TexCoord0, 0.0)); vec3 light_dir = normalize(vec3(0.5,0.5, 0.0) - vec3(qt_TexCoord0, 0.0));
float reflection = (dot(normal, light_dir)); float reflection = dot(normal, light_dir) * 0.5 * txt_normal.a;
float light = (reflection * 0.4 + 0.2) * brightness;
vec3 final_color = reflection_color.rgb * light * 0.5;
final_color += txt_color.rgb * ambient_light;
float reflection_alpha = (1.0 - reflection*"+frame_reflection_strength.toFixed(1)+"); float reflection_alpha = (1.0 - reflection*"+frame_reflection_strength.toFixed(1)+");
gl_FragColor = vec4(final_color * txt_normal.a, txt_color.a * qt_Opacity * reflection_alpha); vec4 dark_color = vec4(reflection_color.rgb * (reflection + 0.2) * 0.5, txt_normal.a * reflection_alpha);
gl_FragColor = mix(dark_color, txt_color, ambient_light);
}" }"
onStatusChanged: if (log) console.log(log) //Print warning messages onStatusChanged: if (log) console.log(log) //Print warning messages

View File

@ -143,17 +143,6 @@ ApplicationWindow{
anchors.fill: parent anchors.fill: parent
z: 1.9 z: 1.9
} }
RadialGradient{
id: ambientreflection
z: 2.0
anchors.fill: parent
cached: true
opacity: shadersettings.ambient_light * 0.4
gradient: Gradient{
GradientStop{position: 0.0; color: "white"}
GradientStop{position: 0.7; color: "#00000000"}
}
}
Loader{ Loader{
id: sizeoverlayloader id: sizeoverlayloader
z: 3 z: 3