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.
25 lines (22 loc) • 490 B
JavaScript
const getIBLIndirectIrradiance = (
/* wgsl */
`
fn getIBLIndirectIrradiance(
normal: vec3f,
diffuseColor: vec3f,
clampSampler: sampler,
envDiffuseTexture: texture_cube<f32>,
envRotation: mat3x3f,
envDiffuseIntensity: f32,
) -> vec3f {
// IBL diffuse (irradiance)
let diffuseLight: vec4f = textureSample(
envDiffuseTexture,
clampSampler,
normal * envRotation
);
return diffuseLight.rgb * envDiffuseIntensity;
}
`
);
export { getIBLIndirectIrradiance };