summaryrefslogtreecommitdiffstats
path: root/pbr.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2026-02-26 14:21:05 -0800
committeryum <yum.food.vr@gmail.com>2026-02-26 14:21:05 -0800
commit75439d0d6437a10b00b240aba75e9f12de20150b (patch)
treeaf30dceabad1b486f6411c8e89e3656887e55fff /pbr.cginc
parent5460dbc62fe6f404cb244410af949864cce286f5 (diff)
Add emissions, remove impostor code
Diffstat (limited to 'pbr.cginc')
-rwxr-xr-xpbr.cginc28
1 files changed, 12 insertions, 16 deletions
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;
}