Update leenkx/Shaders/std/constants.glsl
This commit is contained in:
		@ -24,37 +24,44 @@ const int DIFFUSE_CONE_COUNT = 16;
 | 
			
		||||
 | 
			
		||||
const float SHADOW_CONE_APERTURE = radians(15.0);
 | 
			
		||||
 | 
			
		||||
const float DIFFUSE_CONE_APERTURE = radians(50.0);
 | 
			
		||||
const float DIFFUSE_CONE_APERTURE = 0.872665; // 50 degrees in radians
 | 
			
		||||
 | 
			
		||||
const vec3 DIFFUSE_CONE_DIRECTIONS[DIFFUSE_CONE_COUNT] = vec3[](
 | 
			
		||||
    vec3(0.0, 0.0, 1.0), // center
 | 
			
		||||
mat3 makeTangentBasis(const vec3 normal) {
 | 
			
		||||
    // Create a tangent basis from normal vector
 | 
			
		||||
    vec3 tangent;
 | 
			
		||||
    vec3 bitangent;
 | 
			
		||||
 | 
			
		||||
    vec3(0.0, 0.5, 0.866),
 | 
			
		||||
    vec3(0.5, 0.0, 0.866),
 | 
			
		||||
    vec3(0.0, -0.5, 0.866),
 | 
			
		||||
    vec3(-0.5, 0.0, 0.866),
 | 
			
		||||
    // 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);
 | 
			
		||||
 | 
			
		||||
    vec3(0.353, 0.353, 0.866),
 | 
			
		||||
    vec3(0.353, -0.353, 0.866),
 | 
			
		||||
    vec3(-0.353, -0.353, 0.866),
 | 
			
		||||
    vec3(-0.353, 0.353, 0.866),
 | 
			
		||||
 | 
			
		||||
    vec3(0.707, 0.0, 0.707),
 | 
			
		||||
    vec3(0.0, 0.707, 0.707),
 | 
			
		||||
    vec3(-0.707, 0.0, 0.707),
 | 
			
		||||
    vec3(0.0, -0.707, 0.707),
 | 
			
		||||
 | 
			
		||||
    vec3(0.5, 0.5, 0.707),
 | 
			
		||||
    vec3(-0.5, 0.5, 0.707),
 | 
			
		||||
    vec3(-0.5, -0.5, 0.707)
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
mat3 makeTangentBasis(vec3 normal) {
 | 
			
		||||
    vec3 tangent = normalize(abs(normal.y) < 0.999 ? cross(normal, vec3(0, 1, 0)) : cross(normal, vec3(1, 0, 0)));
 | 
			
		||||
    vec3 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
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
// TO DO - Disabled momentarily instead of changing formulas
 | 
			
		||||
const float off_BayerMatrix8[8][8] =
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user