News for hackers. Stuff that matters.
Re:WebGPU-Based WiFi Simulator by soheil on Sunday October 20, 2024 @04:02PM (#41898082)
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);
Re:WebGPU-Based WiFi Simulator by vardump on Sunday October 20, 2024 @04:22PM (#41898209)
That's no solver, it just displays a sine wave pattern.
Re:WebGPU-Based WiFi Simulator by dankwizard on Sunday October 20, 2024 @07:14PM (#41899281)
Did ChatGPT write that for you because it has missed the mark by 500 metres.
Re:WebGPU-Based WiFi Simulator by soheil on Sunday October 20, 2024 @10:05PM (#41900112)
It's a sin + cos function.. you need an AI for that?
Re:WebGPU-Based WiFi Simulator by _flux on Monday October 21, 2024 @02:04AM (#41901098)
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..