summaryrefslogtreecommitdiffstats
path: root/texture_utils.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-02-18 16:35:22 -0800
committeryum <yum.food.vr@gmail.com>2025-02-18 16:35:22 -0800
commit547c6064f6a8ab2749f496ce7ea2856e8cc1bcda (patch)
tree080e30ef69f9e4daa476e529c9f015bd2cf77fa8 /texture_utils.cginc
parent3087ea990dfea49c32a8a9d9f6ac9c1790817efc (diff)
Add matcaps and rim lighting
* Add min brightness * MainTex and BumpMap can be independently tiled * Fix outlines * Remove lightDirTS (unused) * Normalize i.normal in pixel shader * Elide unused AO when locked * Wrap lines at 80 columns
Diffstat (limited to 'texture_utils.cginc')
-rw-r--r--texture_utils.cginc24
1 files changed, 24 insertions, 0 deletions
diff --git a/texture_utils.cginc b/texture_utils.cginc
new file mode 100644
index 0000000..4d02fbc
--- /dev/null
+++ b/texture_utils.cginc
@@ -0,0 +1,24 @@
+#ifndef __TEXTURE_UTILS_INC
+#define __TEXTURE_UTILS_INC
+
+#include "interpolators.cginc"
+
+float2 get_uv_by_channel(v2f i, uint which_channel) {
+ [forcecase]
+ switch (which_channel) {
+ case 0:
+ return i.uv01.xy;
+ break;
+ case 1:
+ return i.uv01.zw;
+ break;
+ default:
+ return 0;
+ break;
+ }
+}
+
+#define UV_SCOFF(i, tex_st, which_channel) get_uv_by_channel(i, round(which_channel)) * (tex_st).xy + (tex_st).zw
+
+#endif // __TEXTURE_UTILS_INC
+