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

fragment:
    defines: |
        #define DEBUG_ROUGHNESS_TEXTURE 1

    inout: |
        uniform sampler2D p3d_Texture3;  // Roughness texture

    material: |
        // Debug: Show roughness texture directly
        #if DEBUG_ROUGHNESS_TEXTURE
            // Sample roughness from texture
            float sampled_roughness = texture(p3d_Texture3, texcoord).x;
            
            // For debugging: show texture value as grayscale color
            // This helps verify the texture is being read correctly
            vec3 debug_color = vec3(sampled_roughness);
            
            // Apply to material
            m.basecolor = debug_color;  // Show texture as color for debugging
            m.roughness = sampled_roughness;  // Also apply to roughness
            m.metallic = 0.0;  // Keep metallic low for clear visualization
            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
