threepipe
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gsplat.main.vert.glsl 683B

123456789101112131415
  1. vec3 cov2d = compute_cov2d(center, scale, quat);
  2. float det = cov2d.x * cov2d.z - cov2d.y * cov2d.y;
  3. vec3 conic = vec3(cov2d.z, cov2d.y, cov2d.x) / det;
  4. float mid = 0.5 * (cov2d.x + cov2d.z);
  5. float lambda1 = mid + sqrt(max(0.1, mid * mid - det));
  6. float lambda2 = mid - sqrt(max(0.1, mid * mid - det));
  7. vec2 v1 = 7.0 * sqrt(lambda1) * normalize(vec2(cov2d.y, lambda1 - cov2d.x));
  8. vec2 v2 = 7.0 * sqrt(lambda2) * normalize(vec2(-(lambda1 - cov2d.x),cov2d.y));
  9. vColor = color;
  10. vConic = conic;
  11. vCenter = vec2(gl_Position) / gl_Position.w;
  12. vPosition = vec2(vCenter + position.x * (position.y < 0.0 ? v1 : v2) / viewport);
  13. gl_Position = vec4(vPosition, gl_Position.z / gl_Position.w, 1);