diff options
| author | yum <yum.food.vr@gmail.com> | 2024-10-29 16:22:34 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-10-29 16:22:34 -0700 |
| commit | c26d19e86b9365f468f34f73cbe648ab2520bdec (patch) | |
| tree | b0a5b024881ba895c9f30fa52781c57177b329bd | |
| parent | 9a492f33c29c8564bcec17edef0a6591518ca9d4 (diff) | |
Can now specify interpolation mode on most important textures
You can select {linear,point,bilinear}x{repeat,clamp} for base pbr,
overlays, and rim lighting (??) textures now.
Overlay masks also tile now.
| -rw-r--r-- | Editor/tooner.cs | 39 | ||||
| -rw-r--r-- | feature_macros.cginc | 72 | ||||
| -rw-r--r-- | globals.cginc | 4 | ||||
| -rw-r--r-- | tooner_lighting.cginc | 123 |
4 files changed, 190 insertions, 48 deletions
diff --git a/Editor/tooner.cs b/Editor/tooner.cs index 116fb4f..0163e85 100644 --- a/Editor/tooner.cs +++ b/Editor/tooner.cs @@ -227,9 +227,16 @@ public class ToonerGUI : ShaderGUI { return enabled; } + // Why do the cartesian product here rather than in C? Easier to do it here + // than with C macros! enum SamplerMode { - Repeat, - Clamp, + // Why this order? Backwards compatibility when interpolation selection was introduced + LinearRepeat, + LinearClamp, + PointRepeat, + PointClamp, + BilinearRepeat, + BilinearClamp, }; void DoPBR() { show_ui.Add(AddCollapsibleMenu("PBR", "_PBR")); @@ -248,8 +255,12 @@ public class ToonerGUI : ShaderGUI { EditorGUI.EndChangeCheck(); bc.floatValue = (int) sampler_mode; - SetKeyword($"_PBR_SAMPLER_REPEAT", sampler_mode == SamplerMode.Repeat); - SetKeyword($"_PBR_SAMPLER_CLAMP", sampler_mode == SamplerMode.Clamp); + SetKeyword($"_PBR_SAMPLER_LINEAR_REPEAT", sampler_mode == SamplerMode.LinearRepeat); + SetKeyword($"_PBR_SAMPLER_LINEAR_CLAMP", sampler_mode == SamplerMode.LinearClamp); + SetKeyword($"_PBR_SAMPLER_BILINEAR_REPEAT", sampler_mode == SamplerMode.BilinearRepeat); + SetKeyword($"_PBR_SAMPLER_BILINEAR_CLAMP", sampler_mode == SamplerMode.BilinearClamp); + SetKeyword($"_PBR_SAMPLER_POINT_REPEAT", sampler_mode == SamplerMode.PointRepeat); + SetKeyword($"_PBR_SAMPLER_POINT_CLAMP", sampler_mode == SamplerMode.PointClamp); } EditorGUI.indentLevel -= 1; show_ui.RemoveAt(show_ui.Count - 1); @@ -446,6 +457,8 @@ public class ToonerGUI : ShaderGUI { SetKeyword($"_PBR_OVERLAY{i}_MASK", bct.textureValue); if (bct.textureValue) { + TextureScaleOffsetProperty(bct); + bc = FindProperty($"_PBR_Overlay{i}_Mask_Invert"); enabled = bc.floatValue > 1E-6; EditorGUI.BeginChangeCheck(); @@ -470,11 +483,15 @@ public class ToonerGUI : ShaderGUI { bc = FindProperty($"_PBR_Overlay{i}_Sampler_Mode"); SamplerMode sampler_mode = (SamplerMode) Math.Round(bc.floatValue); sampler_mode = (SamplerMode) EnumPopup( - MakeLabel("Sampler mode"), sampler_mode); + MakeLabel("Sampler wrapping mode"), sampler_mode); EditorGUI.EndChangeCheck(); bc.floatValue = (int) sampler_mode; - SetKeyword($"_PBR_OVERLAY{i}_SAMPLER_REPEAT", sampler_mode == SamplerMode.Repeat); - SetKeyword($"_PBR_OVERLAY{i}_SAMPLER_CLAMP", sampler_mode == SamplerMode.Clamp); + SetKeyword($"_PBR_OVERLAY{i}_SAMPLER_LINEAR_REPEAT", sampler_mode == SamplerMode.LinearRepeat); + SetKeyword($"_PBR_OVERLAY{i}_SAMPLER_LINEAR_CLAMP", sampler_mode == SamplerMode.LinearClamp); + SetKeyword($"_PBR_OVERLAY{i}_SAMPLER_BILINEAR_REPEAT", sampler_mode == SamplerMode.BilinearRepeat); + SetKeyword($"_PBR_OVERLAY{i}_SAMPLER_BILINEAR_CLAMP", sampler_mode == SamplerMode.BilinearClamp); + SetKeyword($"_PBR_OVERLAY{i}_SAMPLER_POINT_REPEAT", sampler_mode == SamplerMode.PointRepeat); + SetKeyword($"_PBR_OVERLAY{i}_SAMPLER_POINT_CLAMP", sampler_mode == SamplerMode.PointClamp); bc = FindProperty($"_PBR_Overlay{i}_Mip_Bias"); FloatProperty(bc, "Mip bias"); @@ -826,8 +843,12 @@ public class ToonerGUI : ShaderGUI { EditorGUI.EndChangeCheck(); bc.floatValue = (int) sampler_mode; - SetKeyword($"_RIM_LIGHTING{i}_SAMPLER_REPEAT", sampler_mode == SamplerMode.Repeat); - SetKeyword($"_RIM_LIGHTING{i}_SAMPLER_CLAMP", sampler_mode == SamplerMode.Clamp); + SetKeyword($"_RIM_LIGHTING{i}_SAMPLER_LINEAR_REPEAT", sampler_mode == SamplerMode.LinearRepeat); + SetKeyword($"_RIM_LIGHTING{i}_SAMPLER_LINEAR_CLAMP", sampler_mode == SamplerMode.LinearClamp); + SetKeyword($"_RIM_LIGHTING{i}_SAMPLER_BILINEAR_REPEAT", sampler_mode == SamplerMode.BilinearRepeat); + SetKeyword($"_RIM_LIGHTING{i}_SAMPLER_BILINEAR_CLAMP", sampler_mode == SamplerMode.BilinearClamp); + SetKeyword($"_RIM_LIGHTING{i}_SAMPLER_POINT_REPEAT", sampler_mode == SamplerMode.PointRepeat); + SetKeyword($"_RIM_LIGHTING{i}_SAMPLER_POINT_CLAMP", sampler_mode == SamplerMode.PointClamp); EditorGUI.indentLevel -= 1; } diff --git a/feature_macros.cginc b/feature_macros.cginc index 4c7bc5a..4724d12 100644 --- a/feature_macros.cginc +++ b/feature_macros.cginc @@ -7,8 +7,12 @@ #pragma shader_feature_local _ _NORMAL_MAP #pragma shader_feature_local _ _METALLIC_MAP #pragma shader_feature_local _ _ROUGHNESS_MAP -#pragma shader_feature_local _ _PBR_SAMPLER_REPEAT -#pragma shader_feature_local _ _PBR_SAMPLER_CLAMP +#pragma shader_feature_local _ _PBR_SAMPLER_LINEAR_REPEAT +#pragma shader_feature_local _ _PBR_SAMPLER_LINEAR_CLAMP +#pragma shader_feature_local _ _PBR_SAMPLER_POINT_REPEAT +#pragma shader_feature_local _ _PBR_SAMPLER_POINT_CLAMP +#pragma shader_feature_local _ _PBR_SAMPLER_BILINEAR_REPEAT +#pragma shader_feature_local _ _PBR_SAMPLER_BILINEAR_CLAMP #pragma shader_feature_local _ _CUBEMAP #pragma shader_feature_local _ _EMISSION #pragma shader_feature_local _ _EMISSION0 @@ -35,32 +39,48 @@ #pragma shader_feature_local _ _RIM_LIGHTING0_MASK #pragma shader_feature_local _ _RIM_LIGHTING0_GLITTER #pragma shader_feature_local _ _RIM_LIGHTING0_POLAR_MASK -#pragma shader_feature_local _ _RIM_LIGHTING0_SAMPLER_REPEAT -#pragma shader_feature_local _ _RIM_LIGHTING0_SAMPLER_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING0_SAMPLER_LINEAR_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING0_SAMPLER_LINEAR_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING0_SAMPLER_POINT_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING0_SAMPLER_POINT_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING0_SAMPLER_BILINEAR_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING0_SAMPLER_BILINEAR_CLAMP #pragma shader_feature_local _ _RIM_LIGHTING0_CUSTOM_VIEW_VECTOR #pragma shader_feature_local _ _RIM_LIGHTING0_REFLECT_IN_WORLD #pragma shader_feature_local _ _RIM_LIGHTING1 #pragma shader_feature_local _ _RIM_LIGHTING1_MASK #pragma shader_feature_local _ _RIM_LIGHTING1_GLITTER #pragma shader_feature_local _ _RIM_LIGHTING1_POLAR_MASK -#pragma shader_feature_local _ _RIM_LIGHTING1_SAMPLER_REPEAT -#pragma shader_feature_local _ _RIM_LIGHTING1_SAMPLER_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING1_SAMPLER_LINEAR_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING1_SAMPLER_LINEAR_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING1_SAMPLER_POINT_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING1_SAMPLER_POINT_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING1_SAMPLER_BILINEAR_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING1_SAMPLER_BILINEAR_CLAMP #pragma shader_feature_local _ _RIM_LIGHTING1_CUSTOM_VIEW_VECTOR #pragma shader_feature_local _ _RIM_LIGHTING1_REFLECT_IN_WORLD #pragma shader_feature_local _ _RIM_LIGHTING2 #pragma shader_feature_local _ _RIM_LIGHTING2_MASK #pragma shader_feature_local _ _RIM_LIGHTING2_GLITTER #pragma shader_feature_local _ _RIM_LIGHTING2_POLAR_MASK -#pragma shader_feature_local _ _RIM_LIGHTING2_SAMPLER_REPEAT -#pragma shader_feature_local _ _RIM_LIGHTING2_SAMPLER_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING2_SAMPLER_LINEAR_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING2_SAMPLER_LINEAR_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING2_SAMPLER_POINT_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING2_SAMPLER_POINT_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING2_SAMPLER_BILINEAR_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING2_SAMPLER_BILINEAR_CLAMP #pragma shader_feature_local _ _RIM_LIGHTING2_CUSTOM_VIEW_VECTOR #pragma shader_feature_local _ _RIM_LIGHTING2_REFLECT_IN_WORLD #pragma shader_feature_local _ _RIM_LIGHTING3 #pragma shader_feature_local _ _RIM_LIGHTING3_MASK #pragma shader_feature_local _ _RIM_LIGHTING3_GLITTER #pragma shader_feature_local _ _RIM_LIGHTING3_POLAR_MASK -#pragma shader_feature_local _ _RIM_LIGHTING3_SAMPLER_REPEAT -#pragma shader_feature_local _ _RIM_LIGHTING3_SAMPLER_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING3_SAMPLER_LINEAR_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING3_SAMPLER_LINEAR_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING3_SAMPLER_POINT_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING3_SAMPLER_POINT_CLAMP +#pragma shader_feature_local _ _RIM_LIGHTING3_SAMPLER_BILINEAR_REPEAT +#pragma shader_feature_local _ _RIM_LIGHTING3_SAMPLER_BILINEAR_CLAMP #pragma shader_feature_local _ _RIM_LIGHTING3_CUSTOM_VIEW_VECTOR #pragma shader_feature_local _ _RIM_LIGHTING3_REFLECT_IN_WORLD #pragma shader_feature_local _ _OKLAB @@ -80,8 +100,12 @@ #pragma shader_feature_local _ _PBR_OVERLAY0_MIX_ADD #pragma shader_feature_local _ _PBR_OVERLAY0_MIX_MIN #pragma shader_feature_local _ _PBR_OVERLAY0_MIX_MAX -#pragma shader_feature_local _ _PBR_OVERLAY0_SAMPLER_REPEAT -#pragma shader_feature_local _ _PBR_OVERLAY0_SAMPLER_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY0_SAMPLER_LINEAR_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY0_SAMPLER_LINEAR_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY0_SAMPLER_POINT_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY0_SAMPLER_POINT_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY0_SAMPLER_BILINEAR_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY0_SAMPLER_BILINEAR_CLAMP #pragma shader_feature_local _ _PBR_OVERLAY1 #pragma shader_feature_local _ _PBR_OVERLAY1_BASECOLOR_MAP #pragma shader_feature_local _ _PBR_OVERLAY1_EMISSION_MAP @@ -95,8 +119,12 @@ #pragma shader_feature_local _ _PBR_OVERLAY1_MIX_ADD #pragma shader_feature_local _ _PBR_OVERLAY1_MIX_MIN #pragma shader_feature_local _ _PBR_OVERLAY1_MIX_MAX -#pragma shader_feature_local _ _PBR_OVERLAY1_SAMPLER_REPEAT -#pragma shader_feature_local _ _PBR_OVERLAY1_SAMPLER_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY1_SAMPLER_LINEAR_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY1_SAMPLER_LINEAR_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY1_SAMPLER_POINT_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY1_SAMPLER_POINT_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY1_SAMPLER_BILINEAR_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY1_SAMPLER_BILINEAR_CLAMP #pragma shader_feature_local _ _PBR_OVERLAY2 #pragma shader_feature_local _ _PBR_OVERLAY2_BASECOLOR_MAP #pragma shader_feature_local _ _PBR_OVERLAY2_EMISSION_MAP @@ -110,8 +138,12 @@ #pragma shader_feature_local _ _PBR_OVERLAY2_MIX_ADD #pragma shader_feature_local _ _PBR_OVERLAY2_MIX_MIN #pragma shader_feature_local _ _PBR_OVERLAY2_MIX_MAX -#pragma shader_feature_local _ _PBR_OVERLAY2_SAMPLER_REPEAT -#pragma shader_feature_local _ _PBR_OVERLAY2_SAMPLER_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY2_SAMPLER_LINEAR_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY2_SAMPLER_LINEAR_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY2_SAMPLER_POINT_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY2_SAMPLER_POINT_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY2_SAMPLER_BILINEAR_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY2_SAMPLER_BILINEAR_CLAMP #pragma shader_feature_local _ _PBR_OVERLAY3 #pragma shader_feature_local _ _PBR_OVERLAY3_BASECOLOR_MAP #pragma shader_feature_local _ _PBR_OVERLAY3_EMISSION_MAP @@ -125,8 +157,12 @@ #pragma shader_feature_local _ _PBR_OVERLAY3_MIX_ADD #pragma shader_feature_local _ _PBR_OVERLAY3_MIX_MIN #pragma shader_feature_local _ _PBR_OVERLAY3_MIX_MAX -#pragma shader_feature_local _ _PBR_OVERLAY3_SAMPLER_REPEAT -#pragma shader_feature_local _ _PBR_OVERLAY3_SAMPLER_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY3_SAMPLER_LINEAR_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY3_SAMPLER_LINEAR_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY3_SAMPLER_POINT_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY3_SAMPLER_POINT_CLAMP +#pragma shader_feature_local _ _PBR_OVERLAY3_SAMPLER_BILINEAR_REPEAT +#pragma shader_feature_local _ _PBR_OVERLAY3_SAMPLER_BILINEAR_CLAMP #pragma shader_feature_local _ _DECAL0 #pragma shader_feature_local _ _DECAL0_ROUGHNESS #pragma shader_feature_local _ _DECAL0_METALLIC diff --git a/globals.cginc b/globals.cginc index 764b9f8..8f29bc1 100644 --- a/globals.cginc +++ b/globals.cginc @@ -134,6 +134,7 @@ texture2D _PBR_Overlay0_NormalTex; float4 _PBR_Overlay0_NormalTex_ST; float _PBR_Overlay0_Tex_NormalStr; texture2D _PBR_Overlay0_Mask; +float4 _PBR_Overlay0_Mask_ST; float _PBR_Overlay0_Mask_Invert; float _PBR_Overlay0_Constrain_By_Alpha; float _PBR_Overlay0_Constrain_By_Alpha_Min; @@ -166,6 +167,7 @@ texture2D _PBR_Overlay1_NormalTex; float4 _PBR_Overlay1_NormalTex_ST; float _PBR_Overlay1_Tex_NormalStr; texture2D _PBR_Overlay1_Mask; +float4 _PBR_Overlay1_Mask_ST; float _PBR_Overlay1_Mask_Invert; float _PBR_Overlay1_Constrain_By_Alpha; float _PBR_Overlay1_Constrain_By_Alpha_Min; @@ -198,6 +200,7 @@ texture2D _PBR_Overlay2_NormalTex; float4 _PBR_Overlay2_NormalTex_ST; float _PBR_Overlay2_Tex_NormalStr; texture2D _PBR_Overlay2_Mask; +float4 _PBR_Overlay2_Mask_ST; float _PBR_Overlay2_Mask_Invert; float _PBR_Overlay2_Constrain_By_Alpha; float _PBR_Overlay2_Constrain_By_Alpha_Min; @@ -230,6 +233,7 @@ texture2D _PBR_Overlay3_NormalTex; float4 _PBR_Overlay3_NormalTex_ST; float _PBR_Overlay3_Tex_NormalStr; texture2D _PBR_Overlay3_Mask; +float4 _PBR_Overlay3_Mask_ST; float _PBR_Overlay3_Mask_Invert; float _PBR_Overlay3_Constrain_By_Alpha; float _PBR_Overlay3_Constrain_By_Alpha_Min; diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc index c0bc46e..e79681a 100644 --- a/tooner_lighting.cginc +++ b/tooner_lighting.cginc @@ -593,66 +593,146 @@ float2 get_uv_by_channel(v2f i, uint which_channel) { #define UV_SCOFF(i, tex_st, which_channel) get_uv_by_channel(i, round(which_channel)) * (tex_st).xy + (tex_st).zw -#if defined(_PBR_SAMPLER_REPEAT) +#if defined(_PBR_SAMPLER_LINEAR_REPEAT) +#define GET_SAMPLER_PBR linear_repeat_s +#elif defined(_PBR_SAMPLER_LINEAR_CLAMP) +#define GET_SAMPLER_PBR linear_clamp_s +#elif defined(_PBR_SAMPLER_POINT_REPEAT) +#define GET_SAMPLER_PBR point_repeat_s +#elif defined(_PBR_SAMPLER_POINT_CLAMP) +#define GET_SAMPLER_PBR point_clamp_s +#elif defined(_PBR_SAMPLER_BILINEAR_REPEAT) #define GET_SAMPLER_PBR bilinear_repeat_s -#elif defined(_PBR_SAMPLER_CLAMP) +#elif defined(_PBR_SAMPLER_BILINEAR_CLAMP) #define GET_SAMPLER_PBR bilinear_clamp_s #else #define GET_SAMPLER_PBR bilinear_clamp_s #endif -#if defined(_PBR_OVERLAY0_SAMPLER_REPEAT) + +#if defined(_PBR_OVERLAY0_SAMPLER_LINEAR_REPEAT) #define GET_SAMPLER_OV0 linear_repeat_s -#elif defined(_PBR_OVERLAY0_SAMPLER_CLAMP) +#elif defined(_PBR_OVERLAY0_SAMPLER_LINEAR_CLAMP) #define GET_SAMPLER_OV0 linear_clamp_s +#elif defined(_PBR_OVERLAY0_SAMPLER_POINT_REPEAT) +#define GET_SAMPLER_OV0 point_repeat_s +#elif defined(_PBR_OVERLAY0_SAMPLER_POINT_CLAMP) +#define GET_SAMPLER_OV0 point_clamp_s +#elif defined(_PBR_OVERLAY0_SAMPLER_BILINEAR_REPEAT) +#define GET_SAMPLER_OV0 bilinear_repeat_s +#elif defined(_PBR_OVERLAY0_SAMPLER_BILINEAR_CLAMP) +#define GET_SAMPLER_OV0 bilinear_clamp_s #else #define GET_SAMPLER_OV0 linear_clamp_s #endif -#if defined(_PBR_OVERLAY1_SAMPLER_REPEAT) + +#if defined(_PBR_OVERLAY1_SAMPLER_LINEAR_REPEAT) #define GET_SAMPLER_OV1 linear_repeat_s -#elif defined(_PBR_OVERLAY1_SAMPLER_CLAMP) +#elif defined(_PBR_OVERLAY1_SAMPLER_LINEAR_CLAMP) #define GET_SAMPLER_OV1 linear_clamp_s +#elif defined(_PBR_OVERLAY1_SAMPLER_POINT_REPEAT) +#define GET_SAMPLER_OV1 point_repeat_s +#elif defined(_PBR_OVERLAY1_SAMPLER_POINT_CLAMP) +#define GET_SAMPLER_OV1 point_clamp_s +#elif defined(_PBR_OVERLAY1_SAMPLER_BILINEAR_REPEAT) +#define GET_SAMPLER_OV1 bilinear_repeat_s +#elif defined(_PBR_OVERLAY1_SAMPLER_BILINEAR_CLAMP) +#define GET_SAMPLER_OV1 bilinear_clamp_s #else #define GET_SAMPLER_OV1 linear_clamp_s #endif -#if defined(_PBR_OVERLAY2_SAMPLER_REPEAT) + +#if defined(_PBR_OVERLAY2_SAMPLER_LINEAR_REPEAT) #define GET_SAMPLER_OV2 linear_repeat_s -#elif defined(_PBR_OVERLAY2_SAMPLER_CLAMP) +#elif defined(_PBR_OVERLAY2_SAMPLER_LINEAR_CLAMP) #define GET_SAMPLER_OV2 linear_clamp_s +#elif defined(_PBR_OVERLAY2_SAMPLER_POINT_REPEAT) +#define GET_SAMPLER_OV2 point_repeat_s +#elif defined(_PBR_OVERLAY2_SAMPLER_POINT_CLAMP) +#define GET_SAMPLER_OV2 point_clamp_s +#elif defined(_PBR_OVERLAY2_SAMPLER_BILINEAR_REPEAT) +#define GET_SAMPLER_OV2 bilinear_repeat_s +#elif defined(_PBR_OVERLAY2_SAMPLER_BILINEAR_CLAMP) +#define GET_SAMPLER_OV2 bilinear_clamp_s #else #define GET_SAMPLER_OV2 linear_clamp_s #endif -#if defined(_PBR_OVERLAY3_SAMPLER_REPEAT) + +#if defined(_PBR_OVERLAY3_SAMPLER_LINEAR_REPEAT) #define GET_SAMPLER_OV3 linear_repeat_s -#elif defined(_PBR_OVERLAY3_SAMPLER_CLAMP) +#elif defined(_PBR_OVERLAY3_SAMPLER_LINEAR_CLAMP) #define GET_SAMPLER_OV3 linear_clamp_s +#elif defined(_PBR_OVERLAY3_SAMPLER_POINT_REPEAT) +#define GET_SAMPLER_OV3 point_repeat_s +#elif defined(_PBR_OVERLAY3_SAMPLER_POINT_CLAMP) +#define GET_SAMPLER_OV3 point_clamp_s +#elif defined(_PBR_OVERLAY3_SAMPLER_BILINEAR_REPEAT) +#define GET_SAMPLER_OV3 bilinear_repeat_s +#elif defined(_PBR_OVERLAY3_SAMPLER_BILINEAR_CLAMP) +#define GET_SAMPLER_OV3 bilinear_clamp_s #else #define GET_SAMPLER_OV3 linear_clamp_s #endif -#if defined(_RIM_LIGHTING0_SAMPLER_REPEAT) + +#if defined(_RIM_LIGHTING0_SAMPLER_LINEAR_REPEAT) #define GET_SAMPLER_RL0 linear_repeat_s -#elif defined(_RIM_LIGHTING0_SAMPLER_CLAMP) +#elif defined(_RIM_LIGHTING0_SAMPLER_LINEAR_CLAMP) #define GET_SAMPLER_RL0 linear_clamp_s +#elif defined(_RIM_LIGHTING0_SAMPLER_POINT_REPEAT) +#define GET_SAMPLER_RL0 point_repeat_s +#elif defined(_RIM_LIGHTING0_SAMPLER_POINT_CLAMP) +#define GET_SAMPLER_RL0 point_clamp_s +#elif defined(_RIM_LIGHTING0_SAMPLER_BILINEAR_REPEAT) +#define GET_SAMPLER_RL0 bilinear_repeat_s +#elif defined(_RIM_LIGHTING0_SAMPLER_BILINEAR_CLAMP) +#define GET_SAMPLER_RL0 bilinear_clamp_s #else #define GET_SAMPLER_RL0 linear_clamp_s #endif -#if defined(_RIM_LIGHTING1_SAMPLER_REPEAT) + +#if defined(_RIM_LIGHTING1_SAMPLER_LINEAR_REPEAT) #define GET_SAMPLER_RL1 linear_repeat_s -#elif defined(_RIM_LIGHTING1_SAMPLER_CLAMP) +#elif defined(_RIM_LIGHTING1_SAMPLER_LINEAR_CLAMP) #define GET_SAMPLER_RL1 linear_clamp_s +#elif defined(_RIM_LIGHTING1_SAMPLER_POINT_REPEAT) +#define GET_SAMPLER_RL1 point_repeat_s +#elif defined(_RIM_LIGHTING1_SAMPLER_POINT_CLAMP) +#define GET_SAMPLER_RL1 point_clamp_s +#elif defined(_RIM_LIGHTING1_SAMPLER_BILINEAR_REPEAT) +#define GET_SAMPLER_RL1 bilinear_repeat_s +#elif defined(_RIM_LIGHTING1_SAMPLER_BILINEAR_CLAMP) +#define GET_SAMPLER_RL1 bilinear_clamp_s #else #define GET_SAMPLER_RL1 linear_clamp_s #endif -#if defined(_RIM_LIGHTING2_SAMPLER_REPEAT) + +#if defined(_RIM_LIGHTING2_SAMPLER_LINEAR_REPEAT) #define GET_SAMPLER_RL2 linear_repeat_s -#elif defined(_RIM_LIGHTING2_SAMPLER_CLAMP) +#elif defined(_RIM_LIGHTING2_SAMPLER_LINEAR_CLAMP) #define GET_SAMPLER_RL2 linear_clamp_s +#elif defined(_RIM_LIGHTING2_SAMPLER_POINT_REPEAT) +#define GET_SAMPLER_RL2 point_repeat_s +#elif defined(_RIM_LIGHTING2_SAMPLER_POINT_CLAMP) +#define GET_SAMPLER_RL2 point_clamp_s +#elif defined(_RIM_LIGHTING2_SAMPLER_BILINEAR_REPEAT) +#define GET_SAMPLER_RL2 bilinear_repeat_s +#elif defined(_RIM_LIGHTING2_SAMPLER_BILINEAR_CLAMP) +#define GET_SAMPLER_RL2 bilinear_clamp_s #else #define GET_SAMPLER_RL2 linear_clamp_s #endif -#if defined(_RIM_LIGHTING3_SAMPLER_REPEAT) + +#if defined(_RIM_LIGHTING3_SAMPLER_LINEAR_REPEAT) #define GET_SAMPLER_RL3 linear_repeat_s -#elif defined(_RIM_LIGHTING3_SAMPLER_CLAMP) +#elif defined(_RIM_LIGHTING3_SAMPLER_LINEAR_CLAMP) #define GET_SAMPLER_RL3 linear_clamp_s +#elif defined(_RIM_LIGHTING3_SAMPLER_POINT_REPEAT) +#define GET_SAMPLER_RL3 point_repeat_s +#elif defined(_RIM_LIGHTING3_SAMPLER_POINT_CLAMP) +#define GET_SAMPLER_RL3 point_clamp_s +#elif defined(_RIM_LIGHTING3_SAMPLER_BILINEAR_REPEAT) +#define GET_SAMPLER_RL3 bilinear_repeat_s +#elif defined(_RIM_LIGHTING3_SAMPLER_BILINEAR_CLAMP) +#define GET_SAMPLER_RL3 bilinear_clamp_s #else #define GET_SAMPLER_RL3 linear_clamp_s #endif @@ -737,6 +817,7 @@ void getOverlayAlbedoRoughnessMetallic(inout PbrOverlay ov, #if defined(_PBR_OVERLAY0_MASK) ov.ov0_mask = _PBR_Overlay0_Mask.SampleLevel(GET_SAMPLER_OV0, + UV_SCOFF(i, _PBR_Overlay0_Mask_ST, _PBR_Overlay0_UV_Select), get_uv_by_channel(i, _PBR_Overlay0_UV_Select), 0); ov.ov0_mask = ((bool) round(_PBR_Overlay0_Mask_Invert)) ? 1.0 - ov.ov0_mask : ov.ov0_mask; #else @@ -779,7 +860,7 @@ void getOverlayAlbedoRoughnessMetallic(inout PbrOverlay ov, #if defined(_PBR_OVERLAY1_MASK) ov.ov1_mask = _PBR_Overlay1_Mask.SampleLevel(GET_SAMPLER_OV1, - get_uv_by_channel(i, _PBR_Overlay1_UV_Select), 0); + UV_SCOFF(i, _PBR_Overlay1_Mask_ST, _PBR_Overlay1_UV_Select), 0); ov.ov1_mask = ((bool) round(_PBR_Overlay1_Mask_Invert)) ? 1.0 - ov.ov1_mask : ov.ov1_mask; #else ov.ov1_mask = 1; @@ -821,7 +902,7 @@ void getOverlayAlbedoRoughnessMetallic(inout PbrOverlay ov, #if defined(_PBR_OVERLAY2_MASK) ov.ov2_mask = _PBR_Overlay2_Mask.SampleLevel(GET_SAMPLER_OV2, - get_uv_by_channel(i, _PBR_Overlay2_UV_Select), 0); + UV_SCOFF(i, _PBR_Overlay2_Mask_ST, _PBR_Overlay2_UV_Select), 0); ov.ov2_mask = ((bool) round(_PBR_Overlay2_Mask_Invert)) ? 1.0 - ov.ov2_mask : ov.ov2_mask; #else ov.ov2_mask = 1; @@ -863,7 +944,7 @@ void getOverlayAlbedoRoughnessMetallic(inout PbrOverlay ov, #if defined(_PBR_OVERLAY3_MASK) ov.ov3_mask = _PBR_Overlay3_Mask.SampleLevel(GET_SAMPLER_OV3, - get_uv_by_channel(i, _PBR_Overlay3_UV_Select), 0); + UV_SCOFF(i, _PBR_Overlay3_Mask_ST, _PBR_Overlay3_UV_Select), 0); ov.ov3_mask = ((bool) round(_PBR_Overlay3_Mask_Invert)) ? 1.0 - ov.ov3_mask : ov.ov3_mask; #else ov.ov3_mask = 1; |
