From ccdda956f7de812bb9c318161c6852301a60d413 Mon Sep 17 00:00:00 2001 From: yum Date: Tue, 25 Mar 2025 18:21:18 -0700 Subject: Add spherize feature --- 2ner.cginc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to '2ner.cginc') diff --git a/2ner.cginc b/2ner.cginc index 10b41a8..e8d6ae3 100644 --- a/2ner.cginc +++ b/2ner.cginc @@ -70,6 +70,16 @@ v2f vert(appdata v) { shatterWaveVert(v.vertex.xyz, v.normal, v.tangent); #endif +#if defined(_SPHERIZE) + { + float3 tgt_normal = normalize(v.vertex.xyz); + float3 tgt_tangent = normalize(float3(tgt_normal.y, -tgt_normal.x, 0)); + float3 tgt_pos = tgt_normal * _Spherize_Radius; + v.normal = normalize(lerp(v.normal, tgt_normal, _Spherize_Strength)); + v.vertex.xyz = lerp(v.vertex.xyz, tgt_pos, _Spherize_Strength); + } +#endif + #if defined(OUTLINE_PASS) [branch] if (!_Outlines_Enabled_Dynamic) { -- cgit v1.2.3