PCFShadowMap vs PCFSoftShadowMap in Three.js

This article compares PCFShadowMap and PCFSoftShadowMap in Three.js, highlighting their visual characteristics and performance impacts. You will learn how these two shadow map types differ in rendering shadow edges, how they affect frame rates, and how to choose the right one for your 3D web applications.

Visual Differences

The primary visual difference between the two shadow maps lies in how they handle the edges of shadows.

Performance Differences

The visual improvement of soft shadows comes at a cost to hardware resources.

Implementation and Best Practices

To configure the shadow map type in Three.js, you must set the type property on the renderer’s shadow map object:

// For sharper, high-performance shadows
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFShadowMap;

// For softer, realistic shadows (higher performance cost)
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;

When deciding which shadow map to use, consider your target audience and platform: