Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/scene/shader-lib/programs/lit-shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -513,6 +514,13 @@ class LitShader {
this._setupLightingDefines(hasAreaLights, options.clusteredLightingEnabled);
}

preparePrepassPass() {
const { options } = this;
this.fDefineSet(options.alphaTest, 'LIT_ALPHA_TEST');
this.fDefineSet(true, 'LIT_BLEND_TYPE', blendNames[options.blendType]);
Comment thread
slimbuck marked this conversation as resolved.
Outdated
this.fDefineSet(true, 'STD_OPACITY_DITHER', ditherNames[options.opacityShadowDither]);
}

prepareShadowPass() {

const { options } = this;
Expand Down Expand Up @@ -548,8 +556,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 {
Expand Down