#version 450 layout(location = 0) in vec3 fragColor; layout(location = 1) in vec2 fragTexCoord; layout(location = 0) out vec4 outColor; layout(binding = 1) uniform sampler2D texSampler; layout(binding = 0) uniform UniformBufferObject { mat4 model; mat4 view; mat4 proj; vec2 resolution; float time; float dt; } ubo; // void main() { // // float pulse = sin(ubo.time * .2) * .5 + .5; // // outColor = vec4(fragColor * texture(texSampler, fragTexCoord).rgb * pulse, 1.0); // //outColor = texture(texSampler, fragTexCoord); // outColor = vec4(fragColor, 1); // // float repeat = 10; // // float f = mod(ubo.time, repeat); // // if (f < repeat / 2) { // // outColor = vec4(fragColor * radians(f) ,1); // // } else { // // outColor = vec4(fragColor * radians(1 - f) ,1); // // } // // //outColor = (vec4(1) * ubo.model + vec4(1)) * vec4(texture(texSampler, fragTexCoord).rgb * fragColor, 1.0); // } float noise(vec2 p) { return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453); } float smoothNoise(vec2 p) { vec2 i = floor(p); vec2 f = fract(p); vec2 u = f * f * (3.0 - 2.0 * f); return mix(mix(noise(i + vec2(0.0, 0.0)), noise(i + vec2(1.0, 0.0)), u.x), mix(noise(i + vec2(0.0, 1.0)), noise(i + vec2(1.0, 1.0)), u.x), u.y); } float fbm(vec2 p) { float value = 0.0; float amplitude = 0.5; for (int i = 0; i < 6; i++) { value += amplitude * smoothNoise(p); p *= 2.0; amplitude *= 0.5; } return value; } void main() { vec2 uv = gl_FragCoord.xy / ubo.resolution.xy; vec2 p = uv * 2.0 - vec2(1.0); float n = fbm(p * 5.0 - vec2(0.0, ubo.time * 2.0)); outColor = vec4(n, n * 0.5, 0.0, 1.0) * vec4(texture(texSampler, fragTexCoord).rgb, 1.0); } // void main() { // // Calculate a pulsating factor based on sine wave // float pulse = sin(ubo.time * 2.0) * 0.5 + 0.5; // // Set the color using the pulse factor // outColor = vec4(pulse, 0.0, 1.0 - pulse, .5); // } // void main() { // vec2 uv = gl_FragCoord.xy / ubo.resolution; // vec2 center = uv - 0.5; // float angle = ubo.time; // float cosA = cos(angle); // float sinA = sin(angle); // vec2 rotated = vec2( // center.x * cosA - center.y * sinA, // center.x * sinA + center.y * cosA // ); // float pattern = step(0.5, mod(rotated.x * 10.0, 1.0)) * step(0.5, mod(rotated.y * 10.0, 1.0)); // outColor = vec4(vec3(pattern), 1.0); // }