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

fragment:
    defines: |
        #define TEST_ROUGHNESS_DEBUG 1

    inout: |
        uniform sampler2D p3d_Texture3;  // Roughness texture

    material: |
        // Debug: Show roughness texture directly as color
        #if TEST_ROUGHNESS_DEBUG
            // Sample roughness texture
            float roughness_value = texture(p3d_Texture3, texcoord).x;
            
            // Show roughness as grayscale color for debugging
            vec3 debug_color = vec3(roughness_value);
            
            // Apply debug visualization
            m.basecolor = debug_color;  // Show texture as grayscale
            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
