# PBR effect with direct metallic texture control
# This effect allows metallic textures to directly control metallic values
# instead of multiplying with material metallic value

fragment:
    defines: |
        #define USE_DIRECT_METALLIC_TEXTURE 1

    inout: |
        uniform sampler2D p3d_Texture5;  // Metallic texture (direct control)

    material: |
        // Direct metallic texture control
        #if USE_DIRECT_METALLIC_TEXTURE
            // Sample metallic value directly from texture
            float sampled_metallic = texture(p3d_Texture5, texcoord).x;
            
            // Use texture value directly instead of multiplying
            // This allows the texture to have full control over metallic values
            m.metallic = sampled_metallic;
            
            // Debug: Ensure we're using the texture value
            // White areas = 1.0 (fully metallic)
            // Gray areas = 0.5 (semi-metallic) 
            // Black areas = 0.0 (non-metallic)
        #else
            // Fallback to material metallic value
            m.metallic = mInput.metallic;
        #endif
