-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
204 lines (174 loc) · 5.27 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Primary Meta Tags -->
<title>WebGPU Raytracer</title>
<meta name="title" content="WebGPU Raytracer" />
<meta name="description" content="Realtime pathtracing via WebGPU compute shader" />
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website" />
<meta property="og:url" content="https://gnikoloff.github.io/webgpu-raytracer/" />
<meta property="og:title" content="WebGPU Raytracer" />
<meta property="og:description" content="Realtime pathtracing via WebGPU compute shader" />
<meta property="og:image" content="https://gnikoloff.github.io/webgpu-raytracer/social.png" />
<!-- Twitter -->
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="https://gnikoloff.github.io/webgpu-raytracer/" />
<meta property="twitter:title" content="WebGPU Raytracer" />
<meta property="twitter:description" content="Realtime pathtracing via WebGPU compute shader" />
<meta property="twitter:image" content="https://gnikoloff.github.io/webgpu-raytracer/social.png" />
<!-- Meta Tags Generated with https://metatags.io -->
<style>
body {
font-size: 14px;
overflow: hidden;
background: black;
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
body.loaded #header {
display: block;
}
body.loaded #lds-dual-ring {
display: none;
}
a {
color: white;
}
#c {
position: fixed;
top: 50%;
left: 50%;
z-index: -1;
}
#lds-dual-ring {
position: fixed;
top: 50%;
left: 50%;
display: block;
width: 14px;
height: 14px;
margin: -7px 0 0 0 -7px;
border-radius: 50%;
border: 2px solid #fff;
border-color: #fff transparent #fff transparent;
animation: lds-dual-ring 1.2s linear infinite;
}
@keyframes lds-dual-ring {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
#header {
position: fixed;
top: 0;
left: 0;
padding: 1rem;
background: rgba(0, 0, 0, 0.5);
color: white;
display: none;
}
#header h1 {
margin: 0;
font-size: 18px;
}
#header h5 {
margin: 0.5rem 0 0 0;
font-weight: 400;
font-size: 14px;
}
#loader {
margin: 1rem 0 1.5rem 0;
background: rgba(255, 255, 255, 0.2);
width: 100%;
height: 2px;
position: relative;
}
#progress {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
background: white;
}
#progress-percent {
position: absolute;
bottom: -13px;
right: 0;
font-size: 9px;
}
#progress-percent.docked-left {
left: 0;
}
#progress-percent.docked-right {
right: 0;
}
#no-webgpu {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999999999;
background: black;
color: white;
padding: 1rem;
box-sizing: border-box;
display: none;
}
#no-webgpu-screenshot img {
max-width: 700px;
width: 100%;
}
</style>
</head>
<body>
<div id="no-webgpu">
<h1>Uh-oh, WebGPU not supported!</h1>
<p>This raytracer is written with the new WebGPU API. Seems like your browser does not support it.</p>
<p>Please upgrade to a modern browser.</p>
<p>For Safari you can check out details how to do so <a
href="https://webkit.org/blog/14879/webgpu-now-available-for-testing-in-safari-technology-preview/">here</a>.
</p>
<p>For Firefox you can check details <a href="https://stackoverflow.com/a/74967300/1777688">here</a>.</p>
<p id="no-webgpu-screenshot"></p>
</div>
<div id="lds-dual-ring"></div>
<header id="header">
<h1>WebGPU Raytracer</h1>
<h5>Code & info on <a href="https://github.com/gnikoloff/webgpu-raytracer" target="_blank">Github</a>. Made by <a
target="_blank" href="https://georgi-nikolov.com/">Georgi Nikolov</a></h5>
<p>Hold left mouse button to rotate and right to pan.</p>
<div id="loader">
<div id="progress"><span id="progress-percent"></span></div>
</div>
<p>Sample counter: <span id="frame-count"></span></p>
<p>Time expired: <span id="time-expired"></span></p>
</header>
<script>
if (!navigator.gpu) {
document.getElementById("no-webgpu").style.display = "block"
document.getElementById("no-webgpu-screenshot").innerHTML = `
<img src="no-webgpu-screenshot.png" alt="Render containing a bunch of models with the WebGPU raytracer" />
`
throw new Error("WebGPU not supported!")
}
</script>
<script type="module" src="src/index.ts"></script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FHFK6EXTGM"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-FHFK6EXTGM');
</script>
</body>
</html>