From b96baa0ac7c779efb569b871fe3c96a41d04bf09 Mon Sep 17 00:00:00 2001 From: Donovan Hutchence Date: Wed, 26 Jun 2024 17:56:14 +0100 Subject: [PATCH 1/2] fix --- .../examples/loaders/gsplat-many.shader.vert | 45 ++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/examples/src/examples/loaders/gsplat-many.shader.vert b/examples/src/examples/loaders/gsplat-many.shader.vert index 655d987e123..90143d3ea4c 100644 --- a/examples/src/examples/loaders/gsplat-many.shader.vert +++ b/examples/src/examples/loaders/gsplat-many.shader.vert @@ -1,19 +1,44 @@ uniform float uTime; varying float height; +vec4 discardVec = vec4(0.0, 0.0, 2.0, 1.0); + +void animate() { + // modify center + float heightIntensity = center.y * 0.2; + center.x += sin(uTime * 5.0 + center.y) * 0.3 * heightIntensity; + + // output y-coordinate + height = center.y; +} + void main(void) { - // evaluate center of the splat in object space - vec3 centerLocal = evalCenter(); + // calculate splat uv + if (!calcSplatUV()) { + gl_Position = discardVec; + return; + } - // modify it - float heightIntensity = centerLocal.y * 0.2; - centerLocal.x += sin(uTime * 5.0 + centerLocal.y) * 0.3 * heightIntensity; + // read data + readData(); - // output y-coordinate - height = centerLocal.y; + // animate + animate(); + + vec4 pos; + if (!evalSplat(pos)) { + gl_Position = discardVec; + return; + } + + gl_Position = pos; + + texCoord = vertex_position.xy; + color = getColor(); + + #ifndef DITHER_NONE + id = float(splatId); + #endif - // evaluate the rest of the splat using world space center - vec4 centerWorld = matrix_model * vec4(centerLocal, 1.0); - gl_Position = evalSplat(centerWorld); } From 3d212062425c39b996910e5472361cf94167a629 Mon Sep 17 00:00:00 2001 From: Donovan Hutchence Date: Wed, 26 Jun 2024 18:03:07 +0100 Subject: [PATCH 2/2] small --- examples/src/examples/loaders/gsplat-many.shader.vert | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/src/examples/loaders/gsplat-many.shader.vert b/examples/src/examples/loaders/gsplat-many.shader.vert index 90143d3ea4c..7c9c9806dcc 100644 --- a/examples/src/examples/loaders/gsplat-many.shader.vert +++ b/examples/src/examples/loaders/gsplat-many.shader.vert @@ -1,8 +1,6 @@ uniform float uTime; varying float height; -vec4 discardVec = vec4(0.0, 0.0, 2.0, 1.0); - void animate() { // modify center float heightIntensity = center.y * 0.2; @@ -12,6 +10,8 @@ void animate() { height = center.y; } +vec4 discardVec = vec4(0.0, 0.0, 2.0, 1.0); + void main(void) { // calculate splat uv