@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
50 lines • 2.11 kB
JavaScript
// Do not edit.
import { ShaderStore } from "../Engines/shaderStore.js";
import { packingFunctions } from "./ShadersInclude/packingFunctions.js";
import { bayerDitherFunctions } from "./ShadersInclude/bayerDitherFunctions.js";
import { shadowMapFragmentExtraDeclaration } from "./ShadersInclude/shadowMapFragmentExtraDeclaration.js";
import { clipPlaneFragmentDeclaration } from "./ShadersInclude/clipPlaneFragmentDeclaration.js";
import { clipPlaneFragment } from "./ShadersInclude/clipPlaneFragment.js";
import { shadowMapFragment } from "./ShadersInclude/shadowMapFragment.js";
const name = "shadowMapPixelShader";
const shader = `
varying vec2 vUV;uniform sampler2D diffuseSampler;
void main(void)
{
vec4 opacityMap=texture2D(diffuseSampler,vUV);float alphaFromAlphaTexture=opacityMap.a;
if (softTransparentShadowSM.y==1.0) {opacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);alphaFromAlphaTexture=opacityMap.x+opacityMap.y+opacityMap.z;}
if (alphaFromAlphaTexture<ALPHATESTVALUE)
discard;
if ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM.x*alphaFromAlphaTexture) discard;
if ((bayerDither8(floor(mod(gl_FragCoord.xy,8.0))))/64.0>=softTransparentShadowSM.x) discard;
}`;
// Sideeffect
if (!ShaderStore.ShadersStore[name]) {
ShaderStore.ShadersStore[name] = shader;
}
const includes = [packingFunctions, bayerDitherFunctions, shadowMapFragmentExtraDeclaration, clipPlaneFragmentDeclaration, clipPlaneFragment, shadowMapFragment];
for (const inc of includes) {
if (!ShaderStore.IncludesShadersStore[inc.name]) {
ShaderStore.IncludesShadersStore[inc.name] = inc.shader;
}
}
/** @internal */
export const shadowMapPixelShader = { name, shader };
//# sourceMappingURL=shadowMap.fragment.js.map