# Debug metallic texture effect
# This effect visualizes metallic texture directly for debugging

fragment:
    defines: |
        #define DEBUG_METALLIC_TEXTURE 1

    inout: |
        uniform sampler2D p3d_Texture5;  // Metallic texture

    material: |
        // Debug: Show metallic texture directly
        #if DEBUG_METALLIC_TEXTURE
            // Sample metallic from texture
            float sampled_metallic = texture(p3d_Texture5, texcoord).x;
            
            // For debugging: show texture value as colored visualization
            // Blue tint for non-metallic, yellow tint for metallic
            vec3 debug_color = mix(vec3(0.2, 0.2, 1.0), vec3(1.0, 1.0, 0.2), sampled_metallic);
            
            // Apply to material
            m.basecolor = debug_color;  // Show texture as color for debugging
            m.roughness = 0.5;  // Fixed roughness for clear visualization
            m.metallic = sampled_metallic;  // Also apply to metallic
            m.specular_ior = 1.5;
            m.shading_model_param0 = 0.0;
            
        #else
            // Fallback
            m.basecolor = mInput.color;
            m.roughness = mInput.roughness;
            m.metallic = mInput.metallic;
            m.specular_ior = mInput.specular_ior;
            m.shading_model_param0 = mInput.arbitrary0;
        #endif
