WebGPU – All of the cores, none of the canvas

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • three.js

    JavaScript 3D Library.

  • I'm a graphics programmer who has quite a bit of experience with WebGL, and (disclaimer) I've also contributed to the WebGPU spec.

    > Quite honestly, I have no idea how ThreeJS manages to be so robust, but it does manage somehow.

    > To be clear, me not being able to internalize WebGL is probably a shortcoming of my own. People smarter than me have been able to build amazing stuff with WebGL (and OpenGL outside the web), but it just never really clicked for me.

    WebGL (and OpenGL) are awful APIs that can give you a very backwards impression about how to use them, and are very state-sensitive. It is not your fault for getting stuck here. Basically one of the first things everybody does is build a sane layer on top of OpenGL; if you are using gl.enable(gl.BLEND) in your core render loop, you have basically already failed.

    The first thing everybody does when they start working with WebGL is basically build a little helper on top that makes it easier to control its state logic and do draws all in one go. You can find this helper in three.js here: https://github.com/mrdoob/three.js/blob/master/src/renderers...

    > Luckily, accessing an array is safe-guarded by an implicit clamp, so every write past the end of the array will end up writing to the last element of the array

    This article might be a bit out of date (mind putting a publish date on these articles?), but these days, the language has been a bit relaxed. From https://gpuweb.github.io/gpuweb/#security-shader :

    > If the shader attempts to write data outside of physical resource bounds, the implementation is allowed to:

  • SHA256-WebGPU

    Implementation of sha256 in WGSL

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • gpuweb

    Where the GPU for the Web work happens!

  • box2d-wasm

    Box2D physics engine compiled to WebAssembly. Supports TypeScript and ES modules.

  • Following the article, you build a simple 2D physic simulation (only for balls). Did by chance anyone expand on that to include boxes, or know of a different approach to build a physic engine in WebGPU?

    I experiemented a bit with it and imolemented raycasting, but it is really not trivial getting the data in and out. (Limiting it to boxes and circles would satisfy my use case and seems doable, but getting polygons would be very hard, as then you have a dynamic size of their edges to account for and that gives me headache)

    3D physic engine on the GPU would be the obvious dream goal to get maximum performance, but that is really not an easy thing to do.

    Right now I am using a Box2D for wasm and it has good performance, but it could be better.

    https://github.com/Birch-san/box2d-wasm

    The main problem with all this is the overhead of getting data into the gpu and back. Once it is on the gpu it is amazingly fast. But the back and forth can really make your framerates drop - so to make it worth it, most of the simulation data has to remain on the gpu and you only put small chanks of data that have changed in and out. And ideally render it all on the gpu in the next step.

    (The performance bottleneck of this simulation is exactly that, it gets simulated on the gpu, then retrieved and drawn with the normal canvasAPI which is slow)

  • webtransport

    WebTransport is a web API for flexible data transport

  • aioquic

    QUIC and HTTP/3 implementation in Python

  • wgpu_glyph

    A fast text renderer for wgpu (https://github.com/gfx-rs/wgpu)

  • It won't live in WebGPU itself, but I do expect to start to see more third-party libraries for text. There’s already wgpu_glyph (https://github.com/hecrj/wgpu_glyph/tree/master) which uses a glyph atlas (CPU-rendered sprite map of characters), but techniques for signed-distance field fonts have come a long way too.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts