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.

41 lines (38 loc) 1.47 kB
//#region src/core/shaders/chunks/fragment/body/get-IBL-indirect-radiance.ts /** * Get the environment map indirect radiance (specular). * @param parameters - Parameters to use to apply PBR shading. * @param parameters.extensionsUsed - {@link PBRFragmentShaderInputParams.extensionsUsed | extensionsUsed} to check if anisotropy is enabled. * @param parameters.environmentMap - {@link extras/environmentMap/EnvironmentMap.EnvironmentMap | EnvironmentMap} to use for indirect radiance if any. * @returns - String with environment map indirect radiance applied to `radiance` (`vec3f`). */ const getIBLIndirectRadiance = ({ extensionsUsed = [], environmentMap = null }) => { let iblIndirectSpecular = ""; if (environmentMap) if (extensionsUsed.includes("KHR_materials_anisotropy")) iblIndirectSpecular += ` iblRadiance += getIBLIndirectAnisotropyRadiance( normal, viewDirection, roughness, ${environmentMap.sampler.name}, ${environmentMap.specularTexture.options.name}, envRotation, envSpecularIntensity, anisotropyB, anisotropy ); radiance += iblRadiance;`; else iblIndirectSpecular += ` iblRadiance += getIBLIndirectRadiance( normal, viewDirection, roughness, ${environmentMap.sampler.name}, ${environmentMap.specularTexture.options.name}, envRotation, envSpecularIntensity, ); radiance += iblRadiance;`; return iblIndirectSpecular; }; //#endregion export { getIBLIndirectRadiance };