11import {
2- BLEND_MULTIPLICATIVE ,
2+ BLEND_PREMULTIPLIED ,
33 SHADOW_VSM_16F ,
44 SHADOWUPDATE_REALTIME as SHADOWUPDATE ,
55 AppBase ,
@@ -12,6 +12,14 @@ import {
1212 StandardMaterial
1313} from 'playcanvas' ;
1414
15+ const litUserMainEndGLSL = `
16+ gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0 - gl_FragColor.r);
17+ ` ;
18+
19+ const litUserMainEndWGSL = `
20+ output.color = vec4f(0.0, 0.0, 0.0, 1.0 - output.color.r);
21+ ` ;
22+
1523class ShadowCatcher {
1624 layer : Layer ;
1725
@@ -38,12 +46,16 @@ class ShadowCatcher {
3846
3947 // create shadow catcher material
4048 this . material = new StandardMaterial ( ) ;
49+ this . material . blendType = BLEND_PREMULTIPLIED ;
4150 this . material . shadowCatcher = true ;
4251 this . material . useSkybox = false ;
43- this . material . blendType = BLEND_MULTIPLICATIVE ;
4452 this . material . depthWrite = false ;
4553 this . material . diffuse . set ( 0 , 0 , 0 ) ;
4654 this . material . specular . set ( 0 , 0 , 0 ) ;
55+
56+ this . material . shaderChunks . glsl . set ( 'litUserMainEndPS' , litUserMainEndGLSL ) ;
57+ this . material . shaderChunks . wgsl . set ( 'litUserMainEndPS' , litUserMainEndWGSL ) ;
58+
4759 this . material . update ( ) ;
4860
4961 // create shadow catcher geometry
0 commit comments