UNPKG

@babylonjs/viewer

Version:

The Babylon Viewer aims to simplify a specific but common Babylon.js use case: loading, viewing, and interacting with a 3D model.

3 lines (2 loc) 1.29 kB
import{M as t}from"./index-DFZFpUG-.esm.min.js";const e=`\nstruct LightEntry {\nvLightData: vec4<f32>,\nvLightDiffuse: vec4<f32>,\nvLightSpecular: vec4<f32>,\nvLightDirection: vec4<f32>,\n};\nstruct lightsUniforms {\ncount: u32, _p0: u32, _p1: u32, _p2: u32,\n lights: array<LightEntry, ${t}>,\n};\n`;function n(){return"let entry = lights.lights[mli(0u)];\nlet L = normalize(entry.vLightData.xyz);\nlet NdotL = dot(N, L) * 0.5 + 0.5;\nlet lightAtten = 1.0;\nlet lightColor = entry.vLightDiffuse.rgb;\nlet hemiDiffuse = mix(entry.vLightDirection.xyz, lightColor, NdotL);\nvar directDiffuse = hemiDiffuse * surfaceAlbedo * material.directIntensity;\nlet H = normalize(V + L);\nlet NdotH = clamp(dot(N, H), 0.0000001, 1.0);\nlet VdotH = saturate(dot(V, H));\nlet directRoughness = max(roughness, AA_factor_x);\nlet directAlphaG = directRoughness * directRoughness + 0.0005;\nlet D = distributionGGX(NdotH, directAlphaG);\nlet G = geometrySmithGGX(NdotL, NdotV, directAlphaG);\nlet coloredFresnel = fresnelSchlick(VdotH, colorF0, colorF90);\nvar directSpecular = coloredFresnel * D * G * NdotL * lightColor * lightAtten * material.directIntensity;\n/*AD*/"}export{e as SINGLE_LIGHT_STRUCTS,n as getSingleLightBlock}; //# sourceMappingURL=singlelight-hemispheric-wgsl-Blwvz5AY.esm.min.js.map