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 /tooner_lighting.cginc | |
| 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.
Diffstat (limited to 'tooner_lighting.cginc')
| -rw-r--r-- | tooner_lighting.cginc | 123 |
1 files changed, 102 insertions, 21 deletions
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; |
