diff options
| author | yum <yum.food.vr@gmail.com> | 2026-02-16 16:32:00 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2026-02-16 16:36:24 -0800 |
| commit | 864c2ba12dc864d9cb55cb797ba8919bee5b5913 (patch) | |
| tree | aa6cd98a71e4ef05d23f762127d3759a4a3e3e21 /vertex.cginc | |
| parent | 6504b2c4631bab477838548167b88c1052eac263 (diff) | |
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
Diffstat (limited to 'vertex.cginc')
| -rwxr-xr-x | vertex.cginc | 20 |
1 files changed, 20 insertions, 0 deletions
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; } } } |
