Most active commenters
  • jasmcole(8)
  • (8)
  • pjmlp(7)
  • soheil(3)

WebGPU-Based WiFi Simulator

(wifi-solver.com)
325 points jasmcole | 91 comments | | HN request time: 2.101s | source | bottom
1. jasmcole ◴[] No.41897610[source]
See also the blog post here discussing this project:

https://jasmcole.com/2024/10/18/a-decade-of-wifi/

2. noahbp ◴[] No.41897720[source]
It's so frustrating that WebGPU support was released 1.5 years ago on Chrome, and yet is still unavailable on all other browsers.

This is a real killer feature that will dramatically slow adoption of non-Chromium browsers, even with Google defanging ad blockers.

replies(9): >>41897739 #>>41897797 #>>41897800 #>>41897830 #>>41897856 #>>41897860 #>>41897886 #>>41897974 #>>41898014 #
3. jasmcole ◴[] No.41897739[source]
Agreed! Though support should be coming soon it seems. As a complete WebGPU novice I was really impressed with how quick it was to get going.
4. gnarbarian ◴[] No.41897797[source]
it's still not well supported on Linux unfortunately either
5. pjmlp ◴[] No.41897800[source]
Even Chrome only supports it officially on Windows, macOS and Android, no GNU/Linux (as stable).

And when it becomes widespread, just like WebGL 2.0, it will be a decade behind of what native APIs are capable of.

And in both cases, good luck debugging, other than replicating the content on native APIs, as means to use proper GPU debuggers, because even Chrome has yet to offer any developer tooling for GPU debugging.

replies(1): >>41897822 #
6. petermcneeley ◴[] No.41897822{3}[source]
Runs great on my ChromeBook.
replies(3): >>41897848 #>>41897971 #>>41899270 #
7. moffkalast ◴[] No.41897830[source]
For Safari that's par for the course, but Firefox is in surprisingly far behind in terms of anything GPU related in the browser.

I've recently been shocked trying out the WebGL aquarium demo [0] on Chrome and Firefox after running into some really odd performance issues on a project. You'd expect them to behave about the same with GPU acceleration, but FF barely gets half the framerate at the same load. Like, what?! On Linux FF is also several times slower at canvas rendering.

[0] https://webglsamples.org/aquarium/aquarium.html

replies(1): >>41897893 #
8. pjmlp ◴[] No.41897848{4}[source]
Forgot about that, which isn't GNU/Linux anyway.
replies(1): >>41898034 #
9. ◴[] No.41897856[source]
10. ◴[] No.41897860[source]
11. soheil ◴[] No.41897886[source]
Why do you need webgpu? It's unfortunate that people use technology that is "state-of-the-art techniques to run simulations at interactive speeds" without fully understanding what it's for. General compute on GPU is what webgpu is for.. To simulate basic waves like in this demo you absolutely do not need that, in fact it's an indication the author implemented the solution in a non-optimal way. WebGL is fully supported by all browsers fully supported by well-maintained libs like 3js, yet here we are people writing a sin function with basic interference patterns, one of the most elementary 3D primitives, in webgpu and argue that's using the "state-of-the-art" techniques.
replies(1): >>41897933 #
12. epuixrk ◴[] No.41897893{3}[source]
I‘m not an expert but I think it works on IOS with Safari. You have to enable WebGPU in the extra flag category in the settings app.

But I still need to figure out what exactly this is.

replies(1): >>41897978 #
13. zamadatix ◴[] No.41897932[source]
Badass on the visualization side. The multiple emitter portion and the end of the scroll reminded me of https://apenwarr.ca/beamlab/ which demonstrates beamforming (adjusting the phase of adjacent transmitters to focus power towards a specific receiver). To play with this one the "easiest" way to see what's going on is go to the right hand menu, unclick 3 so you just have 2 transmitters, click the "r" button, and then click or click and drag to see how the beam gets optimized (you can see some stats about the received power gain in the righthand side).

While this has to be the most fun to watch demonstration I've seen, something like the free tier of Hamina will likely be many times more useful to those wanting to optimize home Wi-Fi layout https://www.hamina.com/planner. The downside being they force you to make an account whereas this one lets you use it locally with the power of your own browser. The upside being Hamina gives multiple distilled views of the simulation as focused on common Wi-Fi statistics + features and less focus on displaying the wave simulation itself.

replies(1): >>41901935 #
14. jasmcole ◴[] No.41897933{3}[source]
Good question! This is actually a numerical solver for a few coupled partial differential equations - the method in this context (electromagnetism) is called FDTD. It's implemented as a WebGPU compute shader.

You absolutely could do this using WebGL2 compute shaders too, but I thought it would be fun to try this newer API.

replies(2): >>41898010 #>>41898082 #
15. geysersam ◴[] No.41897951[source]
Another interesting similar project: https://cemsim.com/ (I'm not the author)
16. SoKamil ◴[] No.41897971{4}[source]
ChromeOS is not a Linux distribution, change my mind.
replies(1): >>41898147 #
17. jsheard ◴[] No.41897974[source]
Especially frustrating in the case of Safari, which only needs to support one native API backend (Metal) on a pretty narrow set of hardware and drivers. Firefox has a much bigger task with needing to support everything, like Chrome, but with far less resources than Google or Apple can afford to throw at it.
replies(1): >>41898559 #
18. givinguflac ◴[] No.41897978{4}[source]
Can confirm, I have it enabled on iOS 18.1 and this seems to work fine.
19. zorgmonkey ◴[] No.41898010{4}[source]
Annoyingly WebGL2 doesn't have compute shaders even though GLES3.x that it is based on does.
replies(2): >>41898026 #>>41898296 #
20. modeless ◴[] No.41898014[source]
WebGL 2 took almost 5 years to come to Safari after Chrome. It will not take as long for WebGPU; development is active now.

It is also a bit frustrating that Chrome has not enabled WebGPU on all platforms by default yet.

21. ◴[] No.41898026{5}[source]
22. murderfs ◴[] No.41898034{5}[source]
By what metric? It's a gentoo deriviative with glibc, coreutils, etc.
replies(1): >>41898273 #
23. missblit ◴[] No.41898048[source]
Bugs:

#1 if you spam the "add a new source" button you eventually get a JavaScript exception logged to the screen due to an array with a fixed max size of 128 elements overflowing.

#2 this could be graphics card or driver specific (I have an AMD card), but scrolling just right can can break the simulation due the the text boxes; for example by quickly paging up and down, or scrolling all the way to the bottom and then wiggling the scroll position up and down. Once this happens the bad data propagates until the entire thing is filled with noise, solid black, or solid white. If you then scroll up to 3D mode the screen will be filled with a mess of polygons.

replies(3): >>41898478 #>>41901066 #>>41902724 #
24. dtgriscom ◴[] No.41898067[source]
> For example, as you scroll you'll notice that the waves are refracting around these text boxes.

Now, that's useless AND badass.

replies(1): >>41898122 #
25. soheil ◴[] No.41898082{4}[source]
I don't understand what other type of solution is there to render on a gpu other than a numeric one?

Here is a very basic shader for what you want:

  float freq1 = 2.0;
  float freq2 = 3.0;
  float amp = 0.5;

  pos.z += sin(pos.x * freq1 + uTime) * amp;
  pos.z += cos(pos.y * freq2 + uTime) * amp;

  gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
replies(2): >>41898209 #>>41899281 #
26. jasmcole ◴[] No.41898122[source]
Definitely the vibe I'm going for!
27. seanp2k2 ◴[] No.41898127[source]
Cool visualization but it focuses so much on the ``'-.,_,.-'`waves`'-.,_,.='`` and not on the actual coverage pattern of 6-12.5cm waves, so not as actually useful for showing coverage as other tools, but fun as an art project.

And of course, I can't mention that without shouting out projectM (open-source Milkdrop) that supports WebGL https://github.com/projectM-visualizer/projectm/blob/master/... and one of the OGs, Geisswerks https://www.geisswerks.com/

If you like that, you might also love NestDrop for music visualization tailored for VJs and with special features to support projecting inside domed surfaces https://nestimmersion.ca/nestdrop.php

replies(1): >>41898458 #
28. yjftsjthsd-h ◴[] No.41898147{5}[source]
ChromeOS is a Linux kernel with some software bundled on top to make a usable system; it is by definition a Linux distro. Curiously, it's even a GNU/Linux distro, as it uses glibc and GNU coreutils, unlike ex Android which is a non-GNU distro.

I will grant that it's a slightly odd distro, but is it any weirder than NixOS or Fedora Silverblue?

replies(1): >>41898281 #
29. Scryptonite ◴[] No.41898167[source]
When I run the Waveguide Simulator demo on my Alienware M15 Ryzen Ed. R5 (has a RTX 3070; Windows 11 Pro, Chrome v129), I hear a distinct high pitched flutter noise emanating from my laptop. I thought it was from the speakers, but no, with my volume down it was still present as long as the simulator was playing. Weird, but very cool demo (probably my hardware, never hear this during games or other WebGPU demos). The realistic house simulation yields a different signature in the sound.
replies(5): >>41898191 #>>41898193 #>>41898221 #>>41898376 #>>41899707 #
30. Tiberium ◴[] No.41898191[source]
That sounds like coil whine, it's a common thing to hear when GPU is working at full capacity.

https://en.wikipedia.org/wiki/Electromagnetically_induced_ac...

31. jasmcole ◴[] No.41898193[source]
Interesting! I have a desktop 3070 and hear the same. I don't hear anything on a Mac M1 though.
32. vardump ◴[] No.41898209{5}[source]
That's no solver, it just displays a sine wave pattern.
33. eyegor ◴[] No.41898221[source]
Coil whine (or capacitor whine) from the gpu running at too high a refresh rate. Easiest thing would be to use nvidia control panel to add an fps cap to something like 2x your monitors max rate for the browser (or globally). It's pretty common with any workload after like 600 fps.
replies(1): >>41898240 #
34. ◴[] No.41898240{3}[source]
35. pjmlp ◴[] No.41898273{6}[source]
A JavaScript userspace juggling Chrome instances.
replies(1): >>41898381 #
36. pjmlp ◴[] No.41898281{6}[source]
Only runs browser instances. Even Crostini is sandoxed in a way similar to WSL2.
replies(1): >>41898368 #
37. pjmlp ◴[] No.41898296{5}[source]
Thank Google for that, as they dropped Intel contribution to WebGL Compute, with the reasoning WebGPU would be good enough.
38. yjftsjthsd-h ◴[] No.41898368{7}[source]
User-facing apps are browser instances and VMs, and under that is a pretty normal userland. It's still a distribution of software on a Linux kernel. And for that matter, is Silverblue any less a Linux distro with its read-only root and apps in flatpak/distrobox? Are Qubes OS or Proxmox with everything in VMs?
replies(1): >>41901218 #
39. userbinator ◴[] No.41898376[source]
As others have said, it's probably the GPU power supply circuits making the sound; if the pattern of power consumption has frequencies in the audible range, it can cause components like inductors and capacitors to mechanically vibrate at those frequencies and emit sound. The reason you don't hear it in games is either due to the game audio being much louder or the power pattern not having those audible frequencies.

CPU power circuitry can do the same, but given this is using the GPU, it's a safe assumption that it's the latter.

40. murderfs ◴[] No.41898381{7}[source]
...no, it isn't?

Even if you're claiming (incorrectly) that the window manager, etc. contain javascript, the same would apply to GNOME!

replies(1): >>41901221 #
41. crazygringo ◴[] No.41898421[source]
This is exceptionally cool.

A while ago I was trying to find realistic examples of what WiFi "looks like", to try to get an intuitive sense of how it operated in a house or outside a building -- to what extent it spreads in the same way as a normal lightbulb, or to what extent its vastly larger wavelength complicated the picture.

At the time, literally the only visualization I was able to find was this artistic seemingly nonsense:

https://inspirationist.net/what-wifi-looks-like/

So I'm very happy to see this tool. I'd be even more curious to see a non-animated version that lets you drag your router around and see "illumination" of the overall signal to see how it changes, continuing to take into account how reflections confuse and degrade the usable signal, etc. Instead of the animation of slow wave propagation. Maybe that exists somewhere?

replies(2): >>41898441 #>>41905116 #
42. jasmcole ◴[] No.41898441[source]
Thanks! If you navigate to one of the example simulations, you'll be able to change the instantaneous field visualisation to one of time-averaged power density, which sounds closer to what you're looking for.

The cool thing about the speed of WebGPU is that you can drag things around and watch changes in real-time, even if you have to average lots of simulation steps per rendered frame.

replies(1): >>41898519 #
43. jasmcole ◴[] No.41898458[source]
Hey, if you click through to one of the example simulations you'll be able to change the visualization from waves to time-averaged power density, which should be closer to what you're looking for.
44. richbradshaw ◴[] No.41898477[source]
I have a Wifi 6E router, so I wonder if 6GHz vs 5 vs 2.4 acts noticeabley differently here? Is the overall shape the same or does the frequency make a big difference?
replies(1): >>41899844 #
45. grishka ◴[] No.41898478[source]
I did get #2 on an Apple M1, so probably not video card specific.
replies(1): >>41900500 #
46. crazygringo ◴[] No.41898519{3}[source]
Ah yes, I've found it -- changing "Signal" from "EM field" to "Power". That is fascinating to look at.

Is there a way to move the router around to see how the field changes in response?

As far as I can tell you can do that in the paid version, and I totally understand gating that for people modeling their own home/office layout. But it would be pretty cool as a free educational demo if you could move the router in the otherwise fixed example.

47. aabhay ◴[] No.41898559{3}[source]
Its in technology preview, so likely to go GA at the next major OS cycle (1yish)
replies(1): >>41898600 #
48. jsheard ◴[] No.41898600{4}[source]
I'm not holding my breath, their WebGL2 support entered preview in early 2017 but didn't actually ship until late 2021...
replies(1): >>41900737 #
49. crtified ◴[] No.41898656[source]
What are the system requirements to run this? Fairly 'standard' Linux system running Chrome here.

"Sorry, there was an error starting the simulation

Sorry, WebGPU is not supported on our device

WiFi Solver may not be compatible with your device."

replies(6): >>41898687 #>>41898697 #>>41898797 #>>41899107 #>>41899318 #>>41903236 #
50. cloogshicer ◴[] No.41898687[source]
No Linux support for WebGPU in Chrome yet: https://caniuse.com/webgpu
51. jeroenhd ◴[] No.41898697[source]
Dev tools gave me this link: https://github.com/gpuweb/gpuweb/wiki/Implementation-Status#...

Barely any Firefox support either.

Looks like I'll skip this one.

52. throwaway0665 ◴[] No.41898797[source]
To run on Chromium Linux you need to enable "enable-unsafe-webgpu" as well as "enable-vulkan" flags in "chrome://flags". Best to disable again afterwards.
53. ◴[] No.41899067[source]
54. kiwijamo ◴[] No.41899107[source]
Doesn't work on Firefox/Windows either.
55. koolala ◴[] No.41899270{4}[source]
No luck on Steam Deck :(
56. dankwizard ◴[] No.41899281{5}[source]
Did ChatGPT write that for you because it has missed the mark by 500 metres.
replies(1): >>41900112 #
57. taminka ◴[] No.41899318[source]
hasn't webgpu standard been out for a while now? how come only chromium supports it?
replies(1): >>41899452 #
58. ddtaylor ◴[] No.41899443[source]
Seems Firefox on Linux isn't supported. I'll give this a look another time.
59. heftig ◴[] No.41899452{3}[source]
Because it's an incredibly complex mess that will allow sandbox escape if it isn't implemented exactly right.

Also, it's still in draft status. Not that that means much.

60. bhouston ◴[] No.41899519[source]
WeBGPU support is increasing but it isn’t yet above 70% of devices: https://web3dsurvey.com/webgpu
replies(1): >>41908030 #
61. mypalmike ◴[] No.41899707[source]
I get the same coil whine on my laptop (AMD Radeon Mobile GPU) whenever I run GPU heavy code.
62. vlovich123 ◴[] No.41899844[source]
6 vs 5 is basically the same. 5 vs 2.4 should be quite a bit difference since absorption and reflection works differently.
63. soheil ◴[] No.41900112{6}[source]
It's a sin + cos function.. you need an AI for that?
replies(1): >>41901098 #
64. rubatuga ◴[] No.41900485[source]
Similar concept in shadertoy:

https://www.shadertoy.com/view/st3XWX

65. jerbear4328 ◴[] No.41900500{3}[source]
Reproduced here on NVIDIA as well.
66. fulafel ◴[] No.41900737{5}[source]
And last I heard still has show-stopping performance bugs affecting eg Unity web target.
67. KingOfCoders ◴[] No.41900874[source]
"Sorry, WebGPU is not supported on your device" Firefox, Nvidia

A. Why?

B. What a bad error message

replies(3): >>41900944 #>>41900965 #>>41904842 #
68. ◴[] No.41900944[source]
69. kristiandupont ◴[] No.41900951[source]
I once wanted to make something similar, for sound. I wanted to create active noise cancelling "in the room", instead of via headphones. I pictured these devices combining a microphone and a speaker that you could set up in strategic location. After thinking about it for a bit, I realized that inference would cause areas with silence and others where the sound volume would be doubled. Less than ideal but still possibly interesting. But then I thought about it some more and realized that I needed to think in 3D, which makes the setup orders of magnitude more complex.

It seems like that would apply here as well, at least when looking at the effects of refraction?

replies(2): >>41903387 #>>41906455 #
70. ◴[] No.41900965[source]
71. faragon ◴[] No.41901081[source]
I was expecting here SDR radio processing: noise read from GPIO's passed to a web browser with a pipe, showing activity on all channels at once.
72. _flux ◴[] No.41901098{7}[source]
The point was that the implementation of this tool is not a sin+cos function. It's more like

  let newEz = Ez0[me] +  calcEzDiff(vec2u(id.x, id.y), dx, dy, aspect);

  let newEzAbove = Ez0[above] +  calcEzDiff(vec2u(id.x, id.y + 1), dx, dy, aspect);
  let newEzRight = Ez0[right] +  calcEzDiff(vec2u(id.x + 1, id.y), dx, dy, aspect);

  Hx1[me] = Hx0[me] - (uniforms.dt/mu0)*(newEzAbove - newEz) / dy;
  Hy1[me] = Hy0[me] + (uniforms.dt/mu0)*(newEzRight - newEz) / dx;

  Ez1[me] = newEz;

  let localDelta = delta[me];
  let fac = 1 + uniforms.omega * uniforms.dt * (delta[me] / eps[me] / 2);
  Ez1[me] = Ez1[me] / fac;
  Hx1[me] = Hx1[me] / fac;
  Hy1[me] = Hy1[me] / fac;
and then a bunch of other GPU code. You can find this with little effort from the bundle, if you care, by base64-decoding the Pt("xxx") parts.

Though I do imagine it indeed could be implementable with WebGL shaders, but I also wouldn't start a new compute-based on it, unless I had a particular need to support older systems. And this I say as a Firefox user..

73. pjmlp ◴[] No.41901218{8}[source]
People buying a Chromebook down at the mall will never see GNU userland.

Folks using Silverblue and Flatpak distributions get to use GNU userland.

74. pjmlp ◴[] No.41901221{8}[source]
GNOME allows GNU userland to be used.
75. timkq ◴[] No.41901571[source]
I wonder if there is something like this but open-source, so I could customize this. I'm looking for a tool to solve UWB positioning (for indoor navigation) - to be able to know where to optimally place various UWB anchor points.
replies(1): >>41903581 #
76. maho ◴[] No.41901717[source]
I need this, but for heatpump noise.

It's mostly broadband noise that can be simulated by simpler methods, but visualizing possible resonance patterns for the low-frequency emissions from the compressor (which typically runs at 20Hz, 40Hz, ..., 120 Hz) would be good to know.

Although I am not sure how the 2d simulation result carries over to the 3d world...

77. croon ◴[] No.41901931[source]
I think I clicked the link at the bottom to add new sources to the simulation a few times too many:

Unexpected Application Error!

offset is out of bounds

RangeError: offset is out of bounds at Float32Array.set (<anonymous>) at Pi.makeUniformBuffer (https://wifi-solver.com/dist/bundle-UKQ5A5W6.js:32:118833) at Pi.updateUniforms (https://wifi-solver.com/dist/bundle-UKQ5A5W6.js:32:117585) at Pi.setState (https://wifi-solver.com/dist/bundle-UKQ5A5W6.js:32:114537) at https://wifi-solver.com/dist/bundle-UKQ5A5W6.js:70:2373 at Vc (https://wifi-solver.com/dist/bundle-UKQ5A5W6.js:8:24370) at la (https://wifi-solver.com/dist/bundle-UKQ5A5W6.js:8:42602) at aS (https://wifi-solver.com/dist/bundle-UKQ5A5W6.js:8:41415) at ro (https://wifi-solver.com/dist/bundle-UKQ5A5W6.js:8:40441) at im (https://wifi-solver.com/dist/bundle-UKQ5A5W6.js:8:37031)

78. Peanuts99 ◴[] No.41901935[source]
Came here looking for a mention on Hamina - I use it for work for planning wireless installs and it's a really decent piece of software.
79. leowbattle ◴[] No.41902724[source]
I find the #2 issue happens more easily with a higher simulation speed too.
80. ◴[] No.41903236[source]
81. eurekin ◴[] No.41903387[source]
If that technically worked, I could see that being a next unicorn.
replies(1): >>41906354 #
82. relaxing ◴[] No.41903581[source]
Pay for a FEKO license?
83. butz ◴[] No.41904842[source]
Not to mention one cannot copy error message easily. Well, I'll be on itch.io playing 3D games using WebGPU on my not supported device.
replies(1): >>41905206 #
84. whalesalad ◴[] No.41905014[source]
Won't run for me on Firefox or Chromium on Debian 12.
replies(1): >>41905788 #
85. zokier ◴[] No.41905116[source]
cnlohr did project that visualized wifi power level spatially

https://www.youtube.com/watch?v=aqqEYz38ens

86. KingOfCoders ◴[] No.41905206{3}[source]
Dito.
87. a1o ◴[] No.41905788[source]
It doesn't run for me either on Safari :/
88. ahmetrcagil ◴[] No.41906354{3}[source]
It can work (Look up beamforming). However it takes a 3d array of speakers with a lot of elements positioned in specific points in space, as well as very accurate position tracking for both ears. Very very unlikely to ever beat a high end noise cancelling headphone in terms of performance as well.

If the listener can be fixed in space then the problem gets easier but in that case what you have is actually a very large, room sized headphone that you enter and sit down into.

Source: I indirectly consulted a high-end furniture company on this exact project, they decided to pivot after a while.

89. withinboredom ◴[] No.41906455[source]
If you had a "sound laser", you could control the waves when entering a column (think a "sound umbrella") to cancel out sounds that enter. However, this only works for "regular sounds" (as in non-directional sound, like sound from distant sources, like speakers). So, it wouldn't cancel out things like people speaking. It would be pretty useful for clubs, where at your table you can have regular speaking conversations.

I hate to mention that this is all currently patented. It's pretty "easy" to build though, but you'll have to wait a bit for all the related patents to expire or pay some licensing fees.

90. jondwillis ◴[] No.41908030[source]
went up by at least 1 device today, as I realized that I forgot to enable WebGPU preview in Safari on my work laptop!