diff --git a/src/scene/shader-lib/programs/lit-shader.js b/src/scene/shader-lib/programs/lit-shader.js index 75984428c0c..9d688bfcb78 100644 --- a/src/scene/shader-lib/programs/lit-shader.js +++ b/src/scene/shader-lib/programs/lit-shader.js @@ -13,6 +13,7 @@ import { SPRITE_RENDERMODE_SLICED, SPRITE_RENDERMODE_TILED, shadowTypeInfo, SHADER_PREPASS, lightTypeNames, lightShapeNames, spriteRenderModeNames, fresnelNames, blendNames, lightFalloffNames, cubemaProjectionNames, specularOcclusionNames, reflectionSrcNames, ambientSrcNames, + ditherNames, REFLECTIONSRC_NONE } from '../../constants.js'; import { ChunkUtils } from '../chunk-utils.js'; @@ -513,6 +514,12 @@ class LitShader { this._setupLightingDefines(hasAreaLights, options.clusteredLightingEnabled); } + preparePrepassPass() { + const { options } = this; + this.fDefineSet(options.alphaTest, 'LIT_ALPHA_TEST'); + this.fDefineSet(true, 'STD_OPACITY_DITHER', ditherNames[options.opacityShadowDither]); + } + prepareShadowPass() { const { options } = this; @@ -548,8 +555,10 @@ class LitShader { this.includes.set('frontendDeclPS', frontendDecl ?? ''); this.includes.set('frontendCodePS', frontendCode ?? ''); - if (options.pass === SHADER_PICK || options.pass === SHADER_PREPASS) { + if (options.pass === SHADER_PICK) { // nothing to prepare currently + } else if (options.pass === SHADER_PREPASS) { + this.preparePrepassPass(); } else if (this.shadowPass) { this.prepareShadowPass(); } else {