-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_webar_face_grid.html
60 lines (58 loc) · 2.03 KB
/
index_webar_face_grid.html
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--
<script src="https://cdn.jsdelivr.net/gh/hiukim/[email protected]/dist/mindar-face.prod.js"></script>
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/hiukim/[email protected]/dist/mindar-face-aframe.prod.js"></script>
//// background transparant !?
var renderer = new THREE.WebGLRenderer( { alpha: true } );
// You can leave the clear color at the default value.
renderer.setClearColor( 0x000000, 0 ); // the default
-->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mindar-face-three.prod.js"></script>
<script type="module">
const THREE = window.MINDAR.FACE.THREE;
const mindarThree = new window.MINDAR.FACE.MindARThree({
container: document.querySelector("#containerCam"),
});
const {renderer, scene, camera} = mindarThree;
const light = new THREE.HemisphereLight( 0xffffff, 0xbbbbff, 1 );
scene.add(light);
const faceMesh = mindarThree.addFaceMesh();
const texture = new THREE.TextureLoader().load('./img_canonical_model/canonical_face_model_uv_visualization_WHITE.png');
faceMesh.material.map = texture;
faceMesh.material.transparent = true;
faceMesh.material.opacity = 0.4;
//// faceMesh.material.opacity = 1 + Math.sin(new Date().getTime() * .0025); // or any other value you like
faceMesh.material.needsUpdate = true;
scene.add(faceMesh);
const start = async() => {
await mindarThree.start();
renderer.setAnimationLoop(() => {
//// renderer.render(scene, camera);
renderer.render(scene, camera);
});
}
start();
</script>
<style>
body {
margin: 0;
}
#containerCam {
width: 100vw;
height: 100vh;
position: relative;
overflow: hidden;
}
video {
display: none;
}
</style>
</head>
<body>
<div id="containerCam">
</div>
</body>
</html>