summaryrefslogtreecommitdiffstats
path: root/tooner_outline_pass.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-07-13 16:33:25 -0700
committeryum <yum.food.vr@gmail.com>2024-07-13 16:33:25 -0700
commit3dcb2fd0e240f3c0141e65c32bc2c4a7f8e9fd20 (patch)
tree3972c678d7f01022a31c6eadffc1dcff50c9f83c /tooner_outline_pass.cginc
parentbf4457b96cd46ed2d3d61bde2eb4d58d3114730b (diff)
Integration pixellation and trochoid shaders
Trochoid is a WIP. Need to do some magic to make it properly shear. In short: it's currently implemented as a standalone Mesh Renderer object which I place on my avatar's neck bone. Since its object origin is not at the hip bone like everything else, it behaves weirdly when shearing. Solution is to implement it as a regular skinned mesh renderer. Requires some careful analysis to get right.
Diffstat (limited to 'tooner_outline_pass.cginc')
-rw-r--r--tooner_outline_pass.cginc41
1 files changed, 40 insertions, 1 deletions
diff --git a/tooner_outline_pass.cginc b/tooner_outline_pass.cginc
index c7b6ded..72deee6 100644
--- a/tooner_outline_pass.cginc
+++ b/tooner_outline_pass.cginc
@@ -8,6 +8,7 @@
#include "globals.cginc"
#include "math.cginc"
#include "pbr.cginc"
+#include "trochoid_math.cginc"
#include "tooner_scroll.cginc"
#include "UnityCG.cginc"
@@ -25,7 +26,22 @@ struct tess_factors {
v2f vert(appdata v)
{
-#if defined(_GIMMICK_SHEAR_LOCATION)
+#if defined(_TROCHOID)
+ {
+#define PI 3.14159265
+#define TAU PI * 2.0
+ float theta = v.uv0.x * TAU;
+ float r0 = length(v.vertex.xyz);
+
+ float x = v.vertex.x;
+ float y = v.vertex.y;
+ float z = v.vertex.z;
+
+ v.vertex.xyz = trochoid_map(theta, r0, z);
+ }
+#endif
+
+#if !defined(_SCROLL) && defined(_GIMMICK_SHEAR_LOCATION)
if (_Gimmick_Shear_Location_Enable_Dynamic) {
v.vertex = mul(float4x4(
_Gimmick_Shear_Location_Strength.x, 0, 0, 0,
@@ -270,6 +286,29 @@ void geom(triangle v2f tri_in[3],
float3 v1_objPos = mul(unity_WorldToObject, float4(v1.worldPos, 1));
float3 v2_objPos = mul(unity_WorldToObject, float4(v2.worldPos, 1));
+#if defined(_GIMMICK_SHEAR_LOCATION)
+ if (_Gimmick_Shear_Location_Enable_Dynamic) {
+ v0_objPos = mul(float3x3(
+ _Gimmick_Shear_Location_Strength.x, 0, 0,
+ 0, _Gimmick_Shear_Location_Strength.y, 0,
+ 0, 0, _Gimmick_Shear_Location_Strength.z),
+ v0_objPos);
+ v1_objPos = mul(float3x3(
+ _Gimmick_Shear_Location_Strength.x, 0, 0,
+ 0, _Gimmick_Shear_Location_Strength.y, 0,
+ 0, 0, _Gimmick_Shear_Location_Strength.z),
+ v1_objPos);
+ v2_objPos = mul(float3x3(
+ _Gimmick_Shear_Location_Strength.x, 0, 0,
+ 0, _Gimmick_Shear_Location_Strength.y, 0,
+ 0, 0, _Gimmick_Shear_Location_Strength.z),
+ v2_objPos);
+ v0.worldPos.xyz = mul(unity_ObjectToWorld, v0_objPos);
+ v1.worldPos.xyz = mul(unity_ObjectToWorld, v1_objPos);
+ v2.worldPos.xyz = mul(unity_ObjectToWorld, v2_objPos);
+ }
+#endif
+
v0.vertex = UnityObjectToClipPos(v0_objPos);
v1.vertex = UnityObjectToClipPos(v1_objPos);
v2.vertex = UnityObjectToClipPos(v2_objPos);