@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.
39 lines (36 loc) • 1.38 kB
JavaScript
import { S as ShaderStore } from './index-FzOfPXLV.esm.js';
import './helperFunctions-CLFdU2UC.esm.js';
// Do not edit.
const name = "iblCdfyPixelShader";
const shader = `precision highp sampler2D;precision highp samplerCube;
varying vec2 vUV;
uniform samplerCube iblSource;
uniform sampler2D iblSource;
uniform int iblHeight;
float fetchCube(vec2 uv) {vec3 direction=equirectangularToCubemapDirection(uv);return sin(PI*uv.y)*dot(textureCubeLodEXT(iblSource,direction,0.0).rgb,LuminanceEncodeApprox);}
float fetchPanoramic(ivec2 Coords,float envmapHeight) {return sin(PI*(float(Coords.y)+0.5)/envmapHeight) *
dot(texelFetch(iblSource,Coords,0).rgb,LuminanceEncodeApprox);}
void main(void) {ivec2 coords=ivec2(gl_FragCoord.x,gl_FragCoord.y);float cdfy=0.0;for (int y=1; y<=coords.y; y++) {
vec2 uv=vec2(vUV.x,(float(y-1)+0.5)/float(iblHeight));cdfy+=fetchCube(uv);
cdfy+=fetchPanoramic(ivec2(coords.x,y-1),float(iblHeight));
}
gl_FragColor=vec4(cdfy,0.0,0.0,1.0);}`;
// Sideeffect
if (!ShaderStore.ShadersStore[name]) {
ShaderStore.ShadersStore[name] = shader;
}
/** @internal */
const iblCdfyPixelShader = { name, shader };
export { iblCdfyPixelShader };
//# sourceMappingURL=iblCdfy.fragment-B-BIVri7.esm.js.map