forked from mml-io/3d-web-experience
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integrates denoise filter to post-processing pipeline
- Loading branch information
1 parent
e9c08dc
commit 36263cf
Showing
5 changed files
with
75 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
packages/3d-web-client-core/src/tweakpane/blades/denoiseFolder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { BladeController, View } from "@tweakpane/core"; | ||
import { BladeApi, FolderApi, TpChangeEvent } from "tweakpane"; | ||
|
||
import { DenoiseEffect } from "../../rendering/post-effects/denoiose"; | ||
|
||
export const denoiseValues = { | ||
distBias: 0.6, | ||
tolerance: 20.0, | ||
multiplier: 1.5, | ||
amount: 0.42, | ||
}; | ||
|
||
const denoiseOptions = { | ||
distBias: { min: 0.01, max: 0.85, step: 0.01 }, | ||
tolerance: { min: 0.01, max: 20, step: 0.01 }, | ||
multiplier: { min: 0.01, max: 5, step: 0.1 }, | ||
amount: { min: 0, max: 1, step: 0.01 }, | ||
}; | ||
|
||
export class DenoiseFolder { | ||
private folder: FolderApi; | ||
constructor(parentFolder: FolderApi, expand: boolean = false) { | ||
this.folder = parentFolder.addFolder({ title: "denoise", expanded: expand }); | ||
this.folder.addBinding(denoiseValues, "distBias", denoiseOptions.distBias); | ||
this.folder.addBinding(denoiseValues, "tolerance", denoiseOptions.tolerance); | ||
this.folder.addBinding(denoiseValues, "multiplier", denoiseOptions.multiplier); | ||
this.folder.addBinding(denoiseValues, "amount", denoiseOptions.amount); | ||
} | ||
|
||
public setupChangeEvent(denoiseEffect: typeof DenoiseEffect): void { | ||
this.folder.on("change", (e: TpChangeEvent<unknown, BladeApi<BladeController<View>>>) => { | ||
const target = (e.target as any).key; | ||
if (!target) return; | ||
switch (target) { | ||
case "distBias": | ||
denoiseEffect.uniforms.distBias.value = e.value as number; | ||
break; | ||
case "tolerance": | ||
denoiseEffect.uniforms.tolerance.value = e.value as number; | ||
break; | ||
case "multiplier": | ||
denoiseEffect.uniforms.multiplier.value = e.value as number; | ||
break; | ||
case "amount": | ||
denoiseEffect.uniforms.amount.value = e.value as number; | ||
break; | ||
default: | ||
break; | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters