From 75439d0d6437a10b00b240aba75e9f12de20150b Mon Sep 17 00:00:00 2001 From: yum Date: Thu, 26 Feb 2026 14:21:05 -0800 Subject: Add emissions, remove impostor code --- pbr.cginc | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'pbr.cginc') diff --git a/pbr.cginc b/pbr.cginc index c89a97c..9fbf2de 100755 --- a/pbr.cginc +++ b/pbr.cginc @@ -6,7 +6,6 @@ #include "instancing.cginc" #include "interpolators.cginc" #include "texture_utils.cginc" -#include "impostor.cginc" // From filament: min roughness s.t. MIN_PERCEPTUAL_ROUGHNESS^4 > 0 in target // precision. Although we use fp32, the higher min roughness gives us a broader @@ -22,6 +21,9 @@ struct Pbr { float roughness_perceptual; float roughness; float metallic; +#if defined(_EMISSIONS) && defined(FORWARD_BASE_PASS) + float3 emission; +#endif #if defined(_AMBIENT_OCCLUSION) float ao; #endif @@ -33,10 +35,6 @@ struct Pbr { float cc_roughness_perceptual; float cc_strength; #endif -#if defined(_IMPOSTORS_DEPTH) - float3 objPos; - float debug; // TODO rm -#endif }; #if defined(_PARALLAX_HEIGHTMAP) @@ -187,16 +185,6 @@ Pbr getPbr(v2f i) { float2 uv_parallax = i.uv01.xy; #endif // _PARALLAX_HEIGHTMAP -#if defined(_IMPOSTORS) - ImpostorResult imp = impostor_frag(i.worldPos); - pbr.albedo = imp.albedo * _Color; - pbr.normal = imp.normal; - pbr.smoothness = imp.smoothness; - pbr.metallic = imp.metallic; -#if defined(_IMPOSTORS_DEPTH) - pbr.objPos = imp.objPos; -#endif -#else // !_IMPOSTORS #if defined(OUTLINES_PASS) && defined(_OUTLINES) pbr.albedo = _Outlines_Color; #else @@ -229,7 +217,6 @@ Pbr getPbr(v2f i) { 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; -#endif // _IMPOSTORS #if defined(_CLEARCOAT) pbr.cc_roughness = _Clearcoat_Roughness; @@ -242,6 +229,15 @@ Pbr getPbr(v2f i) { pbr.ao = saturate(lerp(1.0, _OcclusionMap.Sample(bilinear_repeat_s, i.uv01.xy).r, _OcclusionStrength)); #endif +#if defined(_EMISSIONS) && defined(FORWARD_BASE_PASS) + float3 emission_tint = _EmissionColor; + float3 emission_color = _EmissionMap.Sample(trilinear_repeat_s, + i.uv01.xy * _EmissionMap_ST.xy + _EmissionMap_ST.zw); + float emission_mask = _EmissionMask.Sample(trilinear_repeat_s, + i.uv01.xy * _EmissionMask_ST.xy + _EmissionMask_ST.zw).r; + pbr.emission = emission_tint * emission_color * emission_mask; +#endif + return pbr; } -- cgit v1.2.3