4 ms·
This looks heavily geared towards graphics. I’m interested in the compute capabilities of WebGPU to build an in-browser simulator (e.g. physics/quantum). Anyone
by billti 4y ago
This looks heavily geared towards graphics. I’m interested in the compute capabilities of WebGPU to build an in-browser simulator (e.g. physics/quantum). Anyone know of any good resources for that? (Samples, best practices, etc.)
- qz_kb 4y agoThis is usually done with shaders and a circle of buffers which maintain state.
- superzamp 4y agoTotal graphics / shaders / GPU noob here. Does that mean you'll essentially get free visualisations (albeit non-sensical ones) as a byproduct of your computations?
- jesse__ 4y agoI think it depends, but given an arbitrary compute pipeline, you should be able to write the results (or intermediary results) to the screen with minimal effort.
- sva_ 4y agoNo, it's an @compute shader rather than a combination of @vertex and @fragment shaders (which would do graphics) in the case of WebGPU. Surely you could visualize it but not as a side effect.
- AgentME 4y agoIf you wanted to do compute in a shader before WebGPU with WebGL instead, then I think the answer is kind of yes. It wasn't "for free" without any code but it was required to do. But now WebGPU supports compute shaders properly so you don't have to do compute in a shader that produces textures.
- fulafel 4y agoA texture in WebGL is just a memory buffer that can be accessed by shaders. It doesn't end up on screen automatically.
- akomtu 4y agoFragment shaders can only go so far. Can you do in webgpu something like this? outputTexture2d[inputTexture2d[inputPosition]]++ In other words, if you have a large texture with (x,y) coordinates of points, can you draw another texture that shows a density cloud of these points? In webgl2 it becomes a phd level problem.
- pjmlp 4y agoOne needs to do multiple passes, not sure if that is to be considered a PhD level problem.
- sritchie 4y agoI think Steven Wittens’s work at acko.net and https://usegpu.live/ https://usegpu.live/ is your best bet here. I’ve been working for a couple of years on building a computer algebra / physics system in Clojure and integrating it with Steven’s previous work on MathBox, with some in-progress demos like this: https://emmy-viewers.mentat.org/dev/examples/simulation/quartic_well.html https://emmy-viewers.mentat.org/dev/examples/simulation/quar... https://emmy-viewers.mentat.org/dev/examples/simulation/toroid.html https://emmy-viewers.mentat.org/dev/examples/simulation/toro... Use.GPU looks like it will be close to a drop-in replacement for MathBox, running on WebGPU. Maybe someday I’ll actually be able to build my general relativistic ray tracer, with explorable symbolic physics all the day down…