diff options
| author | yum <yum.food.vr@gmail.com> | 2026-03-02 18:02:20 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-03-02 18:02:20 -0800 |
| commit | 6222291192d52d198ad8db9328c449493f43afac (patch) | |
| tree | dc06ef88a471d29925c8678a7e81e30f870ab853 /decal.cginc | |
| parent | fd5b8029a8303e6b0db0c9c7e309aa0075302935 (diff) | |
Add metallic gloss to decals
Diffstat (limited to 'decal.cginc')
| -rw-r--r-- | decal.cginc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/decal.cginc b/decal.cginc index 7673bee..8492c74 100644 --- a/decal.cginc +++ b/decal.cginc @@ -68,6 +68,14 @@ void applyDecals(v2f i, inout Pbr pbr) { pbr.albedo.rgb += lerp(0, albedo.rgb * pbr.albedo.rgb, albedo.a); break; } + +#if defined(_DECAL0_METALLIC_GLOSS) + float4 mg = decal_sample(_Decal0_Metallic_Gloss, uv, _Decal0_UV_Mode); + pbr.metallic = lerp(pbr.metallic, mg.r, albedo.a); + pbr.smoothness = lerp(pbr.smoothness, mg.a, albedo.a); + pbr.roughness_perceptual = clamp(1 - pbr.smoothness, MIN_PERCEPTUAL_ROUGHNESS, 1); + pbr.roughness = clamp(pbr.roughness_perceptual * pbr.roughness_perceptual, MIN_ROUGHNESS, 1); +#endif // _DECAL0_METALLIC_GLOSS } #endif } |
