dymokomi/luce-3d
Source of release 0.9.6
0.9.6 / shaders / splat_params.glsl
// The per-view uniforms the splat kernels share (128 bytes of push constants):
// the camera in the cloud's pack frame (positions relative to its origin), the
// target's size and focal lengths in pixels, where the cloud's splats sit in
// the view's combined index space, its layout and the look.
layout(push_constant) uniform Params {
vec4 eye_near; // eye x, y, z; near plane distance
vec4 right_far; // camera right; far plane distance
vec4 up_fx; // camera up; focal length in pixels along x (orthographic: pixels per unit)
vec4 forward_fy; // view direction; focal length in pixels along y (orthographic: pixels per unit)
vec4 view; // target width and height in pixels; first index (bits); LOD footprint in pixels (0: off)
uvec4 counts; // splats (the gather kernels: the whole index space); SH items stored per splat; SH items evaluated; flags
vec4 look; // alpha cull; splat scale; largest quad half axis in pixels; dot radius in pixels
vec4 rotation; // the placement's rotation (x, y, z, w), turning SH-frame directions to world
} p;
// counts.w flags.
const uint flag_srgb = 1u; // colors and SH are sRGB-encoded: decode after adding the bands
const uint flag_frames = 2u; // per-splat SH frames (restorient) are stored
const uint flag_centers = 4u; // draw dots at the centers
const uint flag_splats = 8u; // the cloud has orient, scale and opacity
const uint flag_marks = 16u; // selection marks are stored: marked splats are tinted
const uint flag_antialiased = 64u; // trained with Mip-Splatting's 2D filter: compensate opacity for the low-pass
const uint flag_lod = 32u; // merged levels (runs of 4, 16, 64, 256 splats) follow the splats
const uint flag_faded = 128u; // drawn as context: colors greyed, opacity lowered
const uint flag_orthographic = 256u; // an orthographic view: fx and fy are pixels per unit, rays run along forward
// Workgroups of 256 splats in a 2D grid: the splat this invocation handles.
uint splat_index() {
uint group = gl_WorkGroupID.y * gl_NumWorkGroups.x + gl_WorkGroupID.x;
return group * 256u + gl_LocalInvocationID.x;
}
uint group_index() {
return gl_WorkGroupID.y * gl_NumWorkGroups.x + gl_WorkGroupID.x;
}