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.

31 lines (28 loc) 1.51 kB
import { S as ShaderStore } from './index-MZPybX0H.esm.js'; import { h as helperFunctions } from './helperFunctions-BVaVsPjM.esm.js'; import { i as importanceSampling, h as hdrFilteringFunctions } from './hdrFilteringFunctions-FqTqoCZG.esm.js'; import { p as pbrBRDFFunctions } from './pbrBRDFFunctions-QbgJVHGQ.esm.js'; // Do not edit. const name = "iblDominantDirectionPixelShader"; const shader = `precision highp sampler2D;precision highp samplerCube; #include<helperFunctions> #include<importanceSampling> #include<pbrBRDFFunctions> #include<hdrFilteringFunctions> varying vec2 vUV;uniform sampler2D icdfSampler;void main(void) {vec3 lightDir=vec3(0.0,0.0,0.0);for(uint i=0u; i<NUM_SAMPLES; ++i) {vec2 Xi=hammersley(i,NUM_SAMPLES);vec2 T;T.x=texture2D(icdfSampler,vec2(Xi.x,0.0)).x;T.y=texture2D(icdfSampler,vec2(T.x,Xi.y)).y;vec3 Ls=uv_to_normal(vec2(1.0-fract(T.x+0.25),T.y));lightDir+=Ls;} lightDir/=float(NUM_SAMPLES);gl_FragColor=vec4(lightDir,1.0);}`; // Sideeffect if (!ShaderStore.ShadersStore[name]) { ShaderStore.ShadersStore[name] = shader; } const includes = [helperFunctions, importanceSampling, pbrBRDFFunctions, hdrFilteringFunctions]; for (const inc of includes) { if (!ShaderStore.IncludesShadersStore[inc.name]) { ShaderStore.IncludesShadersStore[inc.name] = inc.shader; } } /** @internal */ const iblDominantDirectionPixelShader = { name, shader }; export { iblDominantDirectionPixelShader }; //# sourceMappingURL=iblDominantDirection.fragment-CyAmmjk6.esm.js.map