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.
27 lines (23 loc) • 738 B
JavaScript
//#region src/core/shaders/chunks/fragment/head/get-PBR-direct-sheen.ts
/**
* WGSL functions to calculate sheen BRDF specular direct contribution.
*/
const getPBRDirectSheen = `
fn BRDF_Sheen(
lightDirection: vec3f,
viewDirection: vec3f,
normal: vec3f,
sheenColor: vec3f,
sheenRoughness: f32
) -> vec3f {
let halfDir: vec3f = normalize( lightDirection + viewDirection );
let dotNL: f32 = saturate( dot( normal, lightDirection ) );
let dotNV: f32 = saturate( dot( normal, viewDirection ) );
let dotNH: f32 = saturate( dot( normal, halfDir ) );
let D: f32 = D_Charlie( sheenRoughness, dotNH );
let V: f32 = V_Neubelt( dotNV, dotNL );
return sheenColor * ( D * V );
}
`;
//#endregion
export { getPBRDirectSheen };