Skip to content

Commit dc2881d

Browse files
committed
docs(soba): add NgtsSoftShadows to misc README
1 parent 93b42ca commit dc2881d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

libs/soba/misc/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This secondary entry point includes miscellaneous utilities and components for a
88
- [fbo](#fbo)
99
- [NgtsFBO](#ngtsfbo)
1010
- [NgtsBakeShadows](#ngtsbakeshadows)
11+
- [NgtsSoftShadows](#ngtssoftshadows)
1112
- [depthBuffer](#depthbuffer)
1213
- [NgtsSampler](#ngtssampler)
1314
- [surfaceSampler](#surfacesampler)
@@ -133,6 +134,24 @@ A directive that bakes shadows in your scene. It sets `gl.shadowMap.autoUpdate`
133134
<ngts-bake-shadows />
134135
```
135136

137+
## NgtsSoftShadows
138+
139+
A directive that injects Percentage-Closer Soft Shadows (PCSS) into the scene. PCSS produces contact-hardening soft shadows where shadows are sharper near the contact point and softer further away, creating more realistic shadow effects.
140+
141+
This works by patching Three.js's shadow shader chunk at runtime. When the directive is destroyed or options change, it restores the original shader and recompiles affected materials.
142+
143+
```html
144+
<ngts-soft-shadows [options]="{ size: 25, samples: 10, focus: 0 }" />
145+
```
146+
147+
### Options (NgtsSoftShadowsOptions)
148+
149+
| Property | Description | Default |
150+
| --------- | -------------------------------------------------------------------------------------------- | ------- |
151+
| `size` | Size of the light source. The larger the value, the softer the shadows. | `25` |
152+
| `samples` | Number of samples for shadow calculation. More samples = less noise but more expensive. | `10` |
153+
| `focus` | Depth focus to shift the focal point where the shadow is sharpest. 0 means at the beginning. | `0` |
154+
136155
## `depthBuffer`
137156

138157
```ts

0 commit comments

Comments
 (0)