angular-three-postprocessing 4.0.0-next.99 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -21
- package/fesm2022/angular-three-postprocessing-n8ao.mjs +42 -7
- package/fesm2022/angular-three-postprocessing-n8ao.mjs.map +1 -1
- package/fesm2022/angular-three-postprocessing.mjs +1185 -241
- package/fesm2022/angular-three-postprocessing.mjs.map +1 -1
- package/n8ao/README.md +143 -0
- package/package.json +7 -7
- package/types/angular-three-postprocessing-n8ao.d.ts +167 -0
- package/types/angular-three-postprocessing.d.ts +1887 -0
- package/index.d.ts +0 -3
- package/lib/effect-composer.d.ts +0 -38
- package/lib/effect.d.ts +0 -52
- package/lib/effects/ascii.d.ts +0 -24
- package/lib/effects/bloom.d.ts +0 -11
- package/lib/effects/brightness-contrast.d.ts +0 -16
- package/lib/effects/chromatic-abberation.d.ts +0 -17
- package/lib/effects/color-average.d.ts +0 -12
- package/lib/effects/color-depth.d.ts +0 -15
- package/lib/effects/depth-of-field.d.ts +0 -20
- package/lib/effects/depth.d.ts +0 -15
- package/lib/effects/dot-screen.d.ts +0 -16
- package/lib/effects/fxaa.d.ts +0 -14
- package/lib/effects/glitch.d.ts +0 -32
- package/lib/effects/god-rays.d.ts +0 -32
- package/lib/effects/grid.d.ts +0 -18
- package/lib/effects/hue-saturation.d.ts +0 -16
- package/lib/effects/index.d.ts +0 -29
- package/lib/effects/lens-flare.d.ts +0 -94
- package/lib/effects/lut.d.ts +0 -18
- package/lib/effects/noise.d.ts +0 -15
- package/lib/effects/outline.d.ts +0 -73
- package/lib/effects/pixelation.d.ts +0 -17
- package/lib/effects/scanline.d.ts +0 -18
- package/lib/effects/selective-bloom.d.ts +0 -42
- package/lib/effects/sepia.d.ts +0 -15
- package/lib/effects/shock-wave.d.ts +0 -12
- package/lib/effects/smaa.d.ts +0 -16
- package/lib/effects/tilt-shift-2.d.ts +0 -35
- package/lib/effects/tilt-shift.d.ts +0 -23
- package/lib/effects/tone-mapping.d.ts +0 -23
- package/lib/effects/vignette.d.ts +0 -18
- package/lib/effects/water.d.ts +0 -21
- package/n8ao/index.d.ts +0 -1
- package/n8ao/lib/n8ao.d.ts +0 -35
package/n8ao/README.md
CHANGED
|
@@ -1,3 +1,146 @@
|
|
|
1
1
|
# angular-three-postprocessing/n8ao
|
|
2
2
|
|
|
3
3
|
Secondary entry point of `angular-three-postprocessing`. It can be used by importing from `angular-three-postprocessing/n8ao`.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
This package requires `angular-three-postprocessing` and `n8ao` as peer dependencies.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install angular-three-postprocessing n8ao postprocessing
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## NgtpN8AO
|
|
14
|
+
|
|
15
|
+
A high-quality screen-space ambient occlusion (SSAO) effect component. N8AO adds realistic shadowing to crevices, corners, and areas where objects meet, greatly enhancing the visual depth of 3D scenes.
|
|
16
|
+
|
|
17
|
+
### Basic Usage
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<ngtp-effect-composer>
|
|
21
|
+
<ngtp-n8ao />
|
|
22
|
+
</ngtp-effect-composer>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### With Custom Options
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<ngtp-effect-composer>
|
|
29
|
+
<ngtp-n8ao
|
|
30
|
+
[options]="{
|
|
31
|
+
intensity: 3,
|
|
32
|
+
aoRadius: 2,
|
|
33
|
+
aoSamples: 32
|
|
34
|
+
}"
|
|
35
|
+
/>
|
|
36
|
+
</ngtp-effect-composer>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Using Quality Presets
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<ngtp-effect-composer>
|
|
43
|
+
<ngtp-n8ao [options]="{ quality: 'high' }" />
|
|
44
|
+
</ngtp-effect-composer>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Component Example
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
51
|
+
import { NgtCanvas, extend } from 'angular-three';
|
|
52
|
+
import { NgtpEffectComposer } from 'angular-three-postprocessing';
|
|
53
|
+
import { NgtpN8AO } from 'angular-three-postprocessing/n8ao';
|
|
54
|
+
import * as THREE from 'three';
|
|
55
|
+
|
|
56
|
+
extend(THREE);
|
|
57
|
+
|
|
58
|
+
@Component({
|
|
59
|
+
selector: 'app-scene',
|
|
60
|
+
standalone: true,
|
|
61
|
+
imports: [NgtpEffectComposer, NgtpN8AO],
|
|
62
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
63
|
+
template: `
|
|
64
|
+
<ngt-mesh>
|
|
65
|
+
<ngt-box-geometry />
|
|
66
|
+
<ngt-mesh-standard-material />
|
|
67
|
+
</ngt-mesh>
|
|
68
|
+
|
|
69
|
+
<ngtp-effect-composer>
|
|
70
|
+
<ngtp-n8ao [options]="aoOptions" />
|
|
71
|
+
</ngtp-effect-composer>
|
|
72
|
+
`,
|
|
73
|
+
})
|
|
74
|
+
export class SceneComponent {
|
|
75
|
+
aoOptions = {
|
|
76
|
+
intensity: 4,
|
|
77
|
+
aoRadius: 3,
|
|
78
|
+
quality: 'medium' as const,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Options
|
|
84
|
+
|
|
85
|
+
### Quality Presets
|
|
86
|
+
|
|
87
|
+
| Preset | Description |
|
|
88
|
+
| --------------- | -------------------------------- |
|
|
89
|
+
| `'performance'` | Fastest, lowest quality |
|
|
90
|
+
| `'low'` | Low quality, good performance |
|
|
91
|
+
| `'medium'` | Balanced quality and performance |
|
|
92
|
+
| `'high'` | High quality, slower |
|
|
93
|
+
| `'ultra'` | Highest quality, most demanding |
|
|
94
|
+
|
|
95
|
+
### All Options
|
|
96
|
+
|
|
97
|
+
| Option | Type | Default | Description |
|
|
98
|
+
| ------------------------ | --------------------------------------------------------- | --------- | ----------------------------------------------------------------------------- |
|
|
99
|
+
| `quality` | `'performance' \| 'low' \| 'medium' \| 'high' \| 'ultra'` | - | Quality preset (overrides individual settings) |
|
|
100
|
+
| `intensity` | `number` | `5` | Strength of the AO effect |
|
|
101
|
+
| `aoRadius` | `number` | `5.0` | Radius of the AO effect in world units |
|
|
102
|
+
| `aoSamples` | `number` | `16` | Number of samples for AO calculation (higher = better quality) |
|
|
103
|
+
| `aoTones` | `number` | `0.0` | Number of tones for AO gradient |
|
|
104
|
+
| `distanceFalloff` | `number` | `1.0` | How quickly the AO effect falls off with distance |
|
|
105
|
+
| `color` | `ColorRepresentation` | `'black'` | Color of the AO shadows |
|
|
106
|
+
| `denoiseSamples` | `number` | `8` | Number of samples for denoising |
|
|
107
|
+
| `denoiseRadius` | `number` | `12` | Radius of the denoising filter |
|
|
108
|
+
| `denoiseIterations` | `number` | `2.0` | Number of denoising iterations |
|
|
109
|
+
| `halfRes` | `boolean` | `false` | Render at half resolution for better performance |
|
|
110
|
+
| `depthAwareUpsampling` | `boolean` | `true` | Use depth-aware upsampling when using half resolution |
|
|
111
|
+
| `screenSpaceRadius` | `boolean` | `false` | Use screen-space radius instead of world-space |
|
|
112
|
+
| `renderMode` | `0 \| 1 \| 2 \| 3 \| 4` | `0` | Debug render mode (0: Combined, 1: AO only, 2: Normals, 3: Depth, 4: Denoise) |
|
|
113
|
+
| `biasOffset` | `number` | `0.0` | Bias offset for depth comparison |
|
|
114
|
+
| `biasMultiplier` | `number` | `0.0` | Bias multiplier for depth comparison |
|
|
115
|
+
| `gammaCorrection` | `boolean` | `true` | Apply gamma correction |
|
|
116
|
+
| `logarithmicDepthBuffer` | `boolean` | `false` | Use logarithmic depth buffer |
|
|
117
|
+
| `colorMultiply` | `boolean` | `true` | Multiply the color instead of darkening |
|
|
118
|
+
| `transparencyAware` | `boolean` | `false` | Handle transparent objects correctly |
|
|
119
|
+
| `accumulate` | `boolean` | `false` | Accumulate samples over frames for better quality |
|
|
120
|
+
|
|
121
|
+
## Tips
|
|
122
|
+
|
|
123
|
+
### Performance vs Quality
|
|
124
|
+
|
|
125
|
+
- Use `quality: 'performance'` or `halfRes: true` for better frame rates
|
|
126
|
+
- Increase `aoSamples` for higher quality at the cost of performance
|
|
127
|
+
- Use `accumulate: true` for static scenes to get better quality over time
|
|
128
|
+
|
|
129
|
+
### Common Configurations
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<!-- Performance-focused -->
|
|
133
|
+
<ngtp-n8ao [options]="{ quality: 'performance', halfRes: true }" />
|
|
134
|
+
|
|
135
|
+
<!-- Quality-focused -->
|
|
136
|
+
<ngtp-n8ao [options]="{ quality: 'ultra', aoSamples: 64, denoiseSamples: 16 }" />
|
|
137
|
+
|
|
138
|
+
<!-- Subtle effect -->
|
|
139
|
+
<ngtp-n8ao [options]="{ intensity: 2, aoRadius: 1 }" />
|
|
140
|
+
|
|
141
|
+
<!-- Strong, dramatic effect -->
|
|
142
|
+
<ngtp-n8ao [options]="{ intensity: 10, aoRadius: 8, color: '#000000' }" />
|
|
143
|
+
|
|
144
|
+
<!-- Debug AO only -->
|
|
145
|
+
<ngtp-n8ao [options]="{ renderMode: 1 }" />
|
|
146
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angular-three-postprocessing",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
],
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@angular/common": ">=
|
|
26
|
-
"@angular/core": ">=
|
|
25
|
+
"@angular/common": ">=20.0.0 <22.0.0",
|
|
26
|
+
"@angular/core": ">=20.0.0 <22.0.0",
|
|
27
27
|
"maath": ">=0.10.0 <0.11.0",
|
|
28
28
|
"n8ao": ">=1.9.4 <2.0.0",
|
|
29
29
|
"postprocessing": "^6.0.0",
|
|
30
|
-
"three": ">=0.
|
|
30
|
+
"three": ">=0.157.0 <0.183.0",
|
|
31
31
|
"three-stdlib": "^2.0.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependenciesMeta": {
|
|
@@ -44,17 +44,17 @@
|
|
|
44
44
|
"node_modules/angular-three/web-types.json"
|
|
45
45
|
],
|
|
46
46
|
"module": "fesm2022/angular-three-postprocessing.mjs",
|
|
47
|
-
"typings": "
|
|
47
|
+
"typings": "types/angular-three-postprocessing.d.ts",
|
|
48
48
|
"exports": {
|
|
49
49
|
"./package.json": {
|
|
50
50
|
"default": "./package.json"
|
|
51
51
|
},
|
|
52
52
|
".": {
|
|
53
|
-
"types": "./
|
|
53
|
+
"types": "./types/angular-three-postprocessing.d.ts",
|
|
54
54
|
"default": "./fesm2022/angular-three-postprocessing.mjs"
|
|
55
55
|
},
|
|
56
56
|
"./n8ao": {
|
|
57
|
-
"types": "./n8ao
|
|
57
|
+
"types": "./types/angular-three-postprocessing-n8ao.d.ts",
|
|
58
58
|
"default": "./fesm2022/angular-three-postprocessing-n8ao.mjs"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for the N8AO (N8 Ambient Occlusion) effect.
|
|
6
|
+
*
|
|
7
|
+
* N8AO is a high-quality, screen-space ambient occlusion implementation
|
|
8
|
+
* that provides realistic shadowing in crevices and corners.
|
|
9
|
+
*/
|
|
10
|
+
interface NgtpN8AOOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Radius of the ambient occlusion effect in world units.
|
|
13
|
+
* @default 5.0
|
|
14
|
+
*/
|
|
15
|
+
aoRadius: number;
|
|
16
|
+
/**
|
|
17
|
+
* Number of tones for AO gradient.
|
|
18
|
+
* @default 0.0
|
|
19
|
+
*/
|
|
20
|
+
aoTones: number;
|
|
21
|
+
/**
|
|
22
|
+
* How quickly the AO effect falls off with distance.
|
|
23
|
+
* @default 1.0
|
|
24
|
+
*/
|
|
25
|
+
distanceFalloff: number;
|
|
26
|
+
/**
|
|
27
|
+
* Intensity/strength of the ambient occlusion effect.
|
|
28
|
+
* @default 5
|
|
29
|
+
*/
|
|
30
|
+
intensity: number;
|
|
31
|
+
/**
|
|
32
|
+
* Bias offset for depth comparison.
|
|
33
|
+
* @default 0.0
|
|
34
|
+
*/
|
|
35
|
+
biasOffset: number;
|
|
36
|
+
/**
|
|
37
|
+
* Bias multiplier for depth comparison.
|
|
38
|
+
* @default 0.0
|
|
39
|
+
*/
|
|
40
|
+
biasMultiplier: number;
|
|
41
|
+
/**
|
|
42
|
+
* Number of samples for ambient occlusion calculation.
|
|
43
|
+
* Higher values = better quality but slower.
|
|
44
|
+
* @default 16
|
|
45
|
+
*/
|
|
46
|
+
aoSamples: number;
|
|
47
|
+
/**
|
|
48
|
+
* Number of samples for denoising.
|
|
49
|
+
* @default 8
|
|
50
|
+
*/
|
|
51
|
+
denoiseSamples: number;
|
|
52
|
+
/**
|
|
53
|
+
* Radius of the denoising filter.
|
|
54
|
+
* @default 12
|
|
55
|
+
*/
|
|
56
|
+
denoiseRadius: number;
|
|
57
|
+
/**
|
|
58
|
+
* Color of the ambient occlusion shadows.
|
|
59
|
+
* @default 'black'
|
|
60
|
+
*/
|
|
61
|
+
color: THREE.ColorRepresentation;
|
|
62
|
+
/**
|
|
63
|
+
* Whether to render at half resolution for better performance.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
halfRes: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Whether to use depth-aware upsampling when using half resolution.
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
depthAwareUpsampling: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Whether to use screen-space radius instead of world-space.
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
screenSpaceRadius: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Render mode for debugging and visualization.
|
|
79
|
+
* 0: Combined, 1: AO only, 2: Normals, 3: Depth, 4: Denoise
|
|
80
|
+
* @default 0
|
|
81
|
+
*/
|
|
82
|
+
renderMode: 0 | 1 | 2 | 3 | 4;
|
|
83
|
+
/**
|
|
84
|
+
* Number of iterations for the denoising filter.
|
|
85
|
+
* @default 2.0
|
|
86
|
+
*/
|
|
87
|
+
denoiseIterations: number;
|
|
88
|
+
/**
|
|
89
|
+
* Whether to handle transparent objects correctly.
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
transparencyAware: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Whether to apply gamma correction.
|
|
95
|
+
* @default true
|
|
96
|
+
*/
|
|
97
|
+
gammaCorrection: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Whether to use logarithmic depth buffer.
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
102
|
+
logarithmicDepthBuffer: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Whether to multiply the color instead of darkening.
|
|
105
|
+
* @default true
|
|
106
|
+
*/
|
|
107
|
+
colorMultiply: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Whether to accumulate samples over frames for better quality.
|
|
110
|
+
* @default false
|
|
111
|
+
*/
|
|
112
|
+
accumulate: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Quality preset that overrides individual settings.
|
|
115
|
+
* Options: 'performance', 'low', 'medium', 'high', 'ultra'
|
|
116
|
+
* @default undefined
|
|
117
|
+
*/
|
|
118
|
+
quality?: 'performance' | 'low' | 'medium' | 'high' | 'ultra';
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Angular component that applies N8AO (N8 Ambient Occlusion) to the scene.
|
|
122
|
+
*
|
|
123
|
+
* N8AO is a high-quality screen-space ambient occlusion effect that adds
|
|
124
|
+
* realistic shadowing to crevices, corners, and areas where objects meet.
|
|
125
|
+
* It provides various quality presets and fine-grained control over the
|
|
126
|
+
* AO appearance.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```html
|
|
130
|
+
* <ngtp-effect-composer>
|
|
131
|
+
* <ngtp-n8ao [options]="{ intensity: 3, aoRadius: 2 }" />
|
|
132
|
+
* </ngtp-effect-composer>
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```html
|
|
137
|
+
* <!-- Using quality preset -->
|
|
138
|
+
* <ngtp-effect-composer>
|
|
139
|
+
* <ngtp-n8ao [options]="{ quality: 'high' }" />
|
|
140
|
+
* </ngtp-effect-composer>
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
declare class NgtpN8AO {
|
|
144
|
+
/**
|
|
145
|
+
* Configuration options for the N8AO effect.
|
|
146
|
+
* @see NgtpN8AOOptions
|
|
147
|
+
*/
|
|
148
|
+
options: _angular_core.InputSignalWithTransform<NgtpN8AOOptions, "" | Partial<NgtpN8AOOptions>>;
|
|
149
|
+
private quality;
|
|
150
|
+
private effectComposer;
|
|
151
|
+
/**
|
|
152
|
+
* The underlying N8AOPostPass instance.
|
|
153
|
+
* Created with the scene and camera from the effect composer.
|
|
154
|
+
*/
|
|
155
|
+
protected effect: _angular_core.Signal<any>;
|
|
156
|
+
constructor();
|
|
157
|
+
/**
|
|
158
|
+
* Applies a quality preset to the effect.
|
|
159
|
+
* Converts the quality string to title case and calls the effect's setQuality method.
|
|
160
|
+
*/
|
|
161
|
+
private setQualityEffect;
|
|
162
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgtpN8AO, never>;
|
|
163
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgtpN8AO, "ngtp-n8ao", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export { NgtpN8AO };
|
|
167
|
+
export type { NgtpN8AOOptions };
|