Skip to content

Commit e3ee968

Browse files
authored
WebGLShadowMap: Support alphaToCoverage with shadows. (#30871)
1 parent 7c9d92b commit e3ee968

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: src/renderers/webgl/WebGLShadowMap.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
257257
if ( ( renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||
258258
( material.displacementMap && material.displacementScale !== 0 ) ||
259259
( material.alphaMap && material.alphaTest > 0 ) ||
260-
( material.map && material.alphaTest > 0 ) ) {
260+
( material.map && material.alphaTest > 0 ) ||
261+
( material.alphaToCoverage === true ) ) {
261262

262263
// in this case we need a unique material instance reflecting the
263264
// appropriate state
@@ -303,7 +304,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) {
303304
}
304305

305306
result.alphaMap = material.alphaMap;
306-
result.alphaTest = material.alphaTest;
307+
result.alphaTest = ( material.alphaToCoverage === true ) ? 0.5 : material.alphaTest; // approximate alphaToCoverage by using a fixed alphaTest value
307308
result.map = material.map;
308309

309310
result.clipShadows = material.clipShadows;

0 commit comments

Comments
 (0)