Draw glass behind translucent panels on 1.21.11
A copy of the game behind the screen is blurred once a frame and drawn through each panel's rounded rectangle texture by a glass pipeline. Older versions keep blurring the whole background. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#version 330
|
||||
|
||||
// Saturn's glass: the blurred game behind the screen, cut to a panel's shape.
|
||||
|
||||
layout(std140) uniform DynamicTransforms {
|
||||
mat4 ModelViewMat;
|
||||
vec4 ColorModulator;
|
||||
vec3 ModelOffset;
|
||||
mat4 TextureMat;
|
||||
};
|
||||
|
||||
// The panel's rounded rectangle, the same texture its background is drawn with
|
||||
uniform sampler2D Sampler0;
|
||||
// The game behind the screen, blurred, the size of the framebuffer
|
||||
uniform sampler2D Sampler1;
|
||||
|
||||
in vec2 texCoord0;
|
||||
in vec4 vertexColor;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
float mask = texture(Sampler0, texCoord0).a * vertexColor.a;
|
||||
if (mask == 0.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
// The blurred copy lines up with the framebuffer being drawn to.
|
||||
vec2 screenUv = gl_FragCoord.xy / vec2(textureSize(Sampler1, 0));
|
||||
fragColor = vec4(texture(Sampler1, screenUv).rgb, mask) * ColorModulator;
|
||||
}
|
||||
Reference in New Issue
Block a user