# Roughness-only PBR effect # This effect specifically handles roughness textures correctly # Ensures roughness texture is not confused with diffuse texture fragment: defines: | #define USE_ROUGHNESS_TEXTURE_ONLY 1 #define DONT_FETCH_DEFAULT_TEXTURES 0 inout: | uniform sampler2D p3d_Texture3; // Roughness texture only material: | // Only handle roughness texture, ignore others to avoid confusion #if USE_ROUGHNESS_TEXTURE_ONLY // Sample roughness from p3d_Texture3 float sampled_roughness = texture(p3d_Texture3, texcoord).x; // Apply roughness: material_roughness * texture_value // This gives Blender-like behavior m.roughness = mInput.roughness * sampled_roughness; // Ensure minimum roughness to avoid rendering issues m.roughness = max(m.roughness, 0.01); // Keep other properties from material (no texture interference) m.basecolor = mInput.color; // Use material color, not texture m.metallic = mInput.metallic; m.specular_ior = mInput.specular_ior; m.shading_model_param0 = mInput.arbitrary0; #else // Fallback to material values only 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