@threepipe/webgi-plugins 0.6.4 → 0.7.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/CHANGELOG.md +93 -0
- package/README.md +13 -23
- package/THIRD_PARTY_NOTICES.md +243 -0
- package/dist/dependencies.txt +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4536 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4545 -18
- package/dist/index.mjs.map +1 -1
- package/dist/plugins/buffer/VelocityBufferPlugin.d.ts.map +1 -1
- package/dist/plugins/extras/AdvancedGroundPlugin.d.ts +3 -2
- package/dist/plugins/extras/AdvancedGroundPlugin.d.ts.map +1 -1
- package/dist/plugins/extras/AnisotropyPlugin.d.ts.map +1 -1
- package/dist/plugins/extras/WatchHandsPlugin.d.ts.map +1 -1
- package/dist/plugins/index.d.ts +24 -24
- package/dist/plugins/postprocessing/SSGIPlugin.d.ts +3 -2
- package/dist/plugins/postprocessing/SSGIPlugin.d.ts.map +1 -1
- package/dist/plugins/postprocessing/SSReflectionPlugin.d.ts +1 -1
- package/dist/utils/ShadowMapBaker.d.ts +1 -1
- package/dist/utils/ShadowMapBaker.d.ts.map +1 -1
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +22 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1633 -0
- package/docs/classes/AdvancedGroundPlugin.html +69 -0
- package/docs/classes/AnisotropyPlugin.html +40 -0
- package/docs/classes/BloomPlugin.html +37 -0
- package/docs/classes/BloomPluginPass.html +34 -0
- package/docs/classes/DepthOfFieldPlugin.html +41 -0
- package/docs/classes/DepthOfFieldPluginPass.html +37 -0
- package/docs/classes/OutlinePlugin.html +75 -0
- package/docs/classes/OutlineRenderPass.html +25 -0
- package/docs/classes/SSContactShadowsPlugin.html +37 -0
- package/docs/classes/SSGIPlugin.html +42 -0
- package/docs/classes/SSGIPluginPass.html +44 -0
- package/docs/classes/SSReflectionPlugin.html +43 -0
- package/docs/classes/SSReflectionPluginPass.html +45 -0
- package/docs/classes/SSVelocityMaterial.html +7 -0
- package/docs/classes/TemporalAAPlugin.html +37 -0
- package/docs/classes/TemporalAAPluginPass.html +33 -0
- package/docs/classes/VelocityBufferPlugin.html +41 -0
- package/docs/classes/WatchHandsPlugin.html +39 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +1 -0
- package/docs/types/OutlinePluginPass.html +1 -0
- package/docs/types/OutlinePluginTarget.html +1 -0
- package/docs/types/SSGIPluginTarget.html +1 -0
- package/docs/types/SSReflectionPluginTarget.html +1 -0
- package/docs/types/VelocityBufferPluginPass.html +1 -0
- package/docs/types/VelocityBufferPluginTarget.html +1 -0
- package/docs/variables/anisotropyGLTFExtension.html +1 -0
- package/docs/variables/webgiPlugins.html +1 -0
- package/package.json +23 -22
- package/src/global.d.ts +27 -0
- package/src/index.ts +1 -0
- package/src/passes/BilateralFilterPass.ts +62 -0
- package/src/passes/shaders/ssaoBilateral.glsl +89 -0
- package/src/plugins/buffer/VelocityBufferPlugin.ts +270 -0
- package/src/plugins/buffer/shaders/VelocityBufferPlugin.mat.frag.glsl +46 -0
- package/src/plugins/buffer/shaders/VelocityBufferPlugin.mat.vert.glsl +51 -0
- package/src/plugins/buffer/shaders/VelocityBufferPlugin.unpack.glsl +8 -0
- package/src/plugins/extras/AdvancedGroundPlugin.ts +385 -0
- package/src/plugins/extras/AnisotropyPlugin.ts +519 -0
- package/src/plugins/extras/WatchHandsPlugin.ts +156 -0
- package/src/plugins/extras/shaders/anisotropyBsdf.glsl +64 -0
- package/src/plugins/extras/shaders/anisotropyTBN.glsl +35 -0
- package/src/plugins/index.ts +38 -0
- package/src/plugins/postprocessing/BloomPlugin.ts +374 -0
- package/src/plugins/postprocessing/DepthOfFieldPlugin.ts +470 -0
- package/src/plugins/postprocessing/OutlinePlugin.ts +476 -0
- package/src/plugins/postprocessing/SSContactShadowsPlugin.ts +374 -0
- package/src/plugins/postprocessing/SSGIPlugin.ts +597 -0
- package/src/plugins/postprocessing/SSReflectionPlugin.ts +563 -0
- package/src/plugins/postprocessing/TemporalAAPlugin.ts +301 -0
- package/src/plugins/postprocessing/shaders/dofBlurBox.glsl +46 -0
- package/src/plugins/postprocessing/shaders/dofCombine.glsl +68 -0
- package/src/plugins/postprocessing/shaders/dofComputeCoC.glsl +21 -0
- package/src/plugins/postprocessing/shaders/dofExpandCoC.glsl +56 -0
- package/src/plugins/postprocessing/shaders/dofPoissonBox.glsl +90 -0
- package/src/plugins/postprocessing/shaders/giPatch.glsl +53 -0
- package/src/plugins/postprocessing/shaders/hdrBloom.glsl +101 -0
- package/src/plugins/postprocessing/shaders/outline.glsl +60 -0
- package/src/plugins/postprocessing/shaders/outlineDepthFrag.glsl +22 -0
- package/src/plugins/postprocessing/shaders/outlineDepthVert.glsl +26 -0
- package/src/plugins/postprocessing/shaders/poissonDiskSamples.glsl +19 -0
- package/src/plugins/postprocessing/shaders/samplePointHelpers.glsl +3 -0
- package/src/plugins/postprocessing/shaders/ssrPatch.glsl +145 -0
- package/src/plugins/postprocessing/shaders/ssreflectionMain.glsl +69 -0
- package/src/plugins/postprocessing/shaders/ssrt.glsl +118 -0
- package/src/utils/FSShadowMaterial.ts +65 -0
- package/src/utils/RandomizedDirectionalLight.ts +288 -0
- package/src/utils/Reflector2.ts +309 -0
- package/src/utils/ShadowMapBaker.ts +527 -0
- package/src/utils/shaders/computeScreenSpaceVelocity.glsl +16 -0
- package/src/utils/shaders/getWorldPositionFromViewZ.glsl +9 -0
- package/src/utils/shaders/poissonDiskSamples.glsl +19 -0
- package/src/utils/shaders/reflectorSample.glsl +54 -0
- package/src/utils/shaders/seperableBlurShaderMasked.glsl +28 -0
- package/src/utils/shaders/seperableShadowBlur.glsl +21 -0
- package/src/utils/shaders/ssreflection.glsl +141 -0
- package/src/utils/shaders/ssrtao.glsl +275 -0
- package/src/utils/shaders/temporalaa.glsl +233 -0
- package/src/utils/shaders.ts +24 -0
- package/tsconfig.json +39 -44
- package/dist/version.d.ts +0 -2
- package/dist/version.d.ts.map +0 -1
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BaseGroundPlugin,
|
|
3
|
+
BasicShadowMap,
|
|
4
|
+
bindToValue,
|
|
5
|
+
Event,
|
|
6
|
+
generateUiConfig,
|
|
7
|
+
IGeometry,
|
|
8
|
+
IMaterial,
|
|
9
|
+
IScene,
|
|
10
|
+
ISceneEventMap,
|
|
11
|
+
LinearFilter,
|
|
12
|
+
LinearMipmapLinearFilter,
|
|
13
|
+
Mesh2,
|
|
14
|
+
NoColorSpace,
|
|
15
|
+
onChange,
|
|
16
|
+
PCFShadowMap,
|
|
17
|
+
PCFSoftShadowMap,
|
|
18
|
+
PlaneGeometry,
|
|
19
|
+
RGBAFormat,
|
|
20
|
+
serialize,
|
|
21
|
+
ThreeViewer,
|
|
22
|
+
UiObjectConfig,
|
|
23
|
+
uiToggle,
|
|
24
|
+
UnsignedByteType,
|
|
25
|
+
VSMShadowMap,
|
|
26
|
+
WebGLRenderTarget,
|
|
27
|
+
} from 'threepipe'
|
|
28
|
+
import {SSReflectionPlugin} from '../postprocessing/SSReflectionPlugin'
|
|
29
|
+
import {Reflector2} from '../../utils/Reflector2'
|
|
30
|
+
import {ShadowMapBaker} from '../../utils/ShadowMapBaker'
|
|
31
|
+
|
|
32
|
+
export class AdvancedGroundPlugin extends BaseGroundPlugin {
|
|
33
|
+
public static readonly PluginType: string = 'AdvancedGroundPlugin'
|
|
34
|
+
|
|
35
|
+
get shadowBaker(): ShadowMapBaker | undefined {
|
|
36
|
+
return this._shadowBaker
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@onChange(AdvancedGroundPlugin.prototype._refresh3)
|
|
40
|
+
@uiToggle('Baked Shadows') @serialize() bakedShadows = true
|
|
41
|
+
@onChange(AdvancedGroundPlugin.prototype._refresh3)
|
|
42
|
+
@uiToggle('Planar Reflections') @serialize() groundReflection = false
|
|
43
|
+
@onChange(AdvancedGroundPlugin.prototype._refresh3)
|
|
44
|
+
@uiToggle('Physical Reflections') @serialize() physicalReflections = false
|
|
45
|
+
@onChange(AdvancedGroundPlugin.prototype._refresh3)
|
|
46
|
+
@uiToggle('Auto Shadow Frustum Size') @serialize() autoFrustumSize = true
|
|
47
|
+
|
|
48
|
+
// because of inheritance breaks onChange
|
|
49
|
+
private _refresh3(): void {
|
|
50
|
+
this.refresh()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@serialize('shadowBaker')
|
|
54
|
+
private _shadowBaker?: ShadowMapBaker
|
|
55
|
+
// private _showDebug: boolean
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* autoBakeShadows - when true, shadows are baked automatically on scene update(whenever any object in the scene changes), set it to `false` to trigger baking manually with {@see bakeShadows()}
|
|
59
|
+
*/
|
|
60
|
+
autoBakeShadows = true
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* bake shadows manually, to be used with {@see autoBakeShadows} set to false
|
|
64
|
+
*/
|
|
65
|
+
bakeShadows() {
|
|
66
|
+
this._shadowBaker?.reset()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
constructor() {
|
|
70
|
+
super()
|
|
71
|
+
this._onSceneUpdate = this._onSceneUpdate.bind(this)
|
|
72
|
+
const generatedUi = generateUiConfig(this)
|
|
73
|
+
const matUI = generatedUi.find(f=>typeof f === 'function')!
|
|
74
|
+
this.uiConfig = {
|
|
75
|
+
label: 'Ground',
|
|
76
|
+
type: 'folder',
|
|
77
|
+
children: [
|
|
78
|
+
...generatedUi.filter(f => f !== matUI),
|
|
79
|
+
...this._extraUiConfig(),
|
|
80
|
+
matUI,
|
|
81
|
+
],
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
protected _createMesh(mesh?: Mesh2<IGeometry & PlaneGeometry, IMaterial>) {
|
|
86
|
+
if (mesh) throw new Error('AdvancedGroundPlugin - mesh should not be provided')
|
|
87
|
+
// created once on first use and reused: Reflector2 asks for the target on every reflection update
|
|
88
|
+
const reflector = new Reflector2<IGeometry&PlaneGeometry>(this._geometry, ()=>this._reflectionTarget ??= this._viewer?.renderManager.createTarget({
|
|
89
|
+
// type: HalfFloatType,
|
|
90
|
+
type: UnsignedByteType,
|
|
91
|
+
format: RGBAFormat,
|
|
92
|
+
colorSpace: NoColorSpace, // todo: we can do rgbm if only opaque objects will be reflected
|
|
93
|
+
size: {width: 1024, height: 1024},
|
|
94
|
+
generateMipmaps: true,
|
|
95
|
+
depthBuffer: true,
|
|
96
|
+
minFilter: LinearMipmapLinearFilter,
|
|
97
|
+
magFilter: LinearFilter,
|
|
98
|
+
// isAntialiased: this._viewer.isAntialiased,
|
|
99
|
+
})!, 0, this._createMaterial())
|
|
100
|
+
const superOnBeforeRender = reflector.onBeforeRender
|
|
101
|
+
|
|
102
|
+
// todo why is this required?
|
|
103
|
+
reflector.onBeforeRender = (...params) => {
|
|
104
|
+
let ssr = this._viewer?.getPluginByType<SSReflectionPlugin>('SSReflectionPlugin')
|
|
105
|
+
if (ssr && ssr.isDisabled()) ssr = undefined
|
|
106
|
+
if (ssr) ssr.disable(reflector.uuid, false) // todo: do we need to disable ssao also?
|
|
107
|
+
|
|
108
|
+
// todo ssbevel
|
|
109
|
+
// let ssbevel = this._viewer?.getPluginByType<SSBevelPlugin>('SSBevelPlugin')?.pass?.passObject
|
|
110
|
+
// if (ssbevel && !ssbevel.enabled) ssbevel = undefined
|
|
111
|
+
// if (ssbevel) ssbevel.enabled = false
|
|
112
|
+
|
|
113
|
+
superOnBeforeRender(...params)
|
|
114
|
+
|
|
115
|
+
if (ssr) ssr.enable(reflector.uuid, false)
|
|
116
|
+
// if (ssbevel) ssbevel.enabled = true // todo ssbevel
|
|
117
|
+
}
|
|
118
|
+
return reflector
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
declare _mesh: Reflector2<IGeometry&PlaneGeometry>
|
|
122
|
+
private _reflectionTarget?: WebGLRenderTarget
|
|
123
|
+
|
|
124
|
+
onAdded(viewer: ThreeViewer) {
|
|
125
|
+
super.onAdded(viewer)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
protected _postFrame() {
|
|
129
|
+
super._postFrame()
|
|
130
|
+
if (!this._viewer) return
|
|
131
|
+
if (!this.enabled) return
|
|
132
|
+
if (this._shadowBaker && this.bakedShadows) {
|
|
133
|
+
this._shadowBaker.autoUpdateShadow()
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
protected _preRender() {
|
|
138
|
+
super._preRender()
|
|
139
|
+
if (!this._viewer) return
|
|
140
|
+
this._mesh.reflectionTargetNeedsUpdate = this._viewer.renderManager.frameCount < 1
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
onRemove(viewer: ThreeViewer) {
|
|
144
|
+
if (this._reflectionTarget) {
|
|
145
|
+
viewer.renderManager.disposeTarget(this._reflectionTarget)
|
|
146
|
+
this._reflectionTarget = undefined
|
|
147
|
+
}
|
|
148
|
+
super.onRemove(viewer) // unregisters the baker's material extension (_removeMaterial)
|
|
149
|
+
this._shadowBaker?.dispose()
|
|
150
|
+
this._shadowBaker = undefined
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
protected _removeMaterial() {
|
|
154
|
+
if (!this._material) return
|
|
155
|
+
if (this._shadowBaker && (this._material as any).groundMatExtension) {
|
|
156
|
+
this._material.unregisterMaterialExtensions?.([this._shadowBaker.materialExtension])
|
|
157
|
+
delete (this._material as any).groundMatExtension
|
|
158
|
+
}
|
|
159
|
+
if ((this._material as any).reflectorMatExtension) {
|
|
160
|
+
const ext = this._mesh.materialExtension
|
|
161
|
+
if (!ext) this._viewer?.console.warn('AdavancedGroundPlugin: unable to find the extension to unregister')
|
|
162
|
+
this._material.unregisterMaterialExtensions?.([ext])
|
|
163
|
+
delete (this._material as any).reflectorMatExtension
|
|
164
|
+
}
|
|
165
|
+
// todo: remove map or render target thats assigned
|
|
166
|
+
|
|
167
|
+
super._removeMaterial()
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
protected _onSceneUpdate(event: ISceneEventMap['addSceneObject' | 'sceneUpdate'] & Event<'addSceneObject' | 'sceneUpdate', IScene>) {
|
|
171
|
+
super._onSceneUpdate(event)
|
|
172
|
+
// Skip widget/widgetRoot changes (e.g. selection widgets being added/removed)
|
|
173
|
+
if (event?.object?.assetType === 'widget' || event?.object?.userData?.isWidgetRoot) return
|
|
174
|
+
if (event.geometryChanged === false) return
|
|
175
|
+
this.autoResetShadows()
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
autoResetShadows = () => {
|
|
179
|
+
if (this.autoBakeShadows) this._shadowBaker?.reset()
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
public refresh(): void {
|
|
183
|
+
if (!this._viewer) return
|
|
184
|
+
if (!this.isDisabled()) {
|
|
185
|
+
if (this.bakedShadows && !this._shadowBaker) {
|
|
186
|
+
this._shadowBaker = new ShadowMapBaker(this._viewer)
|
|
187
|
+
this._shadowBaker.attachedMesh = this._mesh
|
|
188
|
+
} else if (!this.bakedShadows && this._shadowBaker) {
|
|
189
|
+
this._shadowBaker.reset()
|
|
190
|
+
this._shadowBaker.cleanupMaterial()
|
|
191
|
+
}
|
|
192
|
+
const ref = this._mesh
|
|
193
|
+
if (ref.isReflector2) {
|
|
194
|
+
ref.enabled = this.groundReflection
|
|
195
|
+
ref.reflectorModePhysical = this.physicalReflections
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
super.refresh()
|
|
199
|
+
// this._viewer.setDirty(this)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
protected _refreshTransform() {
|
|
203
|
+
if (!super._refreshTransform()) return false
|
|
204
|
+
if (this.autoFrustumSize) {
|
|
205
|
+
const baker = this.shadowBaker
|
|
206
|
+
if (baker) {
|
|
207
|
+
const fs = this.size / 2
|
|
208
|
+
if (fs !== baker.light.shadowParams.frustumSize) {
|
|
209
|
+
baker.light.shadowParams.frustumSize = fs
|
|
210
|
+
baker.light.updateShadowParams()
|
|
211
|
+
baker.reset()
|
|
212
|
+
}
|
|
213
|
+
// ground.bakeShadows()
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return true
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// see BaseGroundPlugin
|
|
220
|
+
fromJSON(data: any, meta?: any): this | null {
|
|
221
|
+
if (!super.fromJSON(data, meta)) return null
|
|
222
|
+
if (data.autoFrustumSize === undefined) this.autoFrustumSize = false // for files which were saved before this option was added.
|
|
223
|
+
return this
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
protected _refreshMaterial() {
|
|
227
|
+
if (!this._viewer) return false
|
|
228
|
+
super._refreshMaterial()
|
|
229
|
+
if (!this._material) return
|
|
230
|
+
|
|
231
|
+
if (this.groundReflection && this._mesh.isReflector2 && !(this._material as any).reflectorMatExtension) {
|
|
232
|
+
const ext = this._mesh.materialExtension
|
|
233
|
+
ext.updaters = [this._viewer.scene, this._viewer.renderManager]
|
|
234
|
+
this._material.registerMaterialExtensions?.([ext])
|
|
235
|
+
;(this._material as any).reflectorMatExtension = true
|
|
236
|
+
}
|
|
237
|
+
if (this.bakedShadows && this._shadowBaker && !(this._material as any).groundMatExtension) {
|
|
238
|
+
this._material.registerMaterialExtensions?.([this._shadowBaker.materialExtension])
|
|
239
|
+
;(this._material as any).groundMatExtension = true
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
this._material.userData.ssreflDisabled = this.groundReflection
|
|
243
|
+
this._material.userData.ssreflNonPhysical = !this.physicalReflections
|
|
244
|
+
this._material.userData.ssaoDisabled = true
|
|
245
|
+
this._material.userData.sscsDisabled = true
|
|
246
|
+
this._viewer.setDirty(this)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
uiConfig: UiObjectConfig
|
|
250
|
+
protected _extraUiConfig(): (UiObjectConfig | (() => UiObjectConfig|UiObjectConfig[]))[] {
|
|
251
|
+
return [
|
|
252
|
+
{
|
|
253
|
+
label: 'Shadow Frames',
|
|
254
|
+
type: 'input',
|
|
255
|
+
hidden: ()=> !this._shadowBaker,
|
|
256
|
+
stepSize: 1,
|
|
257
|
+
bounds: [1, 1000],
|
|
258
|
+
property: ()=>[this._shadowBaker, 'maxFrameNumber'],
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
label: 'Alpha Vignette',
|
|
262
|
+
type: 'checkbox',
|
|
263
|
+
hidden: ()=> !this._material || (this._material.transmission || 0) < 0.0001 && !this._material.transparent,
|
|
264
|
+
property: ()=>[this._shadowBaker, 'alphaVignette'],
|
|
265
|
+
limitedUi: true,
|
|
266
|
+
onChange: ()=>this.uiConfig?.uiRefresh?.(true, 'postFrame'),
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
label: 'Alpha Vignette Axis',
|
|
270
|
+
type: 'dropdown',
|
|
271
|
+
hidden: ()=> !this._shadowBaker?.alphaVignette || !this._material || (this._material.transmission || 0) < 0.0001 && !this._material.transparent,
|
|
272
|
+
property: ()=>[this._shadowBaker, 'alphaVignetteAxis'],
|
|
273
|
+
children: ['x', 'y', 'xy'].map(v => ({label: v, value: v})),
|
|
274
|
+
limitedUi: true,
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
label: 'Shadow type',
|
|
278
|
+
type: 'dropdown',
|
|
279
|
+
hidden: ()=> !this._shadowBaker,
|
|
280
|
+
property: ()=>[this._shadowBaker, 'groundMapMode'],
|
|
281
|
+
children: [
|
|
282
|
+
{label: 'aoMap'},
|
|
283
|
+
{label: 'map'},
|
|
284
|
+
{label: 'alphaMap'},
|
|
285
|
+
],
|
|
286
|
+
limitedUi: true,
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
label: 'Smooth Shadow',
|
|
290
|
+
type: 'checkbox',
|
|
291
|
+
property: ()=>[this._shadowBaker, 'smoothShadow'],
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
label: 'Baked shadow type',
|
|
295
|
+
type: 'dropdown',
|
|
296
|
+
children: [['Basic', BasicShadowMap], ['PCF', PCFShadowMap], ['PCFSoft', PCFSoftShadowMap], ['VSM', VSMShadowMap]].map((v) => ({label: v[0].toString(), value: v[1]})),
|
|
297
|
+
property: ()=>[this._shadowBaker, 'shadowMapType'],
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
type: 'folder',
|
|
301
|
+
label: 'Randomized Light',
|
|
302
|
+
hidden: ()=> !this._shadowBaker,
|
|
303
|
+
limitedUi: true,
|
|
304
|
+
children: [
|
|
305
|
+
{
|
|
306
|
+
type: 'color',
|
|
307
|
+
label: 'Color',
|
|
308
|
+
property: ()=>[this._shadowBaker?.light, 'color'],
|
|
309
|
+
},
|
|
310
|
+
// {
|
|
311
|
+
// type: 'slider',
|
|
312
|
+
// label: 'Intensity',
|
|
313
|
+
// bounds: [0, 100],
|
|
314
|
+
// property: ()=>[this._shadowBaker?.light, 'intensity'],
|
|
315
|
+
// },
|
|
316
|
+
// {
|
|
317
|
+
// type: 'checkbox',
|
|
318
|
+
// label: 'Shadow Enabled',
|
|
319
|
+
// property: ()=>[this._shadowBaker?.light?.shadowParams, 'enabled'],
|
|
320
|
+
// onChange: [this._shadowBaker?.light?.updateShadowParams, this.autoResetShadows],
|
|
321
|
+
// },
|
|
322
|
+
{
|
|
323
|
+
type: 'slider',
|
|
324
|
+
bounds: [0.0, 1],
|
|
325
|
+
property: ()=>[this._shadowBaker?.light?.randomParams, 'focus'],
|
|
326
|
+
onChange: this.autoResetShadows,
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
type: 'slider',
|
|
330
|
+
bounds: [0.0, 1],
|
|
331
|
+
property: ()=>[this._shadowBaker?.light?.randomParams, 'spread'],
|
|
332
|
+
onChange: this.autoResetShadows,
|
|
333
|
+
limitedUi: true,
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
type: 'slider',
|
|
337
|
+
bounds: [0.01, 60],
|
|
338
|
+
property: ()=>[this._shadowBaker?.light?.randomParams, 'distanceScale'],
|
|
339
|
+
onChange: [this._shadowBaker?.light?.updateShadowParams, this.autoResetShadows],
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
type: 'vec3',
|
|
343
|
+
bounds: [-1, 1],
|
|
344
|
+
property: ()=>[this._shadowBaker?.light?.randomParams, 'direction'],
|
|
345
|
+
onChange: this.autoResetShadows,
|
|
346
|
+
limitedUi: true,
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
type: 'vec3',
|
|
350
|
+
bounds: [-1, 1],
|
|
351
|
+
property: ()=>[this._shadowBaker?.light?.randomParams, 'normalDirection'],
|
|
352
|
+
onChange: this.autoResetShadows,
|
|
353
|
+
limitedUi: true,
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
type: 'slider',
|
|
357
|
+
bounds: [0.01, 10],
|
|
358
|
+
property: ()=>[this._shadowBaker?.light?.shadowParams, 'radius'],
|
|
359
|
+
onChange: [this._shadowBaker?.light?.updateShadowParams, this.autoResetShadows],
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
type: 'input',
|
|
363
|
+
property: ()=>[this._shadowBaker?.light?.shadowParams, 'frustumSize'],
|
|
364
|
+
hidden: ()=> this.autoFrustumSize,
|
|
365
|
+
onChange: [this._shadowBaker?.light?.updateShadowParams, this.autoResetShadows],
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
type: 'slider',
|
|
369
|
+
bounds: [-0.1, 0.1],
|
|
370
|
+
property: ()=>[this._shadowBaker?.light?.shadowParams, 'bias'],
|
|
371
|
+
onChange: [this._shadowBaker?.light?.updateShadowParams, this.autoResetShadows],
|
|
372
|
+
},
|
|
373
|
+
],
|
|
374
|
+
},
|
|
375
|
+
]
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
@bindToValue({key: 'groundReflection'})
|
|
379
|
+
planarReflections: boolean
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* @deprecated - use {@link AdvancedGroundPlugin} instead
|
|
384
|
+
*/
|
|
385
|
+
export const GroundPlugin = AdvancedGroundPlugin
|