summaryrefslogtreecommitdiffstats
path: root/pbr.cginc
diff options
context:
space:
mode:
Diffstat (limited to 'pbr.cginc')
-rwxr-xr-xpbr.cginc35
1 files changed, 4 insertions, 31 deletions
diff --git a/pbr.cginc b/pbr.cginc
index 9fbf2de..0846f8f 100755
--- a/pbr.cginc
+++ b/pbr.cginc
@@ -2,41 +2,12 @@
#define __PBR_INC
#include "filamented.cginc"
-#include "globals.cginc"
+#include "data.cginc"
+#include "decal.cginc"
#include "instancing.cginc"
#include "interpolators.cginc"
#include "texture_utils.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
-// specular highlight, which is preferable.
-#define MIN_PERCEPTUAL_ROUGHNESS 0.045
-#define MIN_ROUGHNESS 0.002025
-
-struct Pbr {
- float4 albedo;
- float3 normal;
- float3x3 tbn;
- float smoothness;
- float roughness_perceptual;
- float roughness;
- float metallic;
-#if defined(_EMISSIONS) && defined(FORWARD_BASE_PASS)
- float3 emission;
-#endif
-#if defined(_AMBIENT_OCCLUSION)
- float ao;
-#endif
-#if defined(_BENT_NORMALS)
- float3 bent_normal;
-#endif
-#if defined(_CLEARCOAT)
- float cc_roughness;
- float cc_roughness_perceptual;
- float cc_strength;
-#endif
-};
-
#if defined(_PARALLAX_HEIGHTMAP)
float2 parallax_offset(float2 uv, float3 view_dir_world, float3x3 tbn) {
float3 view_dir_tangent = mul(tbn, view_dir_world);
@@ -205,6 +176,8 @@ Pbr getPbr(v2f i) {
normal_tangent = blendNormalsHill12(normal_tangent, detail_normal);
#endif
+ applyDecals(i, pbr, normal_tangent);
+
pbr.normal = normalize(mul(normal_tangent, pbr.tbn));
#if defined(_BENT_NORMALS)