mirror of
https://github.com/Swordfish90/cool-retro-term.git
synced 2026-02-08 00:32:27 +00:00
Improve reflections rendering.
This commit is contained in:
@@ -169,8 +169,7 @@ void main() {
|
|||||||
|
|
||||||
#if CRT_DISPLAY_FRAME == 1
|
#if CRT_DISPLAY_FRAME == 1
|
||||||
vec4 frameColor = texture(frameSource, qt_TexCoord0);
|
vec4 frameColor = texture(frameSource, qt_TexCoord0);
|
||||||
vec3 reflection = max(finalColor - backgroundColor.rgb, vec3(0.0));
|
vec3 reflection = max(finalColor - backgroundColor.rgb, vec3(0.0)) * frameShininess;
|
||||||
reflection *= frameShininess;
|
|
||||||
finalColor = mix(finalColor, frameColor.rgb + reflection, frameColor.a);
|
finalColor = mix(finalColor, frameColor.rgb + reflection, frameColor.a);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -23,11 +23,11 @@ layout(std140, binding = 0) uniform ubuf {
|
|||||||
vec4 backgroundColor;
|
vec4 backgroundColor;
|
||||||
float screenCurvature;
|
float screenCurvature;
|
||||||
float chromaColor;
|
float chromaColor;
|
||||||
float screen_brightness;
|
|
||||||
float bloom;
|
|
||||||
float rbgShift;
|
float rbgShift;
|
||||||
float frameShininess;
|
float frameShininess;
|
||||||
float frameSize;
|
float frameSize;
|
||||||
|
float screen_brightness;
|
||||||
|
float bloom;
|
||||||
};
|
};
|
||||||
|
|
||||||
layout(binding = 1) uniform sampler2D source;
|
layout(binding = 1) uniform sampler2D source;
|
||||||
@@ -67,7 +67,7 @@ void main() {
|
|||||||
shownDraw = max2(step(vec2(0.0), curvatureCoords) - step(vec2(1.0), curvatureCoords));
|
shownDraw = max2(step(vec2(0.0), curvatureCoords) - step(vec2(1.0), curvatureCoords));
|
||||||
isScreen = min2(step(vec2(0.0), curvatureCoords) - step(vec2(1.0), curvatureCoords));
|
isScreen = min2(step(vec2(0.0), curvatureCoords) - step(vec2(1.0), curvatureCoords));
|
||||||
isReflection = shownDraw - isScreen;
|
isReflection = shownDraw - isScreen;
|
||||||
txt_coords = -2.0 * curvatureCoords + 3.0 * step(vec2(0.0), curvatureCoords) * curvatureCoords - 3.0 * step(vec2(1.0), curvatureCoords) * curvatureCoords;
|
txt_coords = curvatureCoords * (-1.0 + 2.0 * step(vec2(0.0), curvatureCoords) - 2.0 * step(vec2(1.0), curvatureCoords));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vec3 txt_color = texture(source, txt_coords).rgb;
|
vec3 txt_color = texture(source, txt_coords).rgb;
|
||||||
@@ -107,8 +107,7 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (frameShininess > 0.0) {
|
if (frameShininess > 0.0) {
|
||||||
float shine = clamp(frameShininess, 0.0, 1.0);
|
vec3 reflectionColor = mix(backgroundColor.rgb + bloomColor, finalColor, frameShininess * 0.5);
|
||||||
vec3 reflectionColor = mix(bloomColor, finalColor, shine * 0.5);
|
|
||||||
finalColor = mix(finalColor, reflectionColor, isReflection);
|
finalColor = mix(finalColor, reflectionColor, isReflection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user