diff options
| author | yum <yum.food.vr@gmail.com> | 2025-03-25 18:21:18 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-03-25 18:21:18 -0700 |
| commit | ccdda956f7de812bb9c318161c6852301a60d413 (patch) | |
| tree | e98f2576f4828f7b895ac2c8044c6042cf329300 | |
| parent | f46f3023bb716950db30b48c245c82ad2d6ad2a3 (diff) | |
Add spherize feature
| -rw-r--r-- | 2ner.cginc | 10 | ||||
| -rw-r--r-- | 2ner.shader | 8 | ||||
| -rw-r--r-- | features.cginc | 4 | ||||
| -rw-r--r-- | globals.cginc | 5 |
4 files changed, 27 insertions, 0 deletions
@@ -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) {
diff --git a/2ner.shader b/2ner.shader index d6047e1..377f705 100644 --- a/2ner.shader +++ b/2ner.shader @@ -528,6 +528,14 @@ Shader "yum_food/2ner" [HideInInspector] m_end_Tessellation("Tessellation", Float) = 0 //endex + //ifex _Spherize_Enabled==0 + [HideInInspector] m_start_Spherize("Spherize", Float) = 0 + [ThryToggle(_SPHERIZE)] _Spherize_Enabled("Enable", Float) = 0 + _Spherize_Radius("Radius", Float) = 1 + _Spherize_Strength("Strength", Range(0, 1)) = 1 + [HideInInspector] m_end_Spherize("Spherize", Float) = 0 + //endex + //ifex _Vertex_Domain_Warping_Enabled==0 [HideInInspector] m_start_Vertex_Domain_Warping("Vertex domain warping", Float) = 0 [ThryToggle(_VERTEX_DOMAIN_WARPING)]_Vertex_Domain_Warping_Enabled("Enable", Float) = 0 diff --git a/features.cginc b/features.cginc index 163da78..da2cd69 100644 --- a/features.cginc +++ b/features.cginc @@ -208,5 +208,9 @@ #pragma shader_feature_local _TESSELLATION //endex +//ifex _Spherize_Enabled==0 +#pragma shader_feature_local _SPHERIZE +//endex + #endif // __FEATURES_INC diff --git a/globals.cginc b/globals.cginc index ba223ee..9cabad6 100644 --- a/globals.cginc +++ b/globals.cginc @@ -429,4 +429,9 @@ float3 _Tessellation_Edge_Factors; float _Tessellation_Inside_Factor;
#endif // _TESSELLATION
+#if defined(_SPHERIZE)
+float _Spherize_Radius;
+float _Spherize_Strength;
+#endif // _SPHERIZE
+
#endif // __GLOBALS_INC
|
