diff options
Diffstat (limited to 'pbr.cginc')
| -rwxr-xr-x | pbr.cginc | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -16,6 +16,12 @@ struct Pbr { float roughness_perceptual; float roughness; float metallic; +#if defined(_AMBIENT_OCCLUSION) + float ao; +#endif +#if defined(_BENT_NORMALS) + float3 bent_normal; +#endif #if defined(_CLEARCOAT) float cc_roughness; float cc_strength; @@ -208,6 +214,12 @@ Pbr getPbr(v2f i) { pbr.normal = normalize(mul(normal_tangent, pbr.tbn)); +#if defined(_BENT_NORMALS) + float3 bent_ts = UnpackNormal(_Bent_Normals_Map.Sample(aniso4_trilinear_repeat_s, uv_parallax * _Bent_Normals_Map_ST.xy + _Bent_Normals_Map_ST.zw)); + bent_ts.xy *= _Bent_Normals_Strength; + pbr.bent_normal = normalize(mul(bent_ts, pbr.tbn)); +#endif + float4 metallic_gloss = _MetallicGlossMap.Sample(aniso4_trilinear_repeat_s, uv_parallax * _MetallicGlossMap_ST.xy); pbr.smoothness = metallic_gloss.a * _Glossiness; pbr.metallic = metallic_gloss.r * _Metallic; @@ -219,6 +231,10 @@ Pbr getPbr(v2f i) { #endif propagateSmoothness(pbr); +#if defined(_AMBIENT_OCCLUSION) + pbr.ao = saturate(lerp(1.0, _OcclusionMap.Sample(bilinear_repeat_s, i.uv01.xy).r, _OcclusionStrength)); +#endif + return pbr; } |
