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.

18 lines (16 loc) 594 B
//#region src/core/shaders/chunks/fragment/head/get-lambert-direct.ts /** Helper function chunk appended internally and used to compute Lambert direct light contributions. */ const getLambertDirect = ` fn getLambertDirect( normal: vec3f, diffuseColor: vec3f, directLight: DirectLight, ptr_reflectedLight: ptr<function, ReflectedLight> ) { let NdotL = saturate(dot(normal, directLight.direction)); let irradiance: vec3f = NdotL * directLight.color; (*ptr_reflectedLight).directDiffuse += irradiance * BRDF_Lambert( diffuseColor ); } `; //#endregion export { getLambertDirect };