Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gsplat examples fix #6754

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 35 additions & 10 deletions examples/src/examples/loaders/gsplat-many.shader.vert
Original file line number Diff line number Diff line change
@@ -1,19 +1,44 @@
uniform float uTime;
varying float height;

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;
}

vec4 discardVec = vec4(0.0, 0.0, 2.0, 1.0);

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);
}