diff options
| author | yum <yum.food.vr@gmail.com> | 2026-02-25 18:55:49 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-02-25 18:55:49 -0800 |
| commit | e7c7b5e9fd1dc14755da97b0f4edb0bc92c744b3 (patch) | |
| tree | 5a1cbf52ca16328e9beccc4b4ac7b09414899924 | |
| parent | 0e0584159c47c0229e1ba2120dcc782c7250d09f (diff) | |
Plumb matcaps & rim lighting
| -rwxr-xr-x | 3ner.cginc | 2 | ||||
| -rwxr-xr-x | 3ner.shader | 66 | ||||
| -rwxr-xr-x | features.cginc | 12 | ||||
| -rwxr-xr-x | globals.cginc | 34 | ||||
| -rw-r--r-- | matcap.cginc | 3 |
5 files changed, 108 insertions, 9 deletions
@@ -19,6 +19,7 @@ #include "ray_marching.cginc" #include "vertex.cginc" #include "impostor.cginc" +#include "matcap.cginc" v2f vert(appdata v) { #if defined(SHADOW_CASTER_PASS) && !defined(_SHADOW_CASTER) @@ -340,6 +341,7 @@ float4 frag(v2f i, uint facing : SV_IsFrontFace LightData light_data; GetLighting(i, pbr, light_data); + applyMatcapsAndRimLighting(i, pbr, light_data); #if 0 float c = light_data.common.NoV; diff --git a/3ner.shader b/3ner.shader index f38b614..678e757 100755 --- a/3ner.shader +++ b/3ner.shader @@ -56,13 +56,57 @@ Shader "yum_food/3ner" [HideInInspector] m_end_Ambient_Occlusion("Ambient Occlusion", Float) = 0 //endex - //ifex _Bent_Normals_Enabled==0 - [HideInInspector] m_start_Bent_Normals("Bent Normals", Float) = 0 - [ThryToggle(_BENT_NORMALS)] _Bent_Normals_Enabled("Enable", Float) = 0 - [Normal] _Bent_Normals_Map("Bent Normals", 2D) = "white" {} - _Bent_Normals_Strength("Bent Normals Strength", Range(0, 10)) = 1 - [HideInInspector] m_end_Bent_Normals("Bent Normals", Float) = 0 - //endex + [HideInInspector] m_start_Matcaps("Matcaps", Float) = 0 + //ifex _Matcap0_Enabled==0 + [HideInInspector] m_start_Matcap0("Matcap 0", Float) = 0 + [ThryToggle(_MATCAP0)] _Matcap0_Enabled("Enable", Float) = 0 + _Matcap0("Matcap", 2D) = "white" {} + _Matcap0_Strength("Strength", Range(0, 10)) = 1 + [ThryWideEnum(Replace, 0, Add, 1, Multiply, 2, Subtract, 3, Add Product, 4)] _Matcap0_Mode("Mode", Int) = 0 + [Toggle] _Matcap0_Invert("Invert", Float) = 0 + + //ifex _Matcap0_Quantization_Enabled==0 + [HideInInspector] m_start_Matcap0_Quantization("Quantization", Float) = 0 + [ThryToggle(_MATCAP0_QUANTIZATION)] _Matcap0_Quantization_Enabled("Enable", Float) = 0 + [IntRange] _Matcap0_Quantization_Steps("Steps", Range(1, 32)) = 8 + [HideInInspector] m_end_Matcap0_Quantization("Quantization", Float) = 0 + //endex + + //ifex _Matcap0_Mask_Enabled==0 + [HideInInspector] m_start_Matcap0_Mask("Mask", Float) = 0 + [ThryToggle(_MATCAP0_MASK)] _Matcap0_Mask_Enabled("Enable", Float) = 0 + _Matcap0_Mask("Mask", 2D) = "white" {} + [HideInInspector] m_end_Matcap0_Mask("Mask", Float) = 0 + //endex + [HideInInspector] m_end_Matcap0("Matcap 0", Float) = 0 + //endex + [HideInInspector] m_end_Matcaps("Matcaps", Float) = 0 + + [HideInInspector] m_start_Rim_Lightings("Rim Lighting", Float) = 0 + //ifex _Rim_Lighting0_Enabled==0 + [HideInInspector] m_start_Rim_Lighting0("Rim Lighting 0", Float) = 0 + [ThryToggle(_RIM_LIGHTING0)] _Rim_Lighting0_Enabled("Enable", Float) = 0 + _Rim_Lighting0_Color("Color", Color) = (1, 1, 1, 1) + _Rim_Lighting0_Center("Center", Range(0, 1)) = 1 + _Rim_Lighting0_Blur("Blur", Range(0, 0.5)) = 0.1 + [ThryWideEnum(Replace, 0, Add, 1, Multiply, 2, Subtract, 3, Add Product, 4)] _Rim_Lighting0_Mode("Mode", Int) = 1 + + //ifex _Rim_Lighting0_Quantization_Enabled==0 + [HideInInspector] m_start_Rim_Lighting0_Quantization("Quantization", Float) = 0 + [ThryToggle(_RIM_LIGHTING0_QUANTIZATION)] _Rim_Lighting0_Quantization_Enabled("Enable", Float) = 0 + [IntRange] _Rim_Lighting0_Quantization_Steps("Steps", Range(1, 32)) = 8 + [HideInInspector] m_end_Rim_Lighting0_Quantization("Quantization", Float) = 0 + //endex + + //ifex _Rim_Lighting0_Mask_Enabled==0 + [HideInInspector] m_start_Rim_Lighting0_Mask("Mask", Float) = 0 + [ThryToggle(_RIM_LIGHTING0_MASK)] _Rim_Lighting0_Mask_Enabled("Enable", Float) = 0 + _Rim_Lighting0_Mask("Mask", 2D) = "white" {} + [HideInInspector] m_end_Rim_Lighting0_Mask("Mask", Float) = 0 + //endex + [HideInInspector] m_end_Rim_Lighting0("Rim Lighting 0", Float) = 0 + //endex + [HideInInspector] m_end_Rim_Lightings("Rim Lighting", Float) = 0 //ifex _Clearcoat_Enabled==0 [HideInInspector] m_start_Clearcoat("Clearcoat", Float) = 0 @@ -125,6 +169,14 @@ Shader "yum_food/3ner" [HideInInspector] m_end_Shadows("Shadows", Float) = 0 //endex + //ifex _Bent_Normals_Enabled==0 + [HideInInspector] m_start_Bent_Normals("Bent Normals", Float) = 0 + [ThryToggle(_BENT_NORMALS)] _Bent_Normals_Enabled("Enable", Float) = 0 + [Normal] _Bent_Normals_Map("Bent Normals", 2D) = "white" {} + _Bent_Normals_Strength("Bent Normals Strength", Range(0, 10)) = 1 + [HideInInspector] m_end_Bent_Normals("Bent Normals", Float) = 0 + //endex + [HideInInspector] m_end_Main("Main", Float) = 0 [HideInInspector] m_start_Gimmicks("Gimmicks", Float) = 0 diff --git a/features.cginc b/features.cginc index 53ed832..a3be4bc 100755 --- a/features.cginc +++ b/features.cginc @@ -162,4 +162,16 @@ #pragma shader_feature_local _IMPOSTORS_DEPTH //endex +//ifex _Matcap0_Enabled==0 +#pragma shader_feature_local _MATCAP0 +#pragma shader_feature_local _MATCAP0_QUANTIZATION +#pragma shader_feature_local _MATCAP0_MASK +//endex + +//ifex _Rim_Lighting0_Enabled==0 +#pragma shader_feature_local _RIM_LIGHTING0 +#pragma shader_feature_local _RIM_LIGHTING0_QUANTIZATION +#pragma shader_feature_local _RIM_LIGHTING0_MASK +//endex + #endif // __FEATURES_INC diff --git a/globals.cginc b/globals.cginc index 600ecce..99afdad 100755 --- a/globals.cginc +++ b/globals.cginc @@ -248,6 +248,40 @@ float _Impostors_Debug_Depth; float3 _Impostors_Main_Camera_Pos; #endif // _IMPOSTORS +#define MATCAP_MODE_REPLACE 0 +#define MATCAP_MODE_ADD 1 +#define MATCAP_MODE_MULTIPLY 2 +#define MATCAP_MODE_SUBTRACT 3 +#define MATCAP_MODE_ADD_PRODUCT 4 + +#if defined(_MATCAP0) +texture2D _Matcap0; +float _Matcap0_Strength; +int _Matcap0_Mode; +float _Matcap0_Invert; +#if defined(_MATCAP0_QUANTIZATION) +float _Matcap0_Quantization_Steps; +#endif // _MATCAP0_QUANTIZATION +#if defined(_MATCAP0_MASK) +texture2D _Matcap0_Mask; +float4 _Matcap0_Mask_ST; +#endif // _MATCAP0_MASK +#endif // _MATCAP0 + +#if defined(_RIM_LIGHTING0) +float4 _Rim_Lighting0_Color; +float _Rim_Lighting0_Center; +float _Rim_Lighting0_Blur; +int _Rim_Lighting0_Mode; +#if defined(_RIM_LIGHTING0_QUANTIZATION) +float _Rim_Lighting0_Quantization_Steps; +#endif // _RIM_LIGHTING0_QUANTIZATION +#if defined(_RIM_LIGHTING0_MASK) +texture2D _Rim_Lighting0_Mask; +float4 _Rim_Lighting0_Mask_ST; +#endif // _RIM_LIGHTING0_MASK +#endif // _RIM_LIGHTING0 + #if defined(_VERTEX_DEFORMATION) float _Vertex_Deformation_Slot_0_Enabled; int _Vertex_Deformation_Slot_0_Opcode; diff --git a/matcap.cginc b/matcap.cginc index 3b9fb15..c34d294 100644 --- a/matcap.cginc +++ b/matcap.cginc @@ -54,7 +54,7 @@ float2 quantizeMatcapUV(float2 muv, float muv_r, float steps) { } #endif // _MATCAP0 || _RIM_LIGHTING0 -void applyMatcapsAndRimLighting(v2f i, inout Pbr pbr, inout Lighting light_data) { +void applyMatcapsAndRimLighting(v2f i, inout Pbr pbr, inout LightData light_data) { #if defined(_MATCAP0) || defined(_RIM_LIGHTING0) float2 muv = getMatcapUV(i, pbr); float2 muv_centered = muv * 2 - 1; @@ -100,7 +100,6 @@ void applyMatcapsAndRimLighting(v2f i, inout Pbr pbr, inout Lighting light_data) #endif applyMatcap(pbr, rl0, _Rim_Lighting0_Mode, rl0_mask); #endif // _RIM_LIGHTING0 - } #endif |
