forked from lumalabs/luma-web-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DemoBackgroundRemoval.ts
38 lines (29 loc) · 974 Bytes
/
DemoBackgroundRemoval.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { LumaSplatsSemantics, LumaSplatsThree } from "@lumaai/luma-web";
import { DemoProps } from ".";
import { loadEnvironment } from "./util/Environment";
export function DemoBackgroundRemoval(props: DemoProps) {
let { renderer, scene, gui } = props;
let splats = new LumaSplatsThree({
// Jules Desbois La Femme à l’arc @HouseofJJD
source: 'https://lumalabs.ai/capture/1b5f3e33-3900-4398-8795-b585ae13fd2d',
enableThreeShaderIntegration: false,
});
scene.add(splats);
let layersEnabled = {
Background: false,
Foreground: true,
}
function updateSemanticMask() {
splats.semanticsMask =
(layersEnabled.Background ? LumaSplatsSemantics.BACKGROUND : 0) |
(layersEnabled.Foreground ? LumaSplatsSemantics.FOREGROUND : 0);
}
updateSemanticMask();
gui.add(layersEnabled, 'Background').onChange(updateSemanticMask);
loadEnvironment(renderer, scene, 'assets/venice_sunset_1k.hdr');
return {
dispose: () => {
splats.dispose();
}
}
}