forked from antimatter15/splat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
280 lines (255 loc) · 5.73 KB
/
index.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<title>WebGL Gaussian Splat Viewer</title>
<meta charset="utf-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"
/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta
name="apple-mobile-web-app-status-bar-style"
content="black-translucent"
/>
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
<style>
body {
overflow: hidden;
margin: 0;
height: 100vh;
width: 100vw;
font-family: sans-serif;
background: black;
text-shadow: 0 0 3px black;
}
a, body {
color: white;
}
#info {
z-index: 100;
position: absolute;
top: 10px;
left: 15px;
}
h3 {
margin: 5px 0;
}
p {
margin: 5px 0;
font-size: small;
}
.cube-wrapper {
transform-style: preserve-3d;
}
.cube {
transform-style: preserve-3d;
transform: rotateX(45deg) rotateZ(45deg);
animation: rotation 2s infinite;
}
.cube-faces {
transform-style: preserve-3d;
height: 80px;
width: 80px;
position: relative;
transform-origin: 0 0;
transform: translateX(0) translateY(0) translateZ(-40px);
}
.cube-face {
position: absolute;
inset: 0;
background: #0017ff;
border: solid 1px #ffffff;
}
.cube-face.top {
transform: translateZ(80px);
}
.cube-face.front {
transform-origin: 0 50%;
transform: rotateY(-90deg);
}
.cube-face.back {
transform-origin: 0 50%;
transform: rotateY(-90deg) translateZ(-80px);
}
.cube-face.right {
transform-origin: 50% 0;
transform: rotateX(-90deg) translateY(-80px);
}
.cube-face.left {
transform-origin: 50% 0;
transform: rotateX(-90deg) translateY(-80px) translateZ(80px);
}
@keyframes rotation {
0% {
transform: rotateX(45deg) rotateY(0) rotateZ(45deg);
animation-timing-function: cubic-bezier(
0.17,
0.84,
0.44,
1
);
}
50% {
transform: rotateX(45deg) rotateY(0) rotateZ(225deg);
animation-timing-function: cubic-bezier(
0.76,
0.05,
0.86,
0.06
);
}
100% {
transform: rotateX(45deg) rotateY(0) rotateZ(405deg);
animation-timing-function: cubic-bezier(
0.17,
0.84,
0.44,
1
);
}
}
.scene,
#message {
position: absolute;
display: flex;
top: 0;
right: 0;
left: 0;
bottom: 0;
z-index: 2;
height: 100%;
width: 100%;
align-items: center;
justify-content: center;
}
#message {
font-weight: bold;
font-size: large;
color: red;
pointer-events: none;
}
details {
font-size: small;
}
#progress {
position: absolute;
top: 0;
height: 5px;
background: blue;
z-index: 99;
transition: width 0.1s ease-in-out;
}
#quality {
position: absolute;
bottom: 10px;
z-index: 999;
right: 10px;
}
#caminfo {
position: absolute;
top: 10px;
z-index: 999;
right: 10px;
}
#canvas {
display: block;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
touch-action: none;
}
#instructions {
background: rgba(0,0,0,0.6);
white-space: pre-wrap;
padding: 10px;
border-radius: 10px;
font-size: x-small;
}
body.nohf .nohf {
display: none;
}
body.nohf #progress, body.nohf .cube-face {
background: #ff9d0d;
}
</style>
</head>
<body>
<script>
if(location.host.includes('hf.space')) document.body.classList.add('nohf');
</script>
<div id="info">
<h3 class="nohf">WebGL 3D Gaussian Splat Viewer</h3>
<p>
<small class="nohf">
By <a href="https://twitter.com/antimatter15">Kevin Kwok</a>.
Code on
<a href="https://github.com/antimatter15/splat">Github</a
>.
</small>
</p>
<details>
<summary>Use mouse or arrow keys to navigate.</summary>
<div id="instructions">movement (arrow keys)
- left/right arrow keys to strafe side to side
- up/down arrow keys to move forward/back
- space to jump
camera angle (wasd)
- a/d to turn camera left/right
- w/s to tilt camera up/down
- q/e to roll camera counterclockwise/clockwise
- i/k and j/l to orbit
trackpad
- scroll up/down/left/right to orbit
- pinch to move forward/back
- ctrl key + scroll to move forward/back
- shift + scroll to move up/down or strafe
mouse
- click and drag to orbit
- right click (or ctrl/cmd key) and drag up/down to move
touch (mobile)
- one finger to orbit
- two finger pinch to move forward/back
- two finger rotate to rotate camera clockwise/counterclockwise
- two finger pan to move side-to-side and up-down
gamepad
- if you have a game controller connected it should work
other
- press 0-9 to switch to one of the pre-loaded camera views
- press '-' or '+'key to cycle loaded cameras
- press p to resume default animation
- drag and drop .ply file to convert to .splat
- drag and drop cameras.json to load cameras
</div>
</details>
</div>
<div id="progress"></div>
<div id="message"></div>
<div class="scene" id="spinner">
<div class="cube-wrapper">
<div class="cube">
<div class="cube-faces">
<div class="cube-face bottom"></div>
<div class="cube-face top"></div>
<div class="cube-face left"></div>
<div class="cube-face right"></div>
<div class="cube-face back"></div>
<div class="cube-face front"></div>
</div>
</div>
</div>
</div>
<canvas id="canvas"></canvas>
<div id="quality">
<span id="fps"></span>
</div>
<div id="caminfo">
<span id="camid"></span>
</div>
<script src="main.js"></script>
</body>
</html>