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.
23 lines (19 loc) • 723 B
JavaScript
//#region src/core/shaders/chunks/fragment/head/RE-indirect-diffuse.ts
/**
* WGSL functions to calculate the indirect diffuse contribution of lights.
*/
const REIndirectDiffuse = `
fn getAmbientLightIrradiance() -> vec3f {
var totalAmbientIrradiance: vec3f = vec3(0.0);
for(var i: i32 = 0; i < ambientLights.count; i++) {
totalAmbientIrradiance += ambientLights.color[i];
}
return totalAmbientIrradiance;
}
// Indirect Diffuse RenderEquations
fn RE_IndirectDiffuse(irradiance: vec3f, diffuseContribution: vec3f, ptr_reflectedLight: ptr<function, ReflectedLight>) {
(*ptr_reflectedLight).indirectDiffuse += irradiance * BRDF_Lambert( diffuseContribution );
}
`;
//#endregion
export { REIndirectDiffuse };