You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
38 lines
1.2 KiB
#version 150
|
|
precision highp float;
|
|
|
|
uniform sampler2DRect tex0; // Your FBO texture (RGB FBO)
|
|
uniform float texW; // FBO texture width
|
|
uniform float texH; // FBO texture height
|
|
|
|
out vec4 fragColor; // Output color
|
|
in vec2 varyingtexcoord;
|
|
|
|
void main() {
|
|
float threshold = 0.7;
|
|
float depth = texture(tex0, varyingtexcoord).r;
|
|
|
|
// Determine which quadrant we're in
|
|
int quadrantX = int(varyingtexcoord.x / (256.0 / 2.0));
|
|
int quadrantY = int(varyingtexcoord.y / (336.0 / 2.0));
|
|
int quadrant = quadrantY * 2 + quadrantX;
|
|
|
|
vec3 baseColor;
|
|
vec3 mixColor = vec3(0.0); // White for mixing in all quadrants
|
|
|
|
// Choose base color based on quadrant
|
|
if (quadrant == 0) {
|
|
baseColor = vec3(1.0, 1.0, 1.0); // Red for bottom-left
|
|
} else if (quadrant == 1) {
|
|
baseColor = vec3(1.0, 1.0, 1.0); // Green for bottom-right
|
|
} else if (quadrant == 2) {
|
|
baseColor = vec3(1.0, 1.0, 1.0); // Blue for top-left
|
|
} else {
|
|
baseColor = vec3(1.0, 1.0, 1.0); // White for top-right
|
|
}
|
|
|
|
// Mix the base color with white based on the depth
|
|
vec3 color = mix(mixColor, baseColor, depth);
|
|
|
|
fragColor = vec4(color, 1.0);
|
|
}
|