From 864c2ba12dc864d9cb55cb797ba8919bee5b5913 Mon Sep 17 00:00:00 2001 From: yum Date: Mon, 16 Feb 2026 16:32:00 -0800 Subject: Add instancing distance culling, scale deformation * GPU instance distance culling now takes a min/max range * Fold recovers ops from material, allowing state to persist across editor restarts * Add scale node to vertex deformation framework * Remove fold presets - dumb LLM idea, unused * Drop more "undeform" code; unused, was for ray marching, which does not work well * Fix reflection energy compensation; was using cloth math, which makes things too bright --- vertex.cginc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'vertex.cginc') diff --git a/vertex.cginc b/vertex.cginc index 77412a9..2e0c1dd 100755 --- a/vertex.cginc +++ b/vertex.cginc @@ -15,6 +15,7 @@ #define OPCODE_FBM 8 #define OPCODE_PLANE_TO_HEMI_OCTAHEDRON 9 #define OPCODE_HEMI_OCTAHEDRON_TO_PLANE 10 +#define OPCODE_SCALE 11 #if defined(_VERTEX_DEFORMATION) @@ -182,6 +183,19 @@ void apply_hemi_octahedron_to_plane_normal(inout float3 objPos, inout float3 obj hemi_octahedron_to_plane_normal(objPos, objNorm, objTan, p, r, s, t); } +void apply_scale(inout float3 objPos, float4 v0, float f0) { + float3 k = v0.xyz; + float t = f0; + objPos = scale(objPos, k, t); +} + +void apply_scale_normal(inout float3 objPos, inout float3 objNorm, + inout float3 objTan, float4 v0, float f0) { + float3 k = v0.xyz; + float t = f0; + scale_normal(objPos, objNorm, objTan, k, t); +} + void deform(inout float3 objPos) { const float t = getTime(); @@ -420,6 +434,9 @@ void deform(inout float3 objPos) { case OPCODE_HEMI_OCTAHEDRON_TO_PLANE: apply_hemi_octahedron_to_plane(objPos, v0, v1, v2, f0); break; + case OPCODE_SCALE: + apply_scale(objPos, v0, f0); + break; } } } @@ -665,6 +682,9 @@ void deform_normal(inout float3 objPos, inout float3 objNorm, inout float3 objTa case OPCODE_HEMI_OCTAHEDRON_TO_PLANE: apply_hemi_octahedron_to_plane_normal(objPos, objNorm, objTan, v0, v1, v2, f0); break; + case OPCODE_SCALE: + apply_scale_normal(objPos, objNorm, objTan, v0, f0); + break; } } } -- cgit v1.2.3