UNPKG

gpu-curtains

Version:

gpu-curtains is a 3D WebGPU rendering engine. It can be used as a standalone 3D engine, but also includes extra classes focused on mapping 3d objects to DOM elements; It allows users to synchronize values such as position, sizing, or scale between them.

35 lines (33 loc) 1.1 kB
//#region src/core/shaders/chunks/fragment/head/get-IBL-indirect-anisotropy-radiance.ts /** * Helper function chunk appended internally and used to compute IBL indirect anisotropy radiance, based on environment specular map. */ const getIBLIndirectAnisotropyRadiance = ` fn getIBLIndirectAnisotropyRadiance( normal: vec3f, viewDirection: vec3f, roughness: f32, clampSampler: sampler, envSpecularTexture: texture_cube<f32>, envRotation: mat3x3f, envSpecularIntensity: f32, bitangent: vec3f, anisotropy: f32 ) -> vec3f { // https://google.github.io/filament/Filament.md.html#lighting/imagebasedlights/anisotropy var bentNormal: vec3f = cross( bitangent, viewDirection ); bentNormal = normalize( cross( bentNormal, bitangent ) ); bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); return getIBLIndirectRadiance( bentNormal, viewDirection, roughness, clampSampler, envSpecularTexture, envRotation, envSpecularIntensity, ); } `; //#endregion export { getIBLIndirectAnisotropyRadiance };