40 lines
1.5 KiB
YAML
40 lines
1.5 KiB
YAML
# Metallic-only PBR effect
|
|
# This effect specifically handles metallic textures correctly
|
|
# Ensures metallic texture is not confused with diffuse texture
|
|
|
|
fragment:
|
|
defines: |
|
|
#define USE_METALLIC_TEXTURE_ONLY 1
|
|
#define DONT_FETCH_DEFAULT_TEXTURES 0
|
|
|
|
inout: |
|
|
uniform sampler2D p3d_Texture5; // Metallic texture only
|
|
|
|
material: |
|
|
// Only handle metallic texture, ignore others to avoid confusion
|
|
#if USE_METALLIC_TEXTURE_ONLY
|
|
// Sample metallic from p3d_Texture5
|
|
float sampled_metallic = texture(p3d_Texture5, texcoord).x;
|
|
|
|
// Direct control: texture value directly controls metallic
|
|
// This gives Blender-like behavior where texture has full control
|
|
m.metallic = sampled_metallic;
|
|
|
|
// Clamp to valid range
|
|
m.metallic = clamp(m.metallic, 0.0, 1.0);
|
|
|
|
// Keep other properties from material (no texture interference)
|
|
m.basecolor = mInput.color; // Use material color, not texture
|
|
m.roughness = mInput.roughness;
|
|
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
|