What are the limits of WebGPU?

Hello everyones,

this is my first post here and I would like to show my interest to BabylonJS as the framework for my future game development. My will is to create large worlds (in my use case, galaxies) and I have to consider what the technology propose as the limits to be able to create these kind of world.

A good example of what I want to achieve is this video: Galaxia - Binaries - July 2018 - YouTube

My concerns will be the amount of meshes I will be able to draw keeping a performance reasonable, the type of vars I will be able to use and its limits, using procedural generation and LOD. We know for example UE5 works currently on a new double precision coordinate system, the LWC and it is more tailored to manage big worlds and displaying more meshes (with its nanite feature).

My aim is to use web technologies but do not want to be limited at some point of my development.
If anyone can grasp the boundaries of WebGPU, even if the specs are still in development, maybe using comparison, or reassure me for its future, I will be very thankful.

pinging @sebavan :slight_smile:

2 Likes

A lot of the meshes I am seeing on the video are kind of particle like and @Evgeni_Popov added support for thinInstances in 5.0 which could tremendously help in this regard. About LWC, it is not something we support as is but we do have some tricks that mainly @Evgeni_Popov shared.

Webgpu on is on is still not as powerfull as what you can do natively. JS will also be a limitations in term of speed and mainly multithreading.

1 Like

WebGPU is no different from WebGL in this regard, as GPU precision is still 32 bits float.

One thing which is better in WebGPU than in WebGL is that reverse depth buffer actually works as expected, so you can have better depth precision. But if you want to simulate a big world / universe you will still need to use some clever technics (see for eg https://forum.unity.com/threads/how-to-handle-truly-open-world-maps-with-unity-due-to-floating-point-limitations.530575/).

2 Likes

A lot of the meshes I am seeing on the video are kind of particle like…

As the author of this video says, he’s using UE4 with VoxelPlugin for planet (and orbital bodies) surfaces, the rest is 100% custom c++ code with his own shaders and impostors system inside octrees.

@sebavan @Evgeni_Popov Thanks for your both answers. That is a definite interesting topic on Unity and that answer to most of my worries. Based on the readings, even if I decide to go with UE5, double precision do not resolve anything, it can help but does not do everything, and it is needed to use tricks (origin shifting, floating origin in relation to dynamic HLOD, Imposters, or LOD in general) to be able to manage big worlds and a strong coordinate system. I’ve the most appreciated comments of awesomedata and cosmochristo.

So it is completely feasible to develop a massive universe using BabylonJS and WebGPU. I’m still not sure how much elements I can draw before performance starts to decrease significantly. It’s probably based on many factors.

The streaming concept, even in a multiplayer environment, gain some more interest from me time to time.

Thanks for your answers, I could possibly annoy you with my questions at a later point.

About the precision questions, one of the community members posted an amazing resource about that: Floating Origin Template for BJS 5.x - Demos and projects - Babylon.js (babylonjs.com)

Thanks for these resources. Very interesting stuff. In addition I know a bit @imerso as I was following his previous C++ / Unity plugin in the past that involves LOD & a Procedural galaxy. I hope something similar is coming to BJS5 maybe as a plugin form or idk, pretty nicely surprised to see him here. He’s very strong :slight_smile:

3 Likes

Sorry to revive this thread. What if big int is used instead floats for a coordinate system still in the case of a very huge universe ? Using int won’t generate any jittering even if far away from origin (no calculation errors). I’m not sure what’s the biggest primitives you can use with WebGL / GPU. What’s the limit of the variables you can use with BabylonJs? Thanks.

Floating point precision in shaders is 32 bits and Javascript is using 64 bits floating point numbers. I don’t see how BigInt would help, as in some computations you will need to compute some cos or sin, for eg, and those are not supported by BigInt. Also, how do you store the result of 15/7? But the precision in shaders being 32 bits, this is the limiting factor anyway.

2 Likes