2025-04-05 20:54:38 -04:00
|
|
|
|
2025-03-28 16:33:40 -04:00
|
|
|
#version 450
|
|
|
|
|
|
2025-04-01 21:41:24 -04:00
|
|
|
// Input from vertex shader
|
2025-04-05 20:54:38 -04:00
|
|
|
layout(location = 0) in vec3 fragNormal; // Receive normal
|
|
|
|
|
layout(location = 1) in vec2 fragTexCoord; // Receive texture coordinates
|
2025-04-01 21:41:24 -04:00
|
|
|
|
|
|
|
|
// Output color
|
2025-03-28 16:33:40 -04:00
|
|
|
layout(location = 0) out vec4 outColor;
|
|
|
|
|
|
2025-04-05 20:54:38 -04:00
|
|
|
// Descriptor set for material properties (Set 1)
|
|
|
|
|
layout(set = 1, binding = 0) uniform sampler2D baseColorSampler;
|
|
|
|
|
|
|
|
|
|
// Optional: Pass material factors via another UBO or Push Constants if needed
|
|
|
|
|
// layout(set = 1, binding = 1) uniform MaterialFactors {
|
|
|
|
|
// vec4 baseColorFactor;
|
|
|
|
|
// } materialFactors;
|
2025-04-01 21:41:24 -04:00
|
|
|
|
2025-03-28 16:33:40 -04:00
|
|
|
void main() {
|
2025-04-05 20:54:38 -04:00
|
|
|
// Sample the texture
|
|
|
|
|
vec4 texColor = texture(baseColorSampler, fragTexCoord);
|
|
|
|
|
|
|
|
|
|
// Use the texture color
|
|
|
|
|
// You might multiply by baseColorFactor here if you pass it
|
|
|
|
|
// outColor = texColor * materialFactors.baseColorFactor;
|
|
|
|
|
outColor = texColor;
|
|
|
|
|
|
|
|
|
|
// Basic fallback if texture alpha is zero (or use baseColorFactor)
|
|
|
|
|
if (outColor.a == 0.0) {
|
|
|
|
|
outColor = vec4(0.8, 0.8, 0.8, 1.0); // Default grey
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// You could add basic lighting using fragNormal here later
|
2025-03-28 16:33:40 -04:00
|
|
|
}
|