summaryrefslogtreecommitdiffstats
path: root/decals.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-04-18 13:00:48 -0700
committeryum <yum.food.vr@gmail.com>2025-04-18 13:00:48 -0700
commit66c73e2634fb9e652728a405a9104318d051bb00 (patch)
tree4e3f8a6cc058fb110812c86732cf459210e52a1d /decals.cginc
parenta522e7738d75e84cc1ee1491a098421622ef1918 (diff)
add 2 more uv channels
Diffstat (limited to 'decals.cginc')
-rw-r--r--decals.cginc5
1 files changed, 3 insertions, 2 deletions
diff --git a/decals.cginc b/decals.cginc
index 59ab085..60968af 100644
--- a/decals.cginc
+++ b/decals.cginc
@@ -4,6 +4,7 @@
#include "features.cginc"
#include "globals.cginc"
#include "math.cginc"
+#include "texture_utils.cginc"
// Struct to hold all decal parameters
struct DecalParams {
@@ -58,7 +59,7 @@ struct DecalParams {
sin(params.angle * TAU), cos(params.angle * TAU) \
); \
\
- float2 raw_decal_uv = (params.uv_channel == 0) ? i.uv01.xy : i.uv01.zw; \
+ float2 raw_decal_uv = get_uv_by_channel(i, params.uv_channel); \
float2 decal_uv = (raw_decal_uv * params.mainTex_ST.xy + params.mainTex_ST.zw); \
decal_uv = mul(decal_rot, decal_uv); \
decal_uv = (params.tiling_mode == DECAL_TILING_MODE_CLAMP ? saturate(decal_uv) : decal_uv);
@@ -90,7 +91,7 @@ struct DecalParams {
#define APPLY_DECAL_SEC02_CLAMP_OFF(i, albedo, normal_tangent, metallic, smoothness, params) {}
#define APPLY_DECAL_SEC03_MASK_ON(i, albedo, normal_tangent, metallic, smoothness, params) \
- float decal_mask = params.mask.Sample(linear_repeat_s, raw_decal_uv); \
+ float decal_mask = params.mask.SampleLevel(linear_repeat_s, raw_decal_uv, 0); \
decal_albedo.a *= decal_mask;
#define APPLY_DECAL_SEC03_MASK_OFF(i, albedo, normal_tangent, metallic, smoothness, params) \