# Test metallic texture debug effect
# This effect shows the metallic texture directly as color to verify it's working

fragment:
    defines: |
        #define TEST_METALLIC_DEBUG 1

    inout: |
        uniform sampler2D p3d_Texture5;  // Metallic texture

    material: |
        // Debug: Show metallic texture directly as color
        #if TEST_METALLIC_DEBUG
            // Sample metallic texture
            float metallic_value = texture(p3d_Texture5, texcoord).x;
            
            // Show metallic as blue-to-yellow gradient for debugging
            vec3 debug_color = mix(vec3(0.2, 0.2, 1.0), vec3(1.0, 1.0, 0.2), metallic_value);
            
            // Apply debug visualization
            m.basecolor = debug_color;  // Show texture as blue-yellow gradient
            m.roughness = 0.5;  // Fixed roughness for consistent lighting
            m.metallic = 0.0;   // Non-metallic for clear visualization
            m.specular_ior = 1.5;
            m.shading_model_param0 = 0.0;
            
        #else
            // Normal material processing
            m.basecolor = mInput.color * sampled_diffuse.xyz;
            m.specular_ior = blend_ior(mInput.specular_ior, sampled_ior);
            m.roughness = mInput.roughness * sampled_roughness;
            m.metallic = mInput.metallic;
            m.shading_model_param0 = mInput.arbitrary0;
        #endif
