BRDF_GGX: "\nfn Schlick_to_F0( f: vec3f, f90: f32, dotVH: f32 ) -> vec3f {\n let x: f32 = clamp( 1.0 - dotVH, 0.0, 1.0 );\n let x2: f32 = x * x;\n let x5: f32 = clamp( x * x2 * x2, 0.0, 0.9999 );\n\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\n\nfn DistributionGGX(NdotH: f32, roughness: f32) -> f32 {\n let a: f32 = pow2( roughness );\n let a2: f32 = pow2( a );\n\n let denom: f32 = (pow2( NdotH ) * (a2 - 1.0) + 1.0);\n\n return RECIPROCAL_PI * a2 / ( pow2( denom ) );\n}\n\n// Geometric Shadowing function\nfn GeometrySmith(NdotL: f32, NdotV: f32, roughness: f32) -> f32 {\n let a: f32 = pow2( roughness );\n let a2: f32 = pow2( a );\n \n let gv: f32 = NdotL * sqrt( a2 + ( 1.0 - a2 ) * pow2( NdotV ) );\n let gl: f32 = NdotV * sqrt( a2 + ( 1.0 - a2 ) * pow2( NdotL ) );\n\n return 0.5 / max( gv + gl, EPSILON );\n}\n" = ...
WGSL BRDF GGX functions. Need the
constantsandcommonchunks.