summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--2ner.shader19
-rw-r--r--decals.cginc21
-rw-r--r--features.cginc12
-rw-r--r--globals.cginc6
-rw-r--r--yum_pbr.cginc9
5 files changed, 66 insertions, 1 deletions
diff --git a/2ner.shader b/2ner.shader
index 7cce36d..4d12995 100644
--- a/2ner.shader
+++ b/2ner.shader
@@ -345,6 +345,7 @@ Shader "yum_food/2ner"
_Decal0_UV_Channel("UV channel", Range(0, 3.1)) = 0
[ThryToggle(_DECAL0_TILING_MODE)] _Decal0_Tiling_Mode("Tiling mode", Float) = 0
[ThryToggle(_DECAL0_REPLACE_ALPHA)] _Decal0_Replace_Alpha_Mode("Replace alpha", Float) = 0
+ [ThryToggle(_DECAL0_MULTIPLY)] _Decal0_Replace_Multiply_Mode("Multiply", Float) = 0
//ifex _Decal0_Normal_Enabled==0
[HideInInspector] m_start_Decal0_Normal("Normal", Float) = 0
[ThryToggle(_DECAL0_NORMAL)] _Decal0_Normal_Enabled("Enable", Float) = 0
@@ -406,6 +407,7 @@ Shader "yum_food/2ner"
_Decal1_UV_Channel("UV channel", Range(0, 3.1)) = 0
[ThryToggle(_DECAL1_TILING_MODE)] _Decal1_Tiling_Mode("Tiling mode", Float) = 0
[ThryToggle(_DECAL1_REPLACE_ALPHA)] _Decal1_Replace_Alpha_Mode("Replace alpha", Float) = 0
+ [ThryToggle(_DECAL1_MULTIPLY)] _Decal1_Replace_Multiply_Mode("Multiply", Float) = 0
//ifex _Decal1_Normal_Enabled==0
[HideInInspector] m_start_Decal1_Normal("Normal", Float) = 0
[ThryToggle(_DECAL1_NORMAL)] _Decal1_Normal_Enabled("Enable", Float) = 0
@@ -467,6 +469,7 @@ Shader "yum_food/2ner"
_Decal2_UV_Channel("UV channel", Range(0, 3.1)) = 0
[ThryToggle(_DECAL2_TILING_MODE)] _Decal2_Tiling_Mode("Tiling mode", Float) = 0
[ThryToggle(_DECAL2_REPLACE_ALPHA)] _Decal2_Replace_Alpha_Mode("Replace alpha", Float) = 0
+ [ThryToggle(_DECAL2_MULTIPLY)] _Decal2_Replace_Multiply_Mode("Multiply", Float) = 0
//ifex _Decal2_Normal_Enabled==0
[HideInInspector] m_start_Decal2_Normal("Normal", Float) = 0
[ThryToggle(_DECAL2_NORMAL)] _Decal2_Normal_Enabled("Enable", Float) = 0
@@ -528,6 +531,7 @@ Shader "yum_food/2ner"
_Decal3_UV_Channel("UV channel", Range(0, 3.1)) = 0
[ThryToggle(_DECAL3_TILING_MODE)] _Decal3_Tiling_Mode("Tiling mode", Float) = 0
[ThryToggle(_DECAL3_REPLACE_ALPHA)] _Decal3_Replace_Alpha_Mode("Replace alpha", Float) = 0
+ [ThryToggle(_DECAL3_MULTIPLY)] _Decal3_Replace_Multiply_Mode("Multiply", Float) = 0
//ifex _Decal3_Normal_Enabled==0
[HideInInspector] m_start_Decal3_Normal("Normal", Float) = 0
[ThryToggle(_DECAL3_NORMAL)] _Decal3_Normal_Enabled("Enable", Float) = 0
@@ -589,6 +593,7 @@ Shader "yum_food/2ner"
_Decal4_UV_Channel("UV channel", Range(0, 3.1)) = 0
[ThryToggle(_DECAL4_TILING_MODE)] _Decal4_Tiling_Mode("Tiling mode", Float) = 0
[ThryToggle(_DECAL4_REPLACE_ALPHA)] _Decal4_Replace_Alpha_Mode("Replace alpha", Float) = 0
+ [ThryToggle(_DECAL4_MULTIPLY)] _Decal4_Replace_Multiply_Mode("Multiply", Float) = 0
//ifex _Decal4_Normal_Enabled==0
[HideInInspector] m_start_Decal4_Normal("Normal", Float) = 0
[ThryToggle(_DECAL4_NORMAL)] _Decal4_Normal_Enabled("Enable", Float) = 0
@@ -650,6 +655,7 @@ Shader "yum_food/2ner"
_Decal5_UV_Channel("UV channel", Range(0, 3.1)) = 0
[ThryToggle(_DECAL5_TILING_MODE)] _Decal5_Tiling_Mode("Tiling mode", Float) = 0
[ThryToggle(_DECAL5_REPLACE_ALPHA)] _Decal5_Replace_Alpha_Mode("Replace alpha", Float) = 0
+ [ThryToggle(_DECAL5_MULTIPLY)] _Decal5_Replace_Multiply_Mode("Multiply", Float) = 0
//ifex _Decal5_Normal_Enabled==0
[HideInInspector] m_start_Decal5_Normal("Normal", Float) = 0
[ThryToggle(_DECAL5_NORMAL)] _Decal5_Normal_Enabled("Enable", Float) = 0
@@ -711,6 +717,7 @@ Shader "yum_food/2ner"
_Decal6_UV_Channel("UV channel", Range(0, 3.1)) = 0
[ThryToggle(_DECAL6_TILING_MODE)] _Decal6_Tiling_Mode("Tiling mode", Float) = 0
[ThryToggle(_DECAL6_REPLACE_ALPHA)] _Decal6_Replace_Alpha_Mode("Replace alpha", Float) = 0
+ [ThryToggle(_DECAL6_MULTIPLY)] _Decal6_Replace_Multiply_Mode("Multiply", Float) = 0
//ifex _Decal6_Normal_Enabled==0
[HideInInspector] m_start_Decal6_Normal("Normal", Float) = 0
[ThryToggle(_DECAL6_NORMAL)] _Decal6_Normal_Enabled("Enable", Float) = 0
@@ -772,6 +779,7 @@ Shader "yum_food/2ner"
_Decal7_UV_Channel("UV channel", Range(0, 3.1)) = 0
[ThryToggle(_DECAL7_TILING_MODE)] _Decal7_Tiling_Mode("Tiling mode", Float) = 0
[ThryToggle(_DECAL7_REPLACE_ALPHA)] _Decal7_Replace_Alpha_Mode("Replace alpha", Float) = 0
+ [ThryToggle(_DECAL7_MULTIPLY)] _Decal7_Replace_Multiply_Mode("Multiply", Float) = 0
//ifex _Decal7_Normal_Enabled==0
[HideInInspector] m_start_Decal7_Normal("Normal", Float) = 0
[ThryToggle(_DECAL7_NORMAL)] _Decal7_Normal_Enabled("Enable", Float) = 0
@@ -825,6 +833,17 @@ Shader "yum_food/2ner"
//endex
[HideInInspector] m_end_Decals("Decals", Float) = 0
+ [HideInInspector] m_start_Color_Correction("Color correction", Float) = 0
+ //ifex _Oklch_Correction_Enabled==0
+ [HideInInspector] m_start_Oklch_Correction("Oklch", Float) = 0
+ [ThryToggle(_OKLCH_CORRECTION)] _Oklch_Correction_Enabled("Enable", Float) = 0
+ _Oklch_Correction_L("L", Float) = 1
+ _Oklch_Correction_C("C", Float) = 1
+ _Oklch_Correction_H("H", Float) = 1
+ [HideInInspector] m_end_Oklch_Correction("Oklch", Float) = 0
+ //endex
+ [HideInInspector] m_end_Color_Correction("Color correction", Float) = 0
+
//ifex _Raymarched_Fog_Enabled==0
[HideInInspector] m_start_Raymarched_Fog("Raymarched fog", Float) = 0
[ThryToggle(_RAYMARCHED_FOG)] _Raymarched_Fog_Enabled("Enable", Float) = 0
diff --git a/decals.cginc b/decals.cginc
index b4f1151..2f0edb2 100644
--- a/decals.cginc
+++ b/decals.cginc
@@ -72,7 +72,7 @@ float2 applyDomainWarping(DecalParams params, float2 uv) {
float2 time_vec = float2(-0.83, 0.97) * _Time.y * params.domain_warping_speed;
[loop]
- for (uint ii = 0; ii < params.domain_warping_octaves; ii++) {
+ for (uint ii = 0; ii < (uint) params.domain_warping_octaves; ii++) {
float2 noise_uv = warped_uv * frequency + time_vec * frequency;
float2 noise_sample = params.domain_warping_noise.SampleLevel(trilinear_repeat_s, noise_uv, 0);
float2 noise_offset = (noise_sample.xy * 2.0 - 1.0);
@@ -201,6 +201,9 @@ float4 getCmykWarpingPlanesColor(DecalParams params, float2 uv) {
#define APPLY_DECAL_SEC04_BLEND_MODE_REPLACE(i, albedo, normal_tangent, metallic, smoothness, params) \
albedo = lerp(albedo, decal_albedo, decal_mask * params.opacity);
+#define APPLY_DECAL_SEC04_BLEND_MODE_MULTIPLY(i, albedo, normal_tangent, metallic, smoothness, params) \
+ albedo = lerp(albedo, decal_albedo * albedo, decal_mask * params.opacity);
+
#define APPLY_DECAL_SEC05_NORMAL_ON(i, albedo, normal_tangent, metallic, smoothness, params) \
float3 decal_normal = UnpackScaleNormal( \
params.normalTex.Sample(trilinear_repeat_s, decal_uv), \
@@ -247,6 +250,8 @@ void applyDecals(in v2f i, inout float4 albedo, inout float3 normal_tangent, ino
#endif
#if defined(_DECAL0_REPLACE_ALPHA)
APPLY_DECAL_SEC04_BLEND_MODE_REPLACE(i, albedo, normal_tangent, metallic, smoothness, decal);
+ #elif defined(_DECAL0_MULTIPLY)
+ APPLY_DECAL_SEC04_BLEND_MODE_MULTIPLY(i, albedo, normal_tangent, metallic, smoothness, decal);
#else
APPLY_DECAL_SEC04_BLEND_MODE_ALPHA_BLEND(i, albedo, normal_tangent, metallic, smoothness, decal);
#endif
@@ -290,6 +295,8 @@ void applyDecals(in v2f i, inout float4 albedo, inout float3 normal_tangent, ino
#endif
#if defined(_DECAL1_REPLACE_ALPHA)
APPLY_DECAL_SEC04_BLEND_MODE_REPLACE(i, albedo, normal_tangent, metallic, smoothness, decal);
+ #elif defined(_DECAL1_MULTIPLY)
+ APPLY_DECAL_SEC04_BLEND_MODE_MULTIPLY(i, albedo, normal_tangent, metallic, smoothness, decal);
#else
APPLY_DECAL_SEC04_BLEND_MODE_ALPHA_BLEND(i, albedo, normal_tangent, metallic, smoothness, decal);
#endif
@@ -333,6 +340,8 @@ void applyDecals(in v2f i, inout float4 albedo, inout float3 normal_tangent, ino
#endif
#if defined(_DECAL2_REPLACE_ALPHA)
APPLY_DECAL_SEC04_BLEND_MODE_REPLACE(i, albedo, normal_tangent, metallic, smoothness, decal);
+ #elif defined(_DECAL2_MULTIPLY)
+ APPLY_DECAL_SEC04_BLEND_MODE_MULTIPLY(i, albedo, normal_tangent, metallic, smoothness, decal);
#else
APPLY_DECAL_SEC04_BLEND_MODE_ALPHA_BLEND(i, albedo, normal_tangent, metallic, smoothness, decal);
#endif
@@ -376,6 +385,8 @@ void applyDecals(in v2f i, inout float4 albedo, inout float3 normal_tangent, ino
#endif
#if defined(_DECAL3_REPLACE_ALPHA)
APPLY_DECAL_SEC04_BLEND_MODE_REPLACE(i, albedo, normal_tangent, metallic, smoothness, decal);
+ #elif defined(_DECAL3_MULTIPLY)
+ APPLY_DECAL_SEC04_BLEND_MODE_MULTIPLY(i, albedo, normal_tangent, metallic, smoothness, decal);
#else
APPLY_DECAL_SEC04_BLEND_MODE_ALPHA_BLEND(i, albedo, normal_tangent, metallic, smoothness, decal);
#endif
@@ -419,6 +430,8 @@ void applyDecals(in v2f i, inout float4 albedo, inout float3 normal_tangent, ino
#endif
#if defined(_DECAL4_REPLACE_ALPHA)
APPLY_DECAL_SEC04_BLEND_MODE_REPLACE(i, albedo, normal_tangent, metallic, smoothness, decal);
+ #elif defined(_DECAL4_MULTIPLY)
+ APPLY_DECAL_SEC04_BLEND_MODE_MULTIPLY(i, albedo, normal_tangent, metallic, smoothness, decal);
#else
APPLY_DECAL_SEC04_BLEND_MODE_ALPHA_BLEND(i, albedo, normal_tangent, metallic, smoothness, decal);
#endif
@@ -462,6 +475,8 @@ void applyDecals(in v2f i, inout float4 albedo, inout float3 normal_tangent, ino
#endif
#if defined(_DECAL5_REPLACE_ALPHA)
APPLY_DECAL_SEC04_BLEND_MODE_REPLACE(i, albedo, normal_tangent, metallic, smoothness, decal);
+ #elif defined(_DECAL5_MULTIPLY)
+ APPLY_DECAL_SEC04_BLEND_MODE_MULTIPLY(i, albedo, normal_tangent, metallic, smoothness, decal);
#else
APPLY_DECAL_SEC04_BLEND_MODE_ALPHA_BLEND(i, albedo, normal_tangent, metallic, smoothness, decal);
#endif
@@ -505,6 +520,8 @@ void applyDecals(in v2f i, inout float4 albedo, inout float3 normal_tangent, ino
#endif
#if defined(_DECAL6_REPLACE_ALPHA)
APPLY_DECAL_SEC04_BLEND_MODE_REPLACE(i, albedo, normal_tangent, metallic, smoothness, decal);
+ #elif defined(_DECAL6_MULTIPLY)
+ APPLY_DECAL_SEC04_BLEND_MODE_MULTIPLY(i, albedo, normal_tangent, metallic, smoothness, decal);
#else
APPLY_DECAL_SEC04_BLEND_MODE_ALPHA_BLEND(i, albedo, normal_tangent, metallic, smoothness, decal);
#endif
@@ -548,6 +565,8 @@ void applyDecals(in v2f i, inout float4 albedo, inout float3 normal_tangent, ino
#endif
#if defined(_DECAL7_REPLACE_ALPHA)
APPLY_DECAL_SEC04_BLEND_MODE_REPLACE(i, albedo, normal_tangent, metallic, smoothness, decal);
+ #elif defined(_DECAL7_MULTIPLY)
+ APPLY_DECAL_SEC04_BLEND_MODE_MULTIPLY(i, albedo, normal_tangent, metallic, smoothness, decal);
#else
APPLY_DECAL_SEC04_BLEND_MODE_ALPHA_BLEND(i, albedo, normal_tangent, metallic, smoothness, decal);
#endif
diff --git a/features.cginc b/features.cginc
index 324582d..e1f7ef0 100644
--- a/features.cginc
+++ b/features.cginc
@@ -127,6 +127,7 @@
#pragma shader_feature_local _DECAL0_MASK
#pragma shader_feature_local _DECAL0_TILING_MODE
#pragma shader_feature_local _DECAL0_REPLACE_ALPHA
+#pragma shader_feature_local _DECAL0_MULTIPLY
#pragma shader_feature_local _DECAL0_CMYK_WARPING_PLANES
#pragma shader_feature_local _DECAL0_DOMAIN_WARPING
//endex
@@ -138,6 +139,7 @@
#pragma shader_feature_local _DECAL1_MASK
#pragma shader_feature_local _DECAL1_TILING_MODE
#pragma shader_feature_local _DECAL1_REPLACE_ALPHA
+#pragma shader_feature_local _DECAL1_MULTIPLY
#pragma shader_feature_local _DECAL1_CMYK_WARPING_PLANES
#pragma shader_feature_local _DECAL1_DOMAIN_WARPING
//endex
@@ -149,6 +151,7 @@
#pragma shader_feature_local _DECAL2_MASK
#pragma shader_feature_local _DECAL2_TILING_MODE
#pragma shader_feature_local _DECAL2_REPLACE_ALPHA
+#pragma shader_feature_local _DECAL2_MULTIPLY
#pragma shader_feature_local _DECAL2_CMYK_WARPING_PLANES
#pragma shader_feature_local _DECAL2_DOMAIN_WARPING
//endex
@@ -160,6 +163,7 @@
#pragma shader_feature_local _DECAL3_MASK
#pragma shader_feature_local _DECAL3_TILING_MODE
#pragma shader_feature_local _DECAL3_REPLACE_ALPHA
+#pragma shader_feature_local _DECAL3_MULTIPLY
#pragma shader_feature_local _DECAL3_CMYK_WARPING_PLANES
#pragma shader_feature_local _DECAL3_DOMAIN_WARPING
//endex
@@ -171,6 +175,7 @@
#pragma shader_feature_local _DECAL4_MASK
#pragma shader_feature_local _DECAL4_TILING_MODE
#pragma shader_feature_local _DECAL4_REPLACE_ALPHA
+#pragma shader_feature_local _DECAL4_MULTIPLY
#pragma shader_feature_local _DECAL4_CMYK_WARPING_PLANES
#pragma shader_feature_local _DECAL4_DOMAIN_WARPING
//endex
@@ -182,6 +187,7 @@
#pragma shader_feature_local _DECAL5_MASK
#pragma shader_feature_local _DECAL5_TILING_MODE
#pragma shader_feature_local _DECAL5_REPLACE_ALPHA
+#pragma shader_feature_local _DECAL5_MULTIPLY
#pragma shader_feature_local _DECAL5_CMYK_WARPING_PLANES
#pragma shader_feature_local _DECAL5_DOMAIN_WARPING
//endex
@@ -193,6 +199,7 @@
#pragma shader_feature_local _DECAL6_MASK
#pragma shader_feature_local _DECAL6_TILING_MODE
#pragma shader_feature_local _DECAL6_REPLACE_ALPHA
+#pragma shader_feature_local _DECAL6_MULTIPLY
#pragma shader_feature_local _DECAL6_CMYK_WARPING_PLANES
#pragma shader_feature_local _DECAL6_DOMAIN_WARPING
//endex
@@ -204,6 +211,7 @@
#pragma shader_feature_local _DECAL7_MASK
#pragma shader_feature_local _DECAL7_TILING_MODE
#pragma shader_feature_local _DECAL7_REPLACE_ALPHA
+#pragma shader_feature_local _DECAL7_MULTIPLY
#pragma shader_feature_local _DECAL7_CMYK_WARPING_PLANES
#pragma shader_feature_local _DECAL7_DOMAIN_WARPING
//endex
@@ -357,5 +365,9 @@
#pragma shader_feature_local _MASKED_STENCIL4
//endex
+//ifex _Oklch_Correction_Enabled==0
+#pragma shader_feature_local _OKLCH_CORRECTION
+//endex
+
#endif // __FEATURES_INC
diff --git a/globals.cginc b/globals.cginc
index 96fd1e0..246366f 100644
--- a/globals.cginc
+++ b/globals.cginc
@@ -594,4 +594,10 @@ float _Raymarched_Fog_Density_Exponent;
#endif
#endif // _RAYMARCHED_FOG
+#if defined(_OKLCH_CORRECTION)
+float _Oklch_Correction_L;
+float _Oklch_Correction_C;
+float _Oklch_Correction_H;
+#endif // _OKLCH_CORRECTION
+
#endif // __GLOBALS_INC
diff --git a/yum_pbr.cginc b/yum_pbr.cginc
index c3f5c4a..03026c3 100644
--- a/yum_pbr.cginc
+++ b/yum_pbr.cginc
@@ -8,6 +8,7 @@
#include "glitter.cginc"
#include "globals.cginc"
#include "math.cginc"
+#include "oklab.cginc"
#include "texture_utils.cginc"
struct YumPbr {
@@ -134,6 +135,14 @@ YumPbr GetYumPbr(v2f i, float3x3 tangentToWorld) {
applyDecals(i, result.albedo, normal_tangent, result.metallic, result.smoothness);
propagateRoughness(result.smoothness, result.roughness_perceptual, result.roughness);
+#if defined(_OKLCH_CORRECTION)
+ float3 lch = LRGBtoOKLCH(result.albedo.rgb);
+ lch.x = lch.x * _Oklch_Correction_L;
+ lch.y = lch.y * _Oklch_Correction_C;
+ lch.z = lch.z * _Oklch_Correction_H;
+ result.albedo.rgb = OKLCHtoLRGB(lch);
+#endif
+
result.normal = normalize(mul(normal_tangent, tangentToWorld));
#if (defined(FORWARD_BASE_PASS) || defined(FORWARD_ADD_PASS)) && defined(_GLITTER)