VOX_PATCH_2 + VOX_5

This commit is contained in:
2026-07-16 23:49:44 -07:00
parent f4b0bf1e93
commit b2395f30fc
34 changed files with 353 additions and 560 deletions

View File

@ -24,42 +24,25 @@ const int DIFFUSE_CONE_COUNT = 16;
const float SHADOW_CONE_APERTURE = radians(15.0);
const float DIFFUSE_CONE_APERTURE = 0.872665;
const float DIFFUSE_CONE_APERTURE = 1.0;
mat3 makeTangentBasis(const vec3 normal) {
// Create a tangent basis from normal vector
vec3 tangent;
vec3 bitangent;
// Compute tangent (Frisvad's method)
if (abs(normal.z) < 0.999) {
tangent = normalize(cross(vec3(0, 1, 0), normal));
} else {
tangent = normalize(cross(normal, vec3(1, 0, 0)));
}
bitangent = cross(normal, tangent);
return mat3(tangent, bitangent, normal);
}
// 16 optimized cone directions for hemisphere sampling (Z-up, normalized)
const vec3 DIFFUSE_CONE_DIRECTIONS[16] = vec3[](
vec3(0.707107, 0.000000, 0.707107), // Front
vec3(-0.707107, 0.000000, 0.707107), // Back
vec3(0.000000, 0.707107, 0.707107), // Right
vec3(0.000000, -0.707107, 0.707107), // Left
vec3(0.500000, 0.500000, 0.707107), // Front-right
vec3(-0.500000, 0.500000, 0.707107), // Back-right
vec3(0.500000, -0.500000, 0.707107), // Front-left
vec3(-0.500000, -0.500000, 0.707107),// Back-left
vec3(0.353553, 0.000000, 0.935414), // Narrow front
vec3(-0.353553, 0.000000, 0.935414), // Narrow back
vec3(0.000000, 0.353553, 0.935414), // Narrow right
vec3(0.000000, -0.353553, 0.935414), // Narrow left
vec3(0.270598, 0.270598, 0.923880), // Narrow front-right
vec3(-0.270598, 0.270598, 0.923880), // Narrow back-right
vec3(0.270598, -0.270598, 0.923880), // Narrow front-left
vec3(-0.270598, -0.270598, 0.923880) // Narrow back-left
vec3( 0.3480, 0.0000, 0.9375),
vec3(-0.4299, 0.3938, 0.8125),
vec3( 0.0635, -0.7234, 0.6875),
vec3( 0.5031, 0.6561, 0.5625),
vec3(-0.8855, -0.1566, 0.4375),
vec3( 0.8015, -0.5098, 0.3125),
vec3(-0.2550, 0.9486, 0.1875),
vec3(-0.4600, -0.8857, 0.0625),
vec3( 0.9375, 0.3424, -0.0625),
vec3(-0.9080, 0.3748, -0.1875),
vec3( 0.4026, -0.8604, -0.3125),
vec3( 0.2691, 0.8580, -0.4375),
vec3(-0.7154, -0.4146, -0.5625),
vec3( 0.7092, -0.1559, -0.6875),
vec3(-0.3353, 0.4769, -0.8125),
vec3(-0.0447, -0.3451, -0.9375)
);
// TO DO - Disabled momentarily instead of changing formulas