diff options
| author | yum <yum.food.vr@gmail.com> | 2024-07-16 12:50:12 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2024-07-16 12:50:12 -0700 |
| commit | a95481afa226d76d671b13515ee2abc59359b87a (patch) | |
| tree | 6dafd93ecf2770e2b1e878bcf193b97ef19934a5 /mochie_shadow_caster.cginc | |
| parent | fdcb4dee7e8c5dbc46dc1513b57ed14851876303 (diff) | |
Add lighting multiplier & reflection probe saturation control
Also:
* Shadow caster works with cutout now
* Normalize interpolated mesh normal in fragment shader
* Indirect specular affects clearcoat
* Bugfix: rename v2f vertex to pos in tessellation shader
* Hue shift affects outlines
Diffstat (limited to 'mochie_shadow_caster.cginc')
| -rw-r--r-- | mochie_shadow_caster.cginc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/mochie_shadow_caster.cginc b/mochie_shadow_caster.cginc index 8ca599c..6c33ce7 100644 --- a/mochie_shadow_caster.cginc +++ b/mochie_shadow_caster.cginc @@ -32,17 +32,21 @@ #pragma multi_compile_instancing #pragma multi_compile_shadowcaster #include "UnityCG.cginc" +#include "globals.cginc" struct appdata { float4 vertex : POSITION; float3 normal : NORMAL; + float2 uv : TEXCOORD0; + UNITY_VERTEX_INPUT_INSTANCE_ID }; struct v2f { float4 pos : SV_POSITION; + float2 uv : TEXCOORD0; UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO + UNITY_VERTEX_OUTPUT_STEREO }; v2f vert (appdata v){ @@ -50,10 +54,22 @@ v2f vert (appdata v){ UNITY_SETUP_INSTANCE_ID(v); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) - return o; + o.uv = v.uv; + return o; } float4 frag (v2f i) : SV_Target { +#if defined(_BASECOLOR_MAP) + float iddx = ddx(i.uv.x); + float iddy = ddx(i.uv.y); + float4 albedo = _MainTex.SampleGrad(linear_repeat_s, i.uv, iddx, iddy); + albedo *= _Color; +#else + float4 albedo = _Color; +#endif // _BASECOLOR_MAP +#if defined(_RENDERING_CUTOUT) + clip(albedo.a - _Alpha_Cutoff); +#endif UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); return 0; } |
