forked from Rowland/EG
32 lines
1.2 KiB
YAML
32 lines
1.2 KiB
YAML
# PBR effect with normal mapping support
|
|
# This effect ensures proper material color handling when only normal maps are applied
|
|
|
|
fragment:
|
|
defines: |
|
|
#define USE_NORMAL_MAPPING_ONLY 1
|
|
|
|
material: |
|
|
// Handle normal mapping without requiring diffuse texture
|
|
#if USE_NORMAL_MAPPING_ONLY
|
|
// Use material color directly, don't multiply with sampled_diffuse
|
|
// This prevents the black color issue when no diffuse texture is present
|
|
m.basecolor = mInput.color;
|
|
|
|
// Handle other textures normally if they exist
|
|
m.specular_ior = blend_ior(mInput.specular_ior, sampled_ior);
|
|
m.roughness = mInput.roughness * sampled_roughness;
|
|
m.metallic = mInput.metallic;
|
|
|
|
// Ensure minimum roughness
|
|
m.roughness = max(m.roughness, 0.01);
|
|
|
|
#else
|
|
// Standard 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;
|
|
#endif
|
|
|
|
m.shading_model_param0 = mInput.arbitrary0;
|