# PBR effect with additive metallic texture control
# This effect adds metallic texture values to material metallic values
# Final metallic = material_metallic + texture_value (clamped to 0-1)

fragment:
    defines: |
        #define USE_ADDITIVE_METALLIC_TEXTURE 1

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

    material: |
        // Additive metallic texture control
        #if USE_ADDITIVE_METALLIC_TEXTURE
            // Sample metallic value from texture
            float sampled_metallic = texture(p3d_Texture5, texcoord).x;
            
            // Add texture value to material metallic value
            // This allows enhancing existing metallic areas
            m.metallic = clamp(mInput.metallic + sampled_metallic, 0.0, 1.0);
            
            // Debug: This mode is useful for:
            // - Adding metallic details to non-metallic materials
            // - Enhancing existing metallic areas
            // - Creating metallic highlights on top of base material
        #else
            // Fallback to material metallic value
            m.metallic = mInput.metallic;
        #endif
