Skip to content

Commit

Permalink
WebGPURenderer: Fix blending opacity in shadows (#30081)
Browse files Browse the repository at this point in the history
* fix blending opacity in shadows

* cleanup

* Update webgpu_shadowmap_opacity.jpg

* Update webgpu_shadowmap_opacity.jpg
  • Loading branch information
sunag authored Dec 10, 2024
1 parent 047f7d7 commit dc34412
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
Binary file modified examples/screenshots/webgpu_shadowmap_opacity.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions src/nodes/lighting/ShadowNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import NodeMaterial from '../../materials/nodes/NodeMaterial.js';
import QuadMesh from '../../renderers/common/QuadMesh.js';
import { Loop } from '../utils/LoopNode.js';
import { screenCoordinate } from '../display/ScreenNode.js';
import { HalfFloatType, LessCompare, NoBlending, RGFormat, VSMShadowMap, WebGPUCoordinateSystem } from '../../constants.js';
import { HalfFloatType, LessCompare, RGFormat, VSMShadowMap, WebGPUCoordinateSystem } from '../../constants.js';
import { renderGroup } from '../core/UniformGroupNode.js';
import { viewZToLogarithmicDepth } from '../display/ViewportDepthNode.js';
import { objectPosition } from '../accessors/Object3DNode.js';
Expand Down Expand Up @@ -53,7 +53,6 @@ const getShadowMaterial = ( light ) => {
material.colorNode = vec4( 0, 0, 0, 1 );
material.depthNode = depthNode;
material.isShadowNodeMaterial = true; // Use to avoid other overrideMaterial override material.colorNode unintentionally when using material.shadowNode
material.blending = NoBlending;
material.name = 'ShadowMaterial';

shadowMaterialLib.set( light, material );
Expand Down
1 change: 1 addition & 0 deletions src/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,7 @@ class Renderer {

overrideMaterial.alphaTest = material.alphaTest;
overrideMaterial.alphaMap = material.alphaMap;
overrideMaterial.transparent = material.transparent || material.transmission > 0;

if ( overrideMaterial.isShadowNodeMaterial ) {

Expand Down

0 comments on commit dc34412

Please sign in to comment.